Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 1x | /// <reference types="@uiw/react-baidu-map-types" />
import React, { useImperativeHandle } from 'react';
import { OverlayProps } from '@uiw/react-baidu-map-map';
import { useGeolocationControl } from './useGeolocationControl';
export * from './useGeolocationControl';
export interface GeolocationControlProps extends OverlayProps, BMap.GeolocationControlOptions {
/**
* 定位成功后触发此事件
*/
onLocationSuccess?(result: { point: BMap.Point; addressComponent: BMap.AddressComponent }): void;
/**
* 定位失败后触发此事件
*/
onLocationError?(error: { statusCode: BMap.StatusCode }): void;
}
export default React.forwardRef<GeolocationControlProps, GeolocationControlProps>((props, ref) => {
const { geolocationControl } = useGeolocationControl(props);
useImperativeHandle(ref, () => ({ ...props, geolocationControl }), [geolocationControl, props]);
return null;
});
|