react-native-maps 1.21.0-alpha.98 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/android/build.gradle +65 -72
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/RCTAppDependencyProvider.h +25 -0
- package/android/src/main/RCTAppDependencyProvider.mm +55 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.mm +28 -0
- package/android/src/main/ReactAppDependencyProvider.podspec +34 -0
- package/android/src/main/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +209 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +74 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +45 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +22 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerDelegate.java +62 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerInterface.java +27 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerDelegate.java +56 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +5 -1
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +9 -3
- package/android/src/main/java/com/rnmaps/fabric/UrlTileManager.java +124 -0
- package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +19 -3
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +608 -603
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +2 -22
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +23 -1
- package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +18 -18
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +10 -14
- package/android/src/main/java/com/rnmaps/maps/MapView.java +58 -49
- package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +10 -10
- package/android/src/main/jni/CMakeLists.txt +36 -0
- package/android/src/main/jni/RNMapsSpecs-generated.cpp +68 -0
- package/android/src/main/jni/RNMapsSpecs.h +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +33 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +979 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +860 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +227 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +1297 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +26 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +131 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +137 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +13 -13
- package/ios/AirGoogleMaps/{AIRGoogleMap.m → AIRGoogleMap.mm} +32 -34
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +1 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.mm +543 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +5 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +41 -33
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +23 -14
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +1 -0
- package/ios/AirMaps/AIRMap.h +8 -9
- package/ios/AirMaps/{AIRMap.m → AIRMap.mm} +18 -14
- package/ios/AirMaps/AIRMapManager.m +8 -19
- package/ios/AirMaps/AIRMapMarker.m +57 -44
- package/ios/AirMaps/AIRMapOverlay.m +2 -2
- package/ios/AirMaps/AIRMapWMSTile.m +8 -8
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +77 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +51 -0
- package/ios/AirMaps/RNMapsAirModule.h +2 -3
- package/ios/AirMaps/RNMapsAirModule.mm +14 -0
- package/ios/AirMaps/RNMapsDefines.h +1 -0
- package/ios/AirMaps/RNMapsMapView.h +5 -2
- package/ios/AirMaps/RNMapsMapView.mm +16 -6
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.mm +12 -4
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +7 -0
- package/ios/AirMaps/module.modulemap +6 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +15 -55
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/ios/{AirMaps → generated}/RNMapsAirModuleDelegate.h +1 -1
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +846 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +194 -0
- package/ios/generated/RNMapsSpecs/Props.h +1224 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +591 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +109 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +113 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +268 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/module.modulemap +15 -0
- package/package.json +30 -25
- package/react-native-google-maps.podspec +27 -0
- package/react-native-maps-generated.podspec +31 -0
- package/react-native-maps.podspec +52 -46
- package/react-native.config.js +16 -0
- package/src/AnimatedRegion.ts +169 -0
- package/src/Geojson.tsx +541 -0
- package/src/MapCallout.tsx +77 -0
- package/src/MapCalloutSubview.tsx +64 -0
- package/src/MapCircle.tsx +162 -0
- package/src/MapHeatmap.tsx +125 -0
- package/src/MapLocalTile.tsx +60 -0
- package/src/MapMarker.tsx +531 -0
- package/src/MapMarkerNativeComponent.ts +51 -0
- package/src/MapOverlay.tsx +178 -0
- package/src/MapPolygon.tsx +188 -0
- package/src/MapPolygon.types.ts +25 -0
- package/src/MapPolyline.tsx +215 -0
- package/src/MapUrlTile.tsx +169 -0
- package/src/MapView.tsx +1230 -0
- package/src/MapView.types.ts +212 -0
- package/src/MapView.web.ts +2 -0
- package/src/MapViewNativeComponent.ts +86 -0
- package/src/MapWMSTile.tsx +148 -0
- package/src/ProviderConstants.ts +2 -0
- package/src/createFabricMap.tsx +253 -0
- package/src/decorateMapComponent.ts +227 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/{specs → src/specs}/NativeComponentCircle.ts +3 -4
- package/{specs → src/specs}/NativeComponentGoogleMapView.ts +15 -9
- package/{specs → src/specs}/NativeComponentMapView.ts +61 -32
- package/{specs → src/specs}/NativeComponentOverlay.ts +11 -2
- package/{specs → src/specs}/NativeComponentPolyline.ts +1 -1
- package/src/specs/NativeComponentUrlTile.ts +128 -0
- package/src/specs/NativeComponentWMSTile.ts +107 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -533
- package/lib/AnimatedRegion.d.ts +0 -19
- package/lib/AnimatedRegion.js +0 -134
- package/lib/Geojson.d.ts +0 -204
- package/lib/Geojson.js +0 -166
- package/lib/MapCallout.d.ts +0 -40
- package/lib/MapCallout.js +0 -51
- package/lib/MapCalloutSubview.d.ts +0 -34
- package/lib/MapCalloutSubview.js +0 -48
- package/lib/MapCircle.d.ts +0 -117
- package/lib/MapCircle.js +0 -53
- package/lib/MapHeatmap.d.ts +0 -78
- package/lib/MapHeatmap.js +0 -59
- package/lib/MapLocalTile.d.ts +0 -35
- package/lib/MapLocalTile.js +0 -44
- package/lib/MapMarker.d.ts +0 -322
- package/lib/MapMarker.js +0 -158
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -15
- package/lib/MapOverlay.d.ts +0 -88
- package/lib/MapOverlay.js +0 -65
- package/lib/MapPolygon.d.ts +0 -140
- package/lib/MapPolygon.js +0 -53
- package/lib/MapPolygon.types.d.ts +0 -18
- package/lib/MapPolygon.types.js +0 -2
- package/lib/MapPolyline.d.ts +0 -156
- package/lib/MapPolyline.js +0 -53
- package/lib/MapUrlTile.d.ts +0 -134
- package/lib/MapUrlTile.js +0 -44
- package/lib/MapView.d.ts +0 -703
- package/lib/MapView.js +0 -427
- package/lib/MapView.types.d.ts +0 -161
- package/lib/MapView.types.js +0 -2
- package/lib/MapView.web.d.ts +0 -1
- package/lib/MapView.web.js +0 -9
- package/lib/MapViewNativeComponent.d.ts +0 -18
- package/lib/MapViewNativeComponent.js +0 -19
- package/lib/MapWMSTile.d.ts +0 -116
- package/lib/MapWMSTile.js +0 -44
- package/lib/ProviderConstants.d.ts +0 -2
- package/lib/ProviderConstants.js +0 -5
- package/lib/createFabricMap.d.ts +0 -24
- package/lib/createFabricMap.js +0 -188
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -120
- package/lib/fixImageProp.d.ts +0 -4
- package/lib/fixImageProp.js +0 -16
- package/lib/index.d.ts +0 -38
- package/lib/index.js +0 -81
- package/lib/sharedTypes.d.ts +0 -81
- package/lib/sharedTypes.js +0 -2
- package/lib/sharedTypesInternal.js +0 -2
- package/lib/specs/NativeAirMapsModule.d.ts +0 -31
- package/lib/specs/NativeAirMapsModule.js +0 -4
- package/lib/specs/NativeComponentCallout.d.ts +0 -46
- package/lib/specs/NativeComponentCallout.js +0 -9
- package/lib/specs/NativeComponentCircle.d.ts +0 -74
- package/lib/specs/NativeComponentCircle.js +0 -7
- package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -713
- package/lib/specs/NativeComponentGoogleMapView.js +0 -22
- package/lib/specs/NativeComponentGooglePolygon.d.ts +0 -75
- package/lib/specs/NativeComponentGooglePolygon.js +0 -7
- package/lib/specs/NativeComponentMapView.d.ts +0 -847
- package/lib/specs/NativeComponentMapView.js +0 -20
- package/lib/specs/NativeComponentMarker.d.ts +0 -258
- package/lib/specs/NativeComponentMarker.js +0 -19
- package/lib/specs/NativeComponentOverlay.d.ts +0 -67
- package/lib/specs/NativeComponentOverlay.js +0 -7
- package/lib/specs/NativeComponentPolyline.d.ts +0 -101
- package/lib/specs/NativeComponentPolyline.js +0 -7
- /package/ios/AirMaps/{UIView +AirMap.m → UIView+AirMap.m} +0 -0
- /package/ios/{AirMaps → generated}/RNMapsHostVewDelegate.h +0 -0
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
- /package/{specs → src/specs}/NativeAirMapsModule.ts +0 -0
- /package/{specs → src/specs}/NativeComponentCallout.ts +0 -0
- /package/{specs → src/specs}/NativeComponentGooglePolygon.ts +0 -0
- /package/{specs → src/specs}/NativeComponentMarker.ts +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {ClickEvent, LatLng, Point, Region} from './sharedTypes';
|
|
2
|
+
import {NativeSyntheticEvent} from 'react-native';
|
|
3
|
+
|
|
4
|
+
// All types in this file are directly exported with the package for external
|
|
5
|
+
// use.
|
|
6
|
+
|
|
7
|
+
export type Camera = {
|
|
8
|
+
/**
|
|
9
|
+
* Apple Maps
|
|
10
|
+
*/
|
|
11
|
+
altitude?: number;
|
|
12
|
+
center: LatLng;
|
|
13
|
+
heading: number;
|
|
14
|
+
pitch: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Google Maps
|
|
18
|
+
*/
|
|
19
|
+
zoom?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MapStyleElement = {
|
|
23
|
+
featureType?: string;
|
|
24
|
+
elementType?: string;
|
|
25
|
+
stylers: object[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type EdgePadding = {
|
|
29
|
+
top: number;
|
|
30
|
+
right: number;
|
|
31
|
+
bottom: number;
|
|
32
|
+
left: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type MapType =
|
|
36
|
+
| 'hybrid'
|
|
37
|
+
| 'mutedStandard'
|
|
38
|
+
| 'none'
|
|
39
|
+
| 'satellite'
|
|
40
|
+
| 'standard'
|
|
41
|
+
| 'terrain'
|
|
42
|
+
| 'satelliteFlyover'
|
|
43
|
+
| 'hybridFlyover';
|
|
44
|
+
|
|
45
|
+
export type MapTypes = {
|
|
46
|
+
STANDARD: 'standard';
|
|
47
|
+
SATELLITE: 'satellite';
|
|
48
|
+
HYBRID: 'hybrid';
|
|
49
|
+
TERRAIN: 'terrain';
|
|
50
|
+
NONE: 'none';
|
|
51
|
+
MUTEDSTANDARD: 'mutedStandard';
|
|
52
|
+
SATELLITE_FLYOVER: 'satelliteFlyover';
|
|
53
|
+
HYBRID_FLYOVER: 'hybridFlyover';
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type IndoorLevel = {
|
|
57
|
+
index: number;
|
|
58
|
+
name: string;
|
|
59
|
+
shortName: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type ActiveIndoorLevel = {
|
|
63
|
+
activeLevelIndex: number;
|
|
64
|
+
name: string;
|
|
65
|
+
shortName: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
|
|
69
|
+
indoorLevel: ActiveIndoorLevel;
|
|
70
|
+
}>;
|
|
71
|
+
|
|
72
|
+
export type IndoorBuilding = {
|
|
73
|
+
underground: boolean;
|
|
74
|
+
activeLevelIndex: number;
|
|
75
|
+
levels: IndoorLevel[];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type IndoorBuildingEvent = NativeSyntheticEvent<{
|
|
79
|
+
IndoorBuilding: IndoorBuilding;
|
|
80
|
+
}>;
|
|
81
|
+
|
|
82
|
+
export type KmlMarker = {
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
description: string;
|
|
86
|
+
coordinate: LatLng;
|
|
87
|
+
position: Point;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type KmlMapEvent = NativeSyntheticEvent<{markers: KmlMarker[]}>;
|
|
91
|
+
|
|
92
|
+
export type LongPressEvent = ClickEvent<{
|
|
93
|
+
/**
|
|
94
|
+
* @platform Android
|
|
95
|
+
*/
|
|
96
|
+
action?: 'long-press';
|
|
97
|
+
}>;
|
|
98
|
+
|
|
99
|
+
export type PanDragEvent = ClickEvent;
|
|
100
|
+
|
|
101
|
+
export type PoiClickEvent = NativeSyntheticEvent<{
|
|
102
|
+
placeId: string;
|
|
103
|
+
name: string;
|
|
104
|
+
coordinate: LatLng;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @platform Android
|
|
108
|
+
*/
|
|
109
|
+
position?: Point;
|
|
110
|
+
}>;
|
|
111
|
+
|
|
112
|
+
export type MapPressEvent = ClickEvent<{
|
|
113
|
+
/**
|
|
114
|
+
* @platform Android
|
|
115
|
+
*/
|
|
116
|
+
action?: 'press' | 'marker-press';
|
|
117
|
+
}>;
|
|
118
|
+
|
|
119
|
+
export type Details = {
|
|
120
|
+
isGesture?: boolean;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type UserLocationChangeEvent = NativeSyntheticEvent<{
|
|
124
|
+
coordinate?: LatLng & {
|
|
125
|
+
altitude: number;
|
|
126
|
+
timestamp: number;
|
|
127
|
+
accuracy: number;
|
|
128
|
+
speed: number;
|
|
129
|
+
heading: number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @platform iOS
|
|
133
|
+
*/
|
|
134
|
+
altitudeAccuracy?: number;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @platform Android
|
|
138
|
+
*/
|
|
139
|
+
isFromMockProvider?: boolean;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @platform iOS
|
|
144
|
+
*/
|
|
145
|
+
error?: {
|
|
146
|
+
message: string;
|
|
147
|
+
};
|
|
148
|
+
}>;
|
|
149
|
+
|
|
150
|
+
export type ChangeEvent = NativeSyntheticEvent<{
|
|
151
|
+
continuous: boolean;
|
|
152
|
+
region: Region;
|
|
153
|
+
isGesture?: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
|
|
156
|
+
export type FitToOptions = {
|
|
157
|
+
edgePadding?: EdgePadding;
|
|
158
|
+
animated?: boolean;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export type BoundingBox = {northEast: LatLng; southWest: LatLng};
|
|
162
|
+
|
|
163
|
+
export type SnapshotOptions = {
|
|
164
|
+
/** optional, when omitted the view-width is used */
|
|
165
|
+
width?: number;
|
|
166
|
+
/** optional, when omitted the view-height is used */
|
|
167
|
+
height?: number;
|
|
168
|
+
/** __iOS only__, optional region to render */
|
|
169
|
+
region?: Region;
|
|
170
|
+
/** image formats, defaults to 'png' */
|
|
171
|
+
format?: 'png' | 'jpg';
|
|
172
|
+
/** image quality: 0..1 (only relevant for jpg, default: 1) */
|
|
173
|
+
quality?: number;
|
|
174
|
+
/** result types, defaults to 'file' */
|
|
175
|
+
result?: 'file' | 'base64';
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type Address = {
|
|
179
|
+
administrativeArea: string;
|
|
180
|
+
country: string;
|
|
181
|
+
countryCode: string;
|
|
182
|
+
locality: string;
|
|
183
|
+
name: string;
|
|
184
|
+
postalCode: string;
|
|
185
|
+
subAdministrativeArea: string;
|
|
186
|
+
subLocality: string;
|
|
187
|
+
thoroughfare: string;
|
|
188
|
+
subThoroughfare?: string;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export type CameraZoomRange = {
|
|
192
|
+
minCenterCoordinateDistance?: number;
|
|
193
|
+
maxCenterCoordinateDistance?: number;
|
|
194
|
+
animated?: boolean;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type NativeCommandName =
|
|
198
|
+
| 'animateCamera'
|
|
199
|
+
| 'animateToRegion'
|
|
200
|
+
| 'coordinateForPoint'
|
|
201
|
+
| 'fitToCoordinates'
|
|
202
|
+
| 'fitToElements'
|
|
203
|
+
| 'fitToSuppliedMarkers'
|
|
204
|
+
| 'getAddressFromCoordinates'
|
|
205
|
+
| 'getCamera'
|
|
206
|
+
| 'getMapBoundaries'
|
|
207
|
+
| 'getMarkersFrames'
|
|
208
|
+
| 'pointForCoordinate'
|
|
209
|
+
| 'setCamera'
|
|
210
|
+
| 'setIndoorActiveLevelIndex'
|
|
211
|
+
| 'setMapBoundaries'
|
|
212
|
+
| 'takeSnapshot';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type {HostComponent} from 'react-native';
|
|
2
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
3
|
+
import {NativeProps} from './MapView';
|
|
4
|
+
import {Camera, EdgePadding} from './MapView.types';
|
|
5
|
+
import {LatLng, Region} from './sharedTypes';
|
|
6
|
+
|
|
7
|
+
export type MapViewNativeComponentType = HostComponent<NativeProps>;
|
|
8
|
+
|
|
9
|
+
interface NativeCommands {
|
|
10
|
+
animateToRegion: (
|
|
11
|
+
viewRef: NonNullable<
|
|
12
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
13
|
+
>,
|
|
14
|
+
region: Region,
|
|
15
|
+
duration: number,
|
|
16
|
+
) => void;
|
|
17
|
+
|
|
18
|
+
setCamera: (
|
|
19
|
+
viewRef: NonNullable<
|
|
20
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
21
|
+
>,
|
|
22
|
+
camera: Partial<Camera>,
|
|
23
|
+
) => void;
|
|
24
|
+
|
|
25
|
+
animateCamera: (
|
|
26
|
+
viewRef: NonNullable<
|
|
27
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
28
|
+
>,
|
|
29
|
+
camera: Partial<Camera>,
|
|
30
|
+
duration: number,
|
|
31
|
+
) => void;
|
|
32
|
+
|
|
33
|
+
fitToElements: (
|
|
34
|
+
viewRef: NonNullable<
|
|
35
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
36
|
+
>,
|
|
37
|
+
edgePadding: EdgePadding,
|
|
38
|
+
animated: boolean,
|
|
39
|
+
) => void;
|
|
40
|
+
|
|
41
|
+
fitToSuppliedMarkers: (
|
|
42
|
+
viewRef: NonNullable<
|
|
43
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
44
|
+
>,
|
|
45
|
+
markers: string[],
|
|
46
|
+
edgePadding: EdgePadding,
|
|
47
|
+
animated: boolean,
|
|
48
|
+
) => void;
|
|
49
|
+
|
|
50
|
+
fitToCoordinates: (
|
|
51
|
+
viewRef: NonNullable<
|
|
52
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
53
|
+
>,
|
|
54
|
+
coordinates: LatLng[],
|
|
55
|
+
edgePadding: EdgePadding,
|
|
56
|
+
animated: boolean,
|
|
57
|
+
) => void;
|
|
58
|
+
|
|
59
|
+
setMapBoundaries: (
|
|
60
|
+
viewRef: NonNullable<
|
|
61
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
62
|
+
>,
|
|
63
|
+
northEast: LatLng,
|
|
64
|
+
southWest: LatLng,
|
|
65
|
+
) => void;
|
|
66
|
+
|
|
67
|
+
setIndoorActiveLevelIndex: (
|
|
68
|
+
viewRef: NonNullable<
|
|
69
|
+
React.RefObject<MapViewNativeComponentType>['current']
|
|
70
|
+
>,
|
|
71
|
+
activeLevelIndex: number,
|
|
72
|
+
) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
76
|
+
supportedCommands: [
|
|
77
|
+
'animateToRegion',
|
|
78
|
+
'setCamera',
|
|
79
|
+
'animateCamera',
|
|
80
|
+
'fitToElements',
|
|
81
|
+
'fitToSuppliedMarkers',
|
|
82
|
+
'fitToCoordinates',
|
|
83
|
+
'setMapBoundaries',
|
|
84
|
+
'setIndoorActiveLevelIndex',
|
|
85
|
+
],
|
|
86
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {ViewProps} from 'react-native';
|
|
3
|
+
|
|
4
|
+
import decorateMapComponent, {
|
|
5
|
+
USES_DEFAULT_IMPLEMENTATION,
|
|
6
|
+
SUPPORTED,
|
|
7
|
+
ProviderContext,
|
|
8
|
+
NativeComponent,
|
|
9
|
+
MapManagerCommand,
|
|
10
|
+
UIManagerCommand,
|
|
11
|
+
} from './decorateMapComponent';
|
|
12
|
+
|
|
13
|
+
export type MapWMSTileProps = ViewProps & {
|
|
14
|
+
/**
|
|
15
|
+
* The maximum native zoom level for this tile overlay i.e. the highest zoom level that the tile server provides.
|
|
16
|
+
* Tiles are auto-scaled for higher zoom levels.
|
|
17
|
+
*
|
|
18
|
+
* @platform iOS: Apple Maps only
|
|
19
|
+
* @platform Android: Supported
|
|
20
|
+
*/
|
|
21
|
+
maximumNativeZ?: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The maximum zoom level for this tile overlay.
|
|
25
|
+
*
|
|
26
|
+
* @platform iOS: Supported
|
|
27
|
+
* @platform Android: Supported
|
|
28
|
+
*/
|
|
29
|
+
maximumZ?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The minimum zoom level for this tile overlay.
|
|
33
|
+
*
|
|
34
|
+
* @platform iOS: Supported
|
|
35
|
+
* @platform Android: Supported
|
|
36
|
+
*/
|
|
37
|
+
minimumZ?: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* In offline-mode tiles are not fetched from the tile servers, rather only tiles stored in the cache directory are used.
|
|
41
|
+
* Furthermore, automated tile scaling is activated: if tile at a desired zoom level is not found from the cache directory,
|
|
42
|
+
* then lower zoom level tile is used (up to 4 levels lower) and scaled.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
* @platform iOS: Apple Maps only
|
|
46
|
+
* @platform Android: Supported
|
|
47
|
+
*/
|
|
48
|
+
offlineMode?: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Map layer opacity. Value between 0 - 1, with 0 meaning fully transparent.
|
|
52
|
+
*
|
|
53
|
+
* @platform iOS: Supported
|
|
54
|
+
* @platform Android: Supported
|
|
55
|
+
*/
|
|
56
|
+
opacity?: number;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Corresponds to MKTileOverlay canReplaceMapContent i.e. if true then underlying iOS basemap is not shown.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
* @platform iOS: Apple Maps only
|
|
63
|
+
* @platform Android: Not supported
|
|
64
|
+
*/
|
|
65
|
+
shouldReplaceMapContent?: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Defines maximum age in seconds for a cached tile before it's refreshed.
|
|
69
|
+
*
|
|
70
|
+
* NB! Refresh logic is "serve-stale-while-refresh"
|
|
71
|
+
* i.e. to ensure map availability a stale (over max age) tile is served
|
|
72
|
+
* while a tile refresh process is started in the background.
|
|
73
|
+
*
|
|
74
|
+
* @platform iOS: Apple Maps only
|
|
75
|
+
* @platform Android: Supported
|
|
76
|
+
*/
|
|
77
|
+
tileCacheMaxAge?: number;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Enable caching of tiles in the specified directory.
|
|
81
|
+
* Directory can be specified either as a normal path or in URL format (`file://`).
|
|
82
|
+
*
|
|
83
|
+
* Tiles are stored in tileCachePath directory as `/{z}/{x}/{y}` i.e. in sub-directories 2-levels deep,
|
|
84
|
+
* filename is tile y-coordinate without any filetype-extension.
|
|
85
|
+
*
|
|
86
|
+
* NB! All cache management needs to be implemented by client e.g. deleting tiles to manage use of storage space etc.
|
|
87
|
+
*
|
|
88
|
+
* @platform iOS: Apple Maps only
|
|
89
|
+
* @platform Android: Supported
|
|
90
|
+
*/
|
|
91
|
+
tileCachePath?: string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Tile size, default size is 256 (for tiles of 256 _ 256 pixels).
|
|
95
|
+
* High-res (aka 'retina') tiles are 512 (tiles of 512 _ 512 pixels)
|
|
96
|
+
*
|
|
97
|
+
* @platform iOS: Supported
|
|
98
|
+
* @platform Android: Supported
|
|
99
|
+
*/
|
|
100
|
+
tileSize?: number;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The url template of the map tileserver.
|
|
104
|
+
* (URLTile) The patterns {x} {y} {z} will be replaced at runtime.
|
|
105
|
+
* For example, http://c.tile.openstreetmap.org/{z}/{x}/{y}.png.
|
|
106
|
+
*
|
|
107
|
+
* It is also possible to refer to tiles in local filesystem with file:///top-level-directory/sub-directory/{z}/{x}/{y}.png URL-format.
|
|
108
|
+
* (WMSTile) The patterns {minX} {maxX} {minY} {maxY} {width} {height} will be replaced at runtime according to EPSG:900913 specification bounding box.
|
|
109
|
+
* For example, https://demo.geo-solutions.it/geoserver/tiger/wms?service=WMS&version=1.1.0&request=GetMap&layers=tiger:poi&styles=&bbox={minX},{minY},{maxX},{maxY}&width={width}&height={height}&srs=EPSG:900913&format=image/png&transparent=true&format_options=dpi:213.
|
|
110
|
+
*
|
|
111
|
+
* @platform iOS: Supported
|
|
112
|
+
* @platform Android: Supported
|
|
113
|
+
*/
|
|
114
|
+
urlTemplate: string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The order in which this tile overlay is drawn with respect to other overlays.
|
|
118
|
+
* An overlay with a larger z-index is drawn over overlays with smaller z-indices.
|
|
119
|
+
* The order of overlays with the same z-index is arbitrary.
|
|
120
|
+
*
|
|
121
|
+
* @platform iOS: Google Maps only
|
|
122
|
+
* @platform Android: Supported
|
|
123
|
+
*/
|
|
124
|
+
zIndex?: number;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
type NativeProps = MapWMSTileProps;
|
|
128
|
+
|
|
129
|
+
export class MapWMSTile extends React.Component<MapWMSTileProps> {
|
|
130
|
+
// declaration only, as they are set through decorateMap
|
|
131
|
+
/// @ts-ignore
|
|
132
|
+
context!: React.ContextType<typeof ProviderContext>;
|
|
133
|
+
getNativeComponent!: () => NativeComponent<NativeProps>;
|
|
134
|
+
getMapManagerCommand!: (name: string) => MapManagerCommand;
|
|
135
|
+
getUIManagerCommand!: (name: string) => UIManagerCommand;
|
|
136
|
+
|
|
137
|
+
render() {
|
|
138
|
+
const AIRMapWMSTile = this.getNativeComponent();
|
|
139
|
+
return <AIRMapWMSTile {...this.props} />;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default decorateMapComponent(MapWMSTile, 'WMSTile', {
|
|
144
|
+
google: {
|
|
145
|
+
ios: SUPPORTED,
|
|
146
|
+
android: USES_DEFAULT_IMPLEMENTATION,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import React, {forwardRef, useImperativeHandle, useRef} from 'react';
|
|
2
|
+
import {findNodeHandle} from 'react-native';
|
|
3
|
+
import type {LatLng, Point, Region} from './sharedTypes';
|
|
4
|
+
import type {
|
|
5
|
+
Address,
|
|
6
|
+
Camera,
|
|
7
|
+
EdgePadding,
|
|
8
|
+
SnapshotOptions,
|
|
9
|
+
} from './MapView.types';
|
|
10
|
+
import NativeAirMapsModule, {MapBoundaries} from './specs/NativeAirMapsModule';
|
|
11
|
+
import {MapFabricNativeProps} from './specs/NativeComponentMapView';
|
|
12
|
+
|
|
13
|
+
export type FabricMapViewProps = MapFabricNativeProps;
|
|
14
|
+
|
|
15
|
+
export interface FabricMapHandle {
|
|
16
|
+
getCamera: () => Promise<Camera>;
|
|
17
|
+
setCamera: (camera: Partial<Camera>) => void;
|
|
18
|
+
animateToRegion: (region: Region, duration: number) => void;
|
|
19
|
+
animateCamera: (camera: Partial<Camera>, duration: number) => void;
|
|
20
|
+
getMarkersFrames: (onlyVisible: boolean) => Promise<unknown>;
|
|
21
|
+
fitToElements: (edgePadding: EdgePadding, animated: boolean) => void;
|
|
22
|
+
|
|
23
|
+
fitToSuppliedMarkers: (
|
|
24
|
+
markers: string[],
|
|
25
|
+
edgePadding: EdgePadding,
|
|
26
|
+
animated: boolean,
|
|
27
|
+
) => void;
|
|
28
|
+
|
|
29
|
+
fitToCoordinates: (
|
|
30
|
+
coordinates: LatLng[],
|
|
31
|
+
edgePadding: EdgePadding,
|
|
32
|
+
animated: boolean,
|
|
33
|
+
) => void;
|
|
34
|
+
|
|
35
|
+
getMapBoundaries: () => Promise<MapBoundaries>;
|
|
36
|
+
takeSnapshot: (config: SnapshotOptions) => Promise<string>;
|
|
37
|
+
getAddressFromCoordinates: (coordinate: LatLng) => Promise<Address>;
|
|
38
|
+
getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
|
|
39
|
+
getCoordinateForPoint: (point: Point) => Promise<LatLng>;
|
|
40
|
+
setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
|
|
44
|
+
return forwardRef<FabricMapHandle, FabricMapViewProps>((props, ref) => {
|
|
45
|
+
const fabricRef = useRef<React.ElementRef<typeof ViewComponent>>(null);
|
|
46
|
+
|
|
47
|
+
useImperativeHandle(ref, () => ({
|
|
48
|
+
async getMarkersFrames(onlyVisible: boolean) {
|
|
49
|
+
if (fabricRef.current) {
|
|
50
|
+
return NativeAirMapsModule.getMarkersFrames(
|
|
51
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
52
|
+
onlyVisible,
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error(
|
|
56
|
+
'getMarkersFrames is only supported on iOS with Fabric.',
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async getCoordinateForPoint(point: Point) {
|
|
61
|
+
if (fabricRef.current) {
|
|
62
|
+
return NativeAirMapsModule.getCoordinateForPoint(
|
|
63
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
64
|
+
point,
|
|
65
|
+
);
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(
|
|
68
|
+
'getCoordinateForPoint is only supported on iOS with Fabric.',
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
async getPointForCoordinate(coordinate: LatLng) {
|
|
73
|
+
if (fabricRef.current) {
|
|
74
|
+
return NativeAirMapsModule.getPointForCoordinate(
|
|
75
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
76
|
+
coordinate,
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
throw new Error(
|
|
80
|
+
'getPointForCoordinate is not supported on this platform.',
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
async getAddressFromCoordinates(coordinate: LatLng) {
|
|
85
|
+
if (fabricRef.current) {
|
|
86
|
+
return NativeAirMapsModule.getAddressFromCoordinates(
|
|
87
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
88
|
+
coordinate,
|
|
89
|
+
);
|
|
90
|
+
} else {
|
|
91
|
+
throw new Error(
|
|
92
|
+
'getAddressFromCoordinates is not supported on this platform',
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
async takeSnapshot(config: SnapshotOptions) {
|
|
97
|
+
if (fabricRef.current) {
|
|
98
|
+
return NativeAirMapsModule.takeSnapshot(
|
|
99
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
100
|
+
JSON.stringify(config),
|
|
101
|
+
);
|
|
102
|
+
} else {
|
|
103
|
+
throw new Error('takeSnapshot is only supported on iOS with Fabric.');
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
async getCamera() {
|
|
107
|
+
if (fabricRef.current) {
|
|
108
|
+
return NativeAirMapsModule.getCamera(
|
|
109
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
110
|
+
);
|
|
111
|
+
} else {
|
|
112
|
+
throw new Error('getCamera is only supported on iOS with Fabric.');
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
async getMapBoundaries() {
|
|
116
|
+
if (fabricRef.current) {
|
|
117
|
+
return NativeAirMapsModule.getMapBoundaries(
|
|
118
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
119
|
+
);
|
|
120
|
+
} else {
|
|
121
|
+
throw new Error(
|
|
122
|
+
'getMapBoundaries is only supported on iOS with Fabric.',
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
animateToRegion(region: Region, duration: number) {
|
|
127
|
+
if (fabricRef.current) {
|
|
128
|
+
try {
|
|
129
|
+
Commands.animateToRegion(
|
|
130
|
+
fabricRef.current,
|
|
131
|
+
JSON.stringify(region),
|
|
132
|
+
duration,
|
|
133
|
+
);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
throw new Error('Failed to animateToRegion');
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
throw new Error(
|
|
139
|
+
'animateToRegion is only supported on iOS with Fabric.',
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
fitToElements(edgePadding: EdgePadding, animated: boolean) {
|
|
144
|
+
if (fabricRef.current) {
|
|
145
|
+
try {
|
|
146
|
+
Commands.fitToElements(
|
|
147
|
+
fabricRef.current,
|
|
148
|
+
JSON.stringify(edgePadding),
|
|
149
|
+
animated,
|
|
150
|
+
);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
throw new Error('Failed to fitToElements');
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
throw new Error(
|
|
156
|
+
'fitToElements is only supported on iOS with Fabric.',
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
fitToSuppliedMarkers(
|
|
161
|
+
markers: string[],
|
|
162
|
+
edgePadding: EdgePadding,
|
|
163
|
+
animated: boolean,
|
|
164
|
+
) {
|
|
165
|
+
if (fabricRef.current) {
|
|
166
|
+
try {
|
|
167
|
+
Commands.fitToSuppliedMarkers(
|
|
168
|
+
fabricRef.current,
|
|
169
|
+
JSON.stringify(markers),
|
|
170
|
+
JSON.stringify(edgePadding),
|
|
171
|
+
animated,
|
|
172
|
+
);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
throw new Error('Failed to fitToSuppliedMarkers');
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
throw new Error(
|
|
178
|
+
'fitToSuppliedMarkers is only supported on iOS with Fabric.',
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
animateCamera(camera: Partial<Camera>, duration: number) {
|
|
183
|
+
if (fabricRef.current) {
|
|
184
|
+
try {
|
|
185
|
+
Commands.animateCamera(
|
|
186
|
+
fabricRef.current,
|
|
187
|
+
JSON.stringify(camera),
|
|
188
|
+
duration,
|
|
189
|
+
);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
throw new Error('Failed to animateCamera');
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
throw new Error(
|
|
195
|
+
'animateCamera is only supported on iOS with Fabric.',
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
fitToCoordinates(
|
|
200
|
+
coordinates: LatLng[],
|
|
201
|
+
edgePadding: EdgePadding,
|
|
202
|
+
animated: boolean,
|
|
203
|
+
) {
|
|
204
|
+
if (fabricRef.current) {
|
|
205
|
+
try {
|
|
206
|
+
Commands.fitToCoordinates(
|
|
207
|
+
fabricRef.current,
|
|
208
|
+
JSON.stringify(coordinates),
|
|
209
|
+
JSON.stringify(edgePadding),
|
|
210
|
+
animated,
|
|
211
|
+
);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
throw new Error('Failed to fitToCoordinates');
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
throw new Error(
|
|
217
|
+
'fitToCoordinates is only supported on iOS with Fabric.',
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
setIndoorActiveLevelIndex(activeLevelIndex: number) {
|
|
222
|
+
if (fabricRef.current) {
|
|
223
|
+
try {
|
|
224
|
+
Commands.setIndoorActiveLevelIndex(
|
|
225
|
+
fabricRef.current,
|
|
226
|
+
activeLevelIndex,
|
|
227
|
+
);
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.error('Failed to set camera:', error);
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
console.warn('setIndoorActiveLevelIndex is not supported.');
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
setCamera(camera: Partial<Camera>) {
|
|
236
|
+
if (fabricRef.current) {
|
|
237
|
+
try {
|
|
238
|
+
Commands.setCamera(fabricRef.current, JSON.stringify(camera));
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error('Failed to set camera:', error);
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
console.warn('setCamera is not supported');
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
}));
|
|
247
|
+
|
|
248
|
+
// @ts-ignore
|
|
249
|
+
return <ViewComponent {...props} ref={fabricRef} />;
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export default createFabricMap;
|