react-native-maps 1.21.0-alpha.11 → 1.21.0-alpha.111

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.
Files changed (133) hide show
  1. package/android/build.gradle +77 -57
  2. package/android/gradlew +1 -2
  3. package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
  4. package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
  5. package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
  6. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
  7. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
  8. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +235 -2
  9. package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
  10. package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
  11. package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
  12. package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
  13. package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
  14. package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
  15. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
  16. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
  17. package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
  18. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
  19. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
  20. package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
  21. package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
  22. package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
  23. package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
  24. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
  25. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
  26. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
  27. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
  28. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
  29. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
  30. package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
  31. package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
  32. package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
  33. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
  34. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
  35. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
  36. package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
  37. package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
  38. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +39 -3
  39. package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
  40. package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
  41. package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
  42. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +637 -556
  43. package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
  44. package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
  45. package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +267 -151
  46. package/android/src/main/java/com/rnmaps/maps/MapPolygon.java +31 -1
  47. package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
  48. package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
  49. package/android/src/main/java/com/rnmaps/maps/MapView.java +1650 -1337
  50. package/ios/AirGoogleMaps/AIRGMSMarker.h +1 -1
  51. package/ios/AirGoogleMaps/AIRGoogleMap.h +9 -10
  52. package/ios/AirGoogleMaps/AIRGoogleMap.m +112 -74
  53. package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
  54. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +10 -9
  55. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
  56. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
  57. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
  58. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +2 -1
  59. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +30 -0
  60. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +0 -1
  61. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +0 -7
  62. package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
  63. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
  64. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +4 -4
  65. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
  66. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +137 -57
  67. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
  68. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
  69. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
  70. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +26 -0
  71. package/ios/AirMaps/AIRMap.h +7 -7
  72. package/ios/AirMaps/AIRMap.m +227 -236
  73. package/ios/AirMaps/AIRMapManager.m +13 -7
  74. package/ios/AirMaps/AIRMapMarker.h +1 -0
  75. package/ios/AirMaps/AIRMapMarker.m +165 -103
  76. package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
  77. package/ios/AirMaps/NSObject+DynamicLoad.h +16 -0
  78. package/ios/AirMaps/NSObject+DynamicLoad.m +28 -0
  79. package/ios/AirMaps/RNMapsAirModule.h +1 -1
  80. package/ios/AirMaps/RNMapsAirModule.mm +4 -3
  81. package/ios/AirMaps/RNMapsAirModuleDelegate.h +2 -2
  82. package/ios/AirMaps/RNMapsMapView.mm +332 -295
  83. package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
  84. package/ios/AirMaps/RNMapsMarkerView.h +24 -0
  85. package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
  86. package/ios/AirMaps/RNMapsMarkerViewManager.mm +28 -0
  87. package/ios/AirMaps.xcodeproj/project.pbxproj +20 -0
  88. package/lib/MapCircle.d.ts +1 -1
  89. package/lib/MapHeatmap.d.ts +2 -2
  90. package/lib/MapHeatmap.js +1 -1
  91. package/lib/MapMarker.d.ts +16 -3
  92. package/lib/MapMarker.js +55 -13
  93. package/lib/MapMarkerNativeComponent.js +0 -2
  94. package/lib/MapOverlay.d.ts +1 -0
  95. package/lib/MapOverlay.js +11 -9
  96. package/lib/MapPolygon.d.ts +1 -1
  97. package/lib/MapPolyline.d.ts +7 -7
  98. package/lib/MapView.d.ts +17 -29
  99. package/lib/MapView.js +114 -128
  100. package/lib/MapView.types.d.ts +1 -1
  101. package/lib/createFabricMap.d.ts +1 -0
  102. package/lib/createFabricMap.js +17 -4
  103. package/lib/decorateMapComponent.js +40 -0
  104. package/lib/fixImageProp.d.ts +4 -0
  105. package/lib/fixImageProp.js +16 -0
  106. package/lib/specs/NativeAirMapsModule.d.ts +2 -2
  107. package/lib/specs/NativeComponentCallout.d.ts +46 -0
  108. package/lib/specs/NativeComponentCallout.js +9 -0
  109. package/lib/specs/NativeComponentCircle.d.ts +74 -0
  110. package/lib/specs/NativeComponentCircle.js +7 -0
  111. package/lib/specs/NativeComponentGoogleMapView.d.ts +19 -22
  112. package/lib/specs/NativeComponentGoogleMapView.js +1 -0
  113. package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
  114. package/lib/specs/NativeComponentGooglePolygon.js +7 -0
  115. package/lib/specs/NativeComponentMapView.d.ts +43 -56
  116. package/lib/specs/NativeComponentMapView.js +2 -3
  117. package/lib/specs/NativeComponentMarker.d.ts +258 -0
  118. package/lib/specs/NativeComponentMarker.js +19 -0
  119. package/lib/specs/NativeComponentOverlay.d.ts +67 -0
  120. package/lib/specs/NativeComponentOverlay.js +7 -0
  121. package/lib/specs/NativeComponentPolyline.d.ts +101 -0
  122. package/lib/specs/NativeComponentPolyline.js +7 -0
  123. package/package.json +21 -19
  124. package/react-native-maps.podspec +15 -15
  125. package/specs/NativeAirMapsModule.ts +36 -0
  126. package/specs/NativeComponentCallout.ts +63 -0
  127. package/specs/NativeComponentCircle.ts +94 -0
  128. package/specs/NativeComponentGoogleMapView.ts +913 -0
  129. package/specs/NativeComponentGooglePolygon.ts +94 -0
  130. package/specs/NativeComponentMapView.ts +1059 -0
  131. package/specs/NativeComponentMarker.ts +326 -0
  132. package/specs/NativeComponentOverlay.ts +89 -0
  133. package/specs/NativeComponentPolyline.ts +124 -0
package/lib/MapView.js CHANGED
@@ -35,7 +35,10 @@ const NativeComponentMapView_1 = __importStar(require("./specs/NativeComponentMa
35
35
  const NativeComponentGoogleMapView_1 = __importStar(require("./specs/NativeComponentGoogleMapView"));
36
36
  const createFabricMap_1 = __importDefault(require("./createFabricMap"));
37
37
  const FabricMap = (0, createFabricMap_1.default)(NativeComponentMapView_1.default, NativeComponentMapView_1.Commands);
38
- const FabricGoogleMap = (0, createFabricMap_1.default)(NativeComponentGoogleMapView_1.default, NativeComponentGoogleMapView_1.Commands);
38
+ var FabricGoogleMap = null;
39
+ if (react_native_1.Platform.OS === 'ios') {
40
+ FabricGoogleMap = (0, createFabricMap_1.default)(NativeComponentGoogleMapView_1.default, NativeComponentGoogleMapView_1.Commands);
41
+ }
39
42
  exports.MAP_TYPES = {
40
43
  STANDARD: 'standard',
41
44
  SATELLITE: 'satellite',
@@ -49,13 +52,13 @@ exports.MAP_TYPES = {
49
52
  class MapView extends React.Component {
50
53
  static Animated;
51
54
  map;
52
- fabricMap;
55
+ fabricMap = React.createRef();
53
56
  constructor(props) {
54
57
  super(props);
55
58
  this.map = React.createRef();
56
59
  this.fabricMap = React.createRef();
57
60
  this.state = {
58
- isReady: react_native_1.Platform.OS === 'ios',
61
+ isReady: false,
59
62
  };
60
63
  this._onMapReady = this._onMapReady.bind(this);
61
64
  this._onChange = this._onChange.bind(this);
@@ -85,13 +88,8 @@ class MapView extends React.Component {
85
88
  }
86
89
  }
87
90
  getCamera() {
88
- if (react_native_1.Platform.OS === 'android') {
89
- return react_native_1.NativeModules.AirMapModule.getCamera(this._getHandle());
90
- }
91
- else if (react_native_1.Platform.OS === 'ios') {
92
- if (this.fabricMap.current) {
93
- return this.fabricMap.current.getCamera();
94
- }
91
+ if (this.fabricMap.current) {
92
+ return this.fabricMap.current.getCamera();
95
93
  }
96
94
  return Promise.reject('getCamera not supported on this platform');
97
95
  }
@@ -119,6 +117,12 @@ class MapView extends React.Component {
119
117
  MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
120
118
  }
121
119
  }
120
+ setRegion(region) {
121
+ if (this.fabricMap.current) {
122
+ this.fabricMap.current.animateToRegion(region, 0);
123
+ }
124
+ //TODO fix for android
125
+ }
122
126
  fitToElements(options = {}) {
123
127
  const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
124
128
  if (this.fabricMap.current) {
@@ -152,13 +156,8 @@ class MapView extends React.Component {
152
156
  * @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
153
157
  */
154
158
  async getMapBoundaries() {
155
- if (react_native_1.Platform.OS === 'android') {
156
- return await react_native_1.NativeModules.AirMapModule.getMapBoundaries(this._getHandle());
157
- }
158
- else if (react_native_1.Platform.OS === 'ios') {
159
- if (this.fabricMap.current) {
160
- return this.fabricMap.current.getMapBoundaries();
161
- }
159
+ if (this.fabricMap.current) {
160
+ return this.fabricMap.current.getMapBoundaries();
162
161
  }
163
162
  return Promise.reject('getMapBoundaries not supported on this platform');
164
163
  }
@@ -168,9 +167,10 @@ class MapView extends React.Component {
168
167
  }
169
168
  }
170
169
  setIndoorActiveLevelIndex(activeLevelIndex) {
171
- if (this.map.current) {
172
- MapViewNativeComponent_1.Commands.setIndoorActiveLevelIndex(this.map.current, activeLevelIndex);
170
+ if (this.fabricMap.current) {
171
+ return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
173
172
  }
173
+ return Promise.reject('getMapBoundaries not supported on this platform');
174
174
  }
175
175
  /**
176
176
  * Takes a snapshot of the map and saves it to a picture
@@ -202,15 +202,9 @@ class MapView extends React.Component {
202
202
  if (config.result !== 'file' && config.result !== 'base64') {
203
203
  throw new Error('Invalid result specified');
204
204
  }
205
- // Call native function
206
- if (react_native_1.Platform.OS === 'android') {
207
- return react_native_1.NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
208
- }
209
- else if (react_native_1.Platform.OS === 'ios') {
210
- if (this.fabricMap.current) {
211
- // @ts-ignore
212
- return this.fabricMap.current.takeSnapshot(config);
213
- }
205
+ if (this.fabricMap.current) {
206
+ // @ts-ignore
207
+ return this.fabricMap.current.takeSnapshot(config);
214
208
  }
215
209
  return Promise.reject('takeSnapshot not supported on this platform');
216
210
  }
@@ -224,13 +218,8 @@ class MapView extends React.Component {
224
218
  * @return Promise with return type Address
225
219
  */
226
220
  addressForCoordinate(coordinate) {
227
- if (react_native_1.Platform.OS === 'android') {
228
- return react_native_1.NativeModules.AirMapModule.getAddressFromCoordinates(this._getHandle(), coordinate);
229
- }
230
- else if (react_native_1.Platform.OS === 'ios') {
231
- if (this.fabricMap.current) {
232
- return this.fabricMap.current.getAddressFromCoordinates(coordinate);
233
- }
221
+ if (this.fabricMap.current) {
222
+ return this.fabricMap.current.getAddressFromCoordinates(coordinate);
234
223
  }
235
224
  return Promise.reject('getAddress not supported on this platform');
236
225
  }
@@ -244,13 +233,8 @@ class MapView extends React.Component {
244
233
  * @return Promise Promise with the point ({ x: Number, y: Number })
245
234
  */
246
235
  pointForCoordinate(coordinate) {
247
- if (react_native_1.Platform.OS === 'android') {
248
- return react_native_1.NativeModules.AirMapModule.pointForCoordinate(this._getHandle(), coordinate);
249
- }
250
- else if (react_native_1.Platform.OS === 'ios') {
251
- if (this.fabricMap.current) {
252
- return this.fabricMap.current.getPointForCoordinate(coordinate);
253
- }
236
+ if (this.fabricMap.current) {
237
+ return this.fabricMap.current.getPointForCoordinate(coordinate);
254
238
  }
255
239
  return Promise.reject('pointForCoordinate not supported on this platform');
256
240
  }
@@ -264,13 +248,8 @@ class MapView extends React.Component {
264
248
  * @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
265
249
  */
266
250
  coordinateForPoint(point) {
267
- if (react_native_1.Platform.OS === 'android') {
268
- return react_native_1.NativeModules.AirMapModule.coordinateForPoint(this._getHandle(), point);
269
- }
270
- else if (react_native_1.Platform.OS === 'ios') {
271
- if (this.fabricMap.current) {
272
- return this.fabricMap.current.getCoordinateForPoint(point);
273
- }
251
+ if (this.fabricMap.current) {
252
+ return this.fabricMap.current.getCoordinateForPoint(point);
274
253
  }
275
254
  return Promise.reject('coordinateForPoint not supported on this platform');
276
255
  }
@@ -282,11 +261,9 @@ class MapView extends React.Component {
282
261
  * @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
283
262
  */
284
263
  getMarkersFrames(onlyVisible = false) {
285
- if (react_native_1.Platform.OS === 'ios') {
286
- if (this.fabricMap.current) {
287
- // @ts-ignore
288
- return this.fabricMap.current.getMarkersFrames(onlyVisible);
289
- }
264
+ if (this.fabricMap.current) {
265
+ // @ts-ignore
266
+ return this.fabricMap.current.getMarkersFrames(onlyVisible);
290
267
  }
291
268
  return Promise.reject('getMarkersFrames not supported on this platform');
292
269
  }
@@ -327,6 +304,11 @@ class MapView extends React.Component {
327
304
  this.props.onMarkerSelect(event);
328
305
  }
329
306
  };
307
+ handleKmlReady = (event) => {
308
+ if (this.props.onKmlReady) {
309
+ this.props.onKmlReady(event);
310
+ }
311
+ };
330
312
  handleMarkerDeselect = (event) => {
331
313
  if (this.props.onMarkerDeselect) {
332
314
  this.props.onMarkerDeselect(event);
@@ -344,82 +326,89 @@ class MapView extends React.Component {
344
326
  this.props.onRegionChangeComplete(event.nativeEvent.region, details);
345
327
  }
346
328
  };
329
+ handleRegionChangeStarted = (event) => {
330
+ if (this.props.onRegionChangeStart) {
331
+ this.props.onRegionChangeStart(event);
332
+ }
333
+ };
334
+ handleIndoorBuildingFocused = (event) => {
335
+ if (this.props.onIndoorBuildingFocused) {
336
+ if (typeof event.nativeEvent.levels === 'string') {
337
+ event.nativeEvent.levels = JSON.parse(event.nativeEvent.levels);
338
+ }
339
+ this.props.onIndoorBuildingFocused(event);
340
+ }
341
+ };
342
+ handleIndoorLevelActivated = (event) => {
343
+ if (this.props.onIndoorLevelActivated) {
344
+ this.props.onIndoorLevelActivated(event);
345
+ }
346
+ };
347
+ handleRegionChangeComplete = (event) => {
348
+ const isGesture = event.nativeEvent.isGesture;
349
+ const details = { isGesture };
350
+ if (this.props.onRegionChangeComplete) {
351
+ this.props.onRegionChangeComplete(event.nativeEvent.region, details);
352
+ }
353
+ };
347
354
  render() {
348
- if (react_native_1.Platform.OS === 'ios') {
349
- // Define props specifically for MapFabricNativeProps
350
- /* eslint-disable @typescript-eslint/no-unused-vars */
351
- const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, ...restProps } = this.props;
352
- /* eslint-enable @typescript-eslint/no-unused-vars */
353
- const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
354
- const props = {
355
- onMapReady: this._onMapReady,
356
- liteMode: this.props.liteMode,
357
- googleMapId: this.props.googleMapId,
358
- googleRenderer: this.props.googleRenderer,
359
- onPress: this.handleMapPress,
360
- onMarkerPress: this.handleMarkerPress,
361
- onMarkerSelect: this.handleMarkerSelect,
362
- onMarkerDeselect: this.handleMarkerDeselect,
363
- userInterfaceStyle: userInterfaceStyle,
364
- minZoom: minZoomLevel,
365
- maxZoom: maxZoomLevel,
366
- onRegionChange: this.handleRegionChange,
367
- ...restProps,
355
+ // Define props specifically for MapFabricNativeProps
356
+ /* eslint-disable @typescript-eslint/no-unused-vars */
357
+ const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
358
+ /* eslint-enable @typescript-eslint/no-unused-vars */
359
+ const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
360
+ const props = {
361
+ onMapReady: this._onMapReady,
362
+ liteMode: this.props.liteMode,
363
+ googleMapId: this.props.googleMapId,
364
+ googleRenderer: this.props.googleRenderer,
365
+ onPress: this.handleMapPress,
366
+ onMarkerPress: this.handleMarkerPress,
367
+ onMarkerSelect: this.handleMarkerSelect,
368
+ onMarkerDeselect: this.handleMarkerDeselect,
369
+ onKmlReady: this.handleKmlReady,
370
+ userInterfaceStyle: userInterfaceStyle,
371
+ minZoom: minZoomLevel,
372
+ maxZoom: maxZoomLevel,
373
+ onRegionChange: this.handleRegionChange,
374
+ onRegionChangeStart: this.handleRegionChangeStarted,
375
+ onRegionChangeComplete: this.handleRegionChangeComplete,
376
+ onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
377
+ // @ts-ignore
378
+ onIndoorLevelActivated: this.handleIndoorLevelActivated,
379
+ ...restProps,
380
+ };
381
+ if (this.props.region) {
382
+ props.region = {
383
+ latitude: this.props.region.latitude,
384
+ longitude: this.props.region.longitude,
385
+ latitudeDelta: this.props.region.latitudeDelta,
386
+ longitudeDelta: this.props.region.longitudeDelta,
368
387
  };
369
- if (this.props.region) {
370
- props.region = {
371
- latitude: this.props.region.latitude,
372
- longitude: this.props.region.longitude,
373
- latitudeDelta: this.props.region.latitudeDelta,
374
- longitudeDelta: this.props.region.longitudeDelta,
375
- };
376
- }
377
- if (!this.state.isReady) {
378
- props.style = this.props.style;
379
- props.initialCamera = this.props.initialCamera;
380
- props.onLayout = this.props.onLayout;
381
- }
382
- if (provider === 'google') {
383
- return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
384
- <FabricGoogleMap {...props} ref={this.fabricMap}/>
385
- </decorateMapComponent_1.ProviderContext.Provider>);
386
- }
387
- else {
388
- return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
389
- <FabricMap {...props} ref={this.fabricMap}/>
390
- </decorateMapComponent_1.ProviderContext.Provider>);
388
+ }
389
+ if (this.state.isReady) {
390
+ if (props.onPanDrag) {
391
+ props.handlePanDrag = !!props.onPanDrag;
391
392
  }
392
393
  }
393
394
  else {
394
- const AIRMap = getNativeMapComponent(this.props.provider);
395
- // Define props specifically for NativeProps
396
- const props = {
397
- region: null,
398
- initialRegion: null,
399
- onChange: this._onChange,
400
- onMapReady: this._onMapReady,
401
- liteMode: this.props.liteMode,
402
- googleMapId: this.props.googleMapId,
403
- googleRenderer: this.props.googleRenderer,
404
- ref: this.map,
405
- customMapStyleString: this.props.customMapStyle
406
- ? JSON.stringify(this.props.customMapStyle)
407
- : undefined,
408
- ...this.props,
409
- };
410
- if (this.state.isReady) {
411
- if (props.onPanDrag) {
412
- props.handlePanDrag = !!props.onPanDrag;
413
- }
414
- }
415
- else {
416
- props.style = this.props.style;
417
- props.initialCamera = this.props.initialCamera;
418
- props.onLayout = this.props.onLayout;
419
- }
420
- // Render AIRMap with NativeProps
395
+ props.style = this.props.style;
396
+ props.initialCamera = this.props.initialCamera;
397
+ props.onLayout = this.props.onLayout;
398
+ }
399
+ const childrenNodes = this.state.isReady ? children : null;
400
+ if (provider === 'google' && react_native_1.Platform.OS === 'ios') {
401
+ return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
402
+ <FabricGoogleMap {...props} ref={this.fabricMap}>
403
+ {childrenNodes}
404
+ </FabricGoogleMap>
405
+ </decorateMapComponent_1.ProviderContext.Provider>);
406
+ }
407
+ else {
421
408
  return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
422
- <AIRMap {...props}/>
409
+ <FabricMap {...props} ref={this.fabricMap}>
410
+ {childrenNodes}
411
+ </FabricMap>
423
412
  </decorateMapComponent_1.ProviderContext.Provider>);
424
413
  }
425
414
  }
@@ -432,11 +421,8 @@ if (react_native_1.Platform.OS === 'android') {
432
421
  airMaps.google = airMaps.default;
433
422
  }
434
423
  else {
435
- airMaps.google = decorateMapComponent_1.googleMapIsInstalled
436
- ? (0, react_native_1.requireNativeComponent)('AIRGoogleMap')
437
- : (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
424
+ airMaps.google = (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
438
425
  }
439
- const getNativeMapComponent = (provider) => airMaps[provider || 'default'];
440
426
  exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
441
427
  MapView.Animated = exports.AnimatedMapView;
442
428
  exports.default = MapView;
@@ -46,7 +46,7 @@ export type ActiveIndoorLevel = {
46
46
  shortName: string;
47
47
  };
48
48
  export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
49
- IndoorLevel: ActiveIndoorLevel;
49
+ indoorLevel: ActiveIndoorLevel;
50
50
  }>;
51
51
  export type IndoorBuilding = {
52
52
  underground: boolean;
@@ -18,6 +18,7 @@ export interface FabricMapHandle {
18
18
  getAddressFromCoordinates: (coordinate: LatLng) => Promise<Address>;
19
19
  getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
20
20
  getCoordinateForPoint: (point: Point) => Promise<LatLng>;
21
+ setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
21
22
  }
22
23
  declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
23
24
  export default createFabricMap;
@@ -54,7 +54,7 @@ const createFabricMap = (ViewComponent, Commands) => {
54
54
  return NativeAirMapsModule_1.default.getPointForCoordinate((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, coordinate);
55
55
  }
56
56
  else {
57
- throw new Error('getPointForCoordinate is only supported on iOS with Fabric.');
57
+ throw new Error('getPointForCoordinate is not supported on this platform.');
58
58
  }
59
59
  },
60
60
  async getAddressFromCoordinates(coordinate) {
@@ -62,12 +62,12 @@ const createFabricMap = (ViewComponent, Commands) => {
62
62
  return NativeAirMapsModule_1.default.getAddressFromCoordinates((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, coordinate);
63
63
  }
64
64
  else {
65
- throw new Error('getAddressFromCoordinates is only supported on iOS with Fabric.');
65
+ throw new Error('getAddressFromCoordinates is not supported on this platform');
66
66
  }
67
67
  },
68
68
  async takeSnapshot(config) {
69
69
  if (fabricRef.current) {
70
- return NativeAirMapsModule_1.default.takeSnapshot((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, config);
70
+ return NativeAirMapsModule_1.default.takeSnapshot((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, JSON.stringify(config));
71
71
  }
72
72
  else {
73
73
  throw new Error('takeSnapshot is only supported on iOS with Fabric.');
@@ -154,6 +154,19 @@ const createFabricMap = (ViewComponent, Commands) => {
154
154
  throw new Error('fitToCoordinates is only supported on iOS with Fabric.');
155
155
  }
156
156
  },
157
+ setIndoorActiveLevelIndex(activeLevelIndex) {
158
+ if (fabricRef.current) {
159
+ try {
160
+ Commands.setIndoorActiveLevelIndex(fabricRef.current, activeLevelIndex);
161
+ }
162
+ catch (error) {
163
+ console.error('Failed to set camera:', error);
164
+ }
165
+ }
166
+ else {
167
+ console.warn('setIndoorActiveLevelIndex is not supported.');
168
+ }
169
+ },
157
170
  setCamera(camera) {
158
171
  if (fabricRef.current) {
159
172
  try {
@@ -164,7 +177,7 @@ const createFabricMap = (ViewComponent, Commands) => {
164
177
  }
165
178
  }
166
179
  else {
167
- console.warn('setCamera is only supported on iOS with Fabric.');
180
+ console.warn('setCamera is not supported');
168
181
  }
169
182
  },
170
183
  }));
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.googleMapIsInstalled = exports.createNotSupportedComponent = exports.getNativeMapName = exports.ProviderContext = exports.NOT_SUPPORTED = exports.USES_DEFAULT_IMPLEMENTATION = exports.SUPPORTED = void 0;
4
7
  const react_1 = require("react");
5
8
  const react_native_1 = require("react-native");
6
9
  const ProviderConstants_1 = require("./ProviderConstants");
10
+ const NativeComponentGooglePolygon_1 = __importDefault(require("./specs/NativeComponentGooglePolygon"));
11
+ const NativeComponentMarker_1 = __importDefault(require("./specs/NativeComponentMarker"));
12
+ const NativeComponentCallout_1 = __importDefault(require("./specs/NativeComponentCallout"));
13
+ const NativeComponentPolyline_1 = __importDefault(require("./specs/NativeComponentPolyline"));
14
+ const NativeComponentCircle_1 = __importDefault(require("./specs/NativeComponentCircle"));
15
+ const NativeComponentOverlay_1 = __importDefault(require("./specs/NativeComponentOverlay"));
7
16
  exports.SUPPORTED = 'SUPPORTED';
8
17
  exports.USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
9
18
  exports.NOT_SUPPORTED = 'NOT_SUPPORTED';
@@ -34,6 +43,37 @@ function decorateMapComponent(Component, componentName, providers) {
34
43
  Component.prototype.getNativeComponent =
35
44
  function getNativeComponent() {
36
45
  const provider = this.context;
46
+ if (componentName === 'Marker' &&
47
+ (react_native_1.Platform.OS !== 'ios' || provider !== ProviderConstants_1.PROVIDER_GOOGLE)) {
48
+ // @ts-ignore
49
+ return NativeComponentMarker_1.default;
50
+ }
51
+ if (componentName === 'Polygon' &&
52
+ ((provider === ProviderConstants_1.PROVIDER_GOOGLE &&
53
+ react_native_1.Platform.OS === 'ios' &&
54
+ exports.googleMapIsInstalled) ||
55
+ react_native_1.Platform.OS === 'android')) {
56
+ // @ts-ignore
57
+ return NativeComponentGooglePolygon_1.default;
58
+ }
59
+ if (react_native_1.Platform.OS === 'android') {
60
+ if (componentName === 'Callout') {
61
+ // @ts-ignore
62
+ return NativeComponentCallout_1.default;
63
+ }
64
+ else if (componentName === 'Polyline') {
65
+ // @ts-ignore
66
+ return NativeComponentPolyline_1.default;
67
+ }
68
+ else if (componentName === 'Circle') {
69
+ // @ts-ignore
70
+ return NativeComponentCircle_1.default;
71
+ }
72
+ else if (componentName === 'Overlay') {
73
+ // @ts-ignore
74
+ return NativeComponentOverlay_1.default;
75
+ }
76
+ }
37
77
  const key = provider || 'default';
38
78
  if (components[key]) {
39
79
  return components[key];
@@ -0,0 +1,4 @@
1
+ import { ImageSourcePropType } from 'react-native';
2
+ export declare function fixImageProp(image: ImageSourcePropType): {
3
+ uri: string;
4
+ } | ImageSourcePropType;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixImageProp = void 0;
4
+ const react_native_1 = require("react-native");
5
+ function fixImageProp(image) {
6
+ if (typeof image === 'string') {
7
+ return { uri: image };
8
+ }
9
+ if (typeof image === 'number') {
10
+ // Handle local image asset (require('./image.png'))
11
+ const resolvedImage = react_native_1.Image.resolveAssetSource(image);
12
+ return resolvedImage?.uri ? { uri: resolvedImage.uri } : image;
13
+ }
14
+ return image;
15
+ }
16
+ exports.fixImageProp = fixImageProp;
@@ -1,5 +1,5 @@
1
1
  import type { TurboModule } from 'react-native';
2
- import type { Double, UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
2
+ import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  import type { Camera } from './NativeComponentMapView';
4
4
  import { Address } from 'react-native-maps';
5
5
  type LatLng = {
@@ -22,7 +22,7 @@ export interface Spec extends TurboModule {
22
22
  getCamera(tag: Double): Promise<Camera>;
23
23
  getMarkersFrames(tag: Double, onlyVisible: boolean): Promise<unknown>;
24
24
  getMapBoundaries(tag: Double): Promise<MapBoundaries>;
25
- takeSnapshot(tag: Double, config: UnsafeObject): Promise<string>;
25
+ takeSnapshot(tag: Double, config: string): Promise<string>;
26
26
  getAddressFromCoordinates(tag: Double, coordinate: LatLng): Promise<Address>;
27
27
  getPointForCoordinate(tag: Double, coordinate: LatLng): Promise<Point>;
28
28
  getCoordinateForPoint(tag: Double, point: Point): Promise<LatLng>;
@@ -0,0 +1,46 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import { Double, BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ export type LatLng = Readonly<{
4
+ latitude: Double;
5
+ longitude: Double;
6
+ }>;
7
+ export type CalloutPressEvent = BubblingEventHandler<Readonly<{
8
+ action?: string;
9
+ id: string;
10
+ coordinate: {
11
+ latitude: Double;
12
+ longitude: Double;
13
+ };
14
+ position?: {
15
+ x: Double;
16
+ y: Double;
17
+ };
18
+ }>>;
19
+ export interface CalloutFabricNativeProps extends ViewProps {
20
+ /**
21
+ * If `true`, clicks on transparent areas in callout will be passed to map.
22
+ *
23
+ * @default false
24
+ * @platform iOS: Supported
25
+ * @platform Android: Not supported
26
+ */
27
+ alphaHitTest?: boolean;
28
+ /**
29
+ * Callback that is called when the user presses on the callout
30
+ *
31
+ * @platform iOS: Apple Maps only
32
+ * @platform Android: Supported
33
+ */
34
+ onPress?: CalloutPressEvent;
35
+ /**
36
+ * If `false`, a default "tooltip" bubble window will be drawn around this callouts children.
37
+ * If `true`, the child views can fully customize their appearance, including any "bubble" like styles.
38
+ *
39
+ * @default false
40
+ * @platform iOS: Supported
41
+ * @platform Android: Supported
42
+ */
43
+ tooltip?: boolean;
44
+ }
45
+ declare const _default: HostComponent<CalloutFabricNativeProps>;
46
+ export default _default;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
7
+ exports.default = (0, codegenNativeComponent_1.default)('RNMapsCallout', {
8
+ excludedPlatforms: ['iOS'],
9
+ });
@@ -0,0 +1,74 @@
1
+ import type { HostComponent, ViewProps, ColorValue } from 'react-native';
2
+ import { Double, Float, BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ export type LatLng = Readonly<{
4
+ latitude: Double;
5
+ longitude: Double;
6
+ }>;
7
+ export type CirclePressEventHandler = BubblingEventHandler<Readonly<{
8
+ action?: string;
9
+ id: string;
10
+ coordinate: {
11
+ latitude: Double;
12
+ longitude: Double;
13
+ };
14
+ position?: {
15
+ x: Double;
16
+ y: Double;
17
+ };
18
+ }>>;
19
+ export interface CircleFabricNativeProps extends ViewProps {
20
+ /**
21
+ * The coordinates of the center of the circle.
22
+ *
23
+ * @platform iOS: Supported
24
+ * @platform Android: Supported
25
+ */
26
+ center: LatLng;
27
+ /**
28
+ * The stroke color to use for the path.
29
+ *
30
+ * @default `#000`, `rgba(r,g,b,0.5)`
31
+ * @platform iOS: Supported
32
+ * @platform Android: Supported
33
+ */
34
+ fillColor?: ColorValue;
35
+ /**
36
+ * The radius of the circle to be drawn (in meters)
37
+ *
38
+ * @platform iOS: Supported
39
+ * @platform Android: Supported
40
+ */
41
+ radius: Double;
42
+ /**
43
+ * The stroke color to use for the path.
44
+ *
45
+ * @default `#000`, `rgba(r,g,b,0.5)`
46
+ * @platform iOS: Supported
47
+ * @platform Android: Supported
48
+ */
49
+ strokeColor?: ColorValue;
50
+ /**
51
+ * Callback that is called when user taps on the map.
52
+ *
53
+ * @platform iOS: Supported
54
+ * @platform Android: Supported
55
+ */
56
+ onPress?: CirclePressEventHandler;
57
+ /**
58
+ * The stroke width to use for the path.
59
+ *
60
+ * @default 1
61
+ * @platform iOS: Supported
62
+ * @platform Android: Supported
63
+ */
64
+ strokeWidth?: Float;
65
+ /**
66
+ * Boolean to allow a polygon to be tappable and use the onPress function.
67
+ *
68
+ * @platform iOS: Google Maps only
69
+ * @platform Android: Supported
70
+ */
71
+ tappable?: boolean;
72
+ }
73
+ declare const _default: HostComponent<CircleFabricNativeProps>;
74
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
7
+ exports.default = (0, codegenNativeComponent_1.default)('RNMapsCircle', {});