forked from react-native-maps/react-native-maps
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMapViewNativeComponent.ts
86 lines (76 loc) · 2.08 KB
/
MapViewNativeComponent.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import type {HostComponent} from 'react-native';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import {NativeProps} from './MapView';
import {Camera, EdgePadding} from './MapView.types';
import {LatLng, Region} from './sharedTypes';
export type MapViewNativeComponentType = HostComponent<NativeProps>;
interface NativeCommands {
animateToRegion: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
region: Region,
duration: number,
) => void;
setCamera: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
camera: Partial<Camera>,
) => void;
animateCamera: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
camera: Partial<Camera>,
duration: number,
) => void;
fitToElements: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
edgePadding: EdgePadding,
animated: boolean,
) => void;
fitToSuppliedMarkers: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
markers: string[],
edgePadding: EdgePadding,
animated: boolean,
) => void;
fitToCoordinates: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
coordinates: LatLng[],
edgePadding: EdgePadding,
animated: boolean,
) => void;
setMapBoundaries: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
northEast: LatLng,
southWest: LatLng,
) => void;
setIndoorActiveLevelIndex: (
viewRef: NonNullable<
React.RefObject<MapViewNativeComponentType>['current']
>,
activeLevelIndex: number,
) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: [
'animateToRegion',
'setCamera',
'animateCamera',
'fitToElements',
'fitToSuppliedMarkers',
'fitToCoordinates',
'setMapBoundaries',
'setIndoorActiveLevelIndex',
],
});