react-native-maps 1.21.0-alpha.1 → 1.21.0-alpha.100

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 (144) hide show
  1. package/android/build.gradle +86 -51
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/gradlew +1 -2
  4. package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
  5. package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
  6. package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
  7. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
  8. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
  9. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +284 -0
  10. package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
  11. package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
  12. package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
  13. package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
  14. package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
  15. package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
  16. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
  17. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
  18. package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
  19. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
  20. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
  21. package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
  22. package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
  23. package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
  24. package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
  25. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
  26. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
  27. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
  28. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
  29. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
  30. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
  31. package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
  32. package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
  33. package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
  34. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
  35. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
  36. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
  37. package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
  38. package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
  39. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +82 -0
  40. package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
  41. package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
  42. package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
  43. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +79 -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 +1654 -1337
  50. package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
  51. package/ios/AirGoogleMaps/AIRGoogleMap.m +245 -57
  52. package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
  53. package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
  54. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
  55. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
  56. package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
  57. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +30 -119
  58. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
  59. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
  60. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
  61. package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
  62. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +5 -4
  63. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +32 -2
  64. package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
  65. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -3
  66. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -10
  67. package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
  68. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
  69. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
  70. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
  71. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +18 -0
  72. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
  73. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +670 -0
  74. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
  75. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
  76. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
  77. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
  78. package/ios/AirMaps/AIRMap.h +8 -5
  79. package/ios/AirMaps/AIRMap.m +291 -147
  80. package/ios/AirMaps/AIRMapManager.m +12 -21
  81. package/ios/AirMaps/AIRMapMarker.h +1 -0
  82. package/ios/AirMaps/AIRMapMarker.m +165 -103
  83. package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
  84. package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
  85. package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
  86. package/ios/AirMaps/RNMapsAirModule.h +4 -1
  87. package/ios/AirMaps/RNMapsAirModule.mm +42 -172
  88. package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
  89. package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
  90. package/ios/AirMaps/RNMapsMapView.h +6 -3
  91. package/ios/AirMaps/RNMapsMapView.mm +348 -329
  92. package/ios/AirMaps/RNMapsMarkerView.h +24 -0
  93. package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
  94. package/ios/AirMaps/RNMapsMarkerViewManager.mm +21 -0
  95. package/ios/AirMaps/UIView +AirMap.m +20 -0
  96. package/ios/AirMaps/UIView+AirMap.h +11 -0
  97. package/ios/AirMaps.xcodeproj/project.pbxproj +60 -0
  98. package/lib/MapCircle.d.ts +1 -1
  99. package/lib/MapHeatmap.d.ts +2 -2
  100. package/lib/MapHeatmap.js +1 -1
  101. package/lib/MapMarker.d.ts +16 -3
  102. package/lib/MapMarker.js +55 -13
  103. package/lib/MapMarkerNativeComponent.js +0 -2
  104. package/lib/MapOverlay.d.ts +2 -1
  105. package/lib/MapOverlay.js +11 -9
  106. package/lib/MapPolygon.d.ts +1 -1
  107. package/lib/MapPolyline.d.ts +7 -7
  108. package/lib/MapView.d.ts +17 -29
  109. package/lib/MapView.js +111 -124
  110. package/lib/MapView.types.d.ts +1 -1
  111. package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +8 -6
  112. package/lib/createFabricMap.js +188 -0
  113. package/lib/decorateMapComponent.js +40 -0
  114. package/lib/fixImageProp.d.ts +4 -0
  115. package/lib/fixImageProp.js +16 -0
  116. package/lib/specs/NativeAirMapsModule.d.ts +2 -2
  117. package/lib/specs/NativeComponentCallout.d.ts +46 -0
  118. package/lib/specs/NativeComponentCallout.js +9 -0
  119. package/lib/specs/NativeComponentCircle.d.ts +74 -0
  120. package/lib/specs/NativeComponentCircle.js +7 -0
  121. package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
  122. package/lib/specs/NativeComponentGoogleMapView.js +22 -0
  123. package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
  124. package/lib/specs/NativeComponentGooglePolygon.js +7 -0
  125. package/lib/specs/NativeComponentMapView.d.ts +32 -47
  126. package/lib/specs/NativeComponentMapView.js +2 -3
  127. package/lib/specs/NativeComponentMarker.d.ts +258 -0
  128. package/lib/specs/NativeComponentMarker.js +19 -0
  129. package/lib/specs/NativeComponentOverlay.d.ts +67 -0
  130. package/lib/specs/NativeComponentOverlay.js +7 -0
  131. package/lib/specs/NativeComponentPolyline.d.ts +101 -0
  132. package/lib/specs/NativeComponentPolyline.js +7 -0
  133. package/package.json +27 -22
  134. package/react-native-maps.podspec +61 -16
  135. package/specs/NativeAirMapsModule.ts +36 -0
  136. package/specs/NativeComponentCallout.ts +63 -0
  137. package/specs/NativeComponentCircle.ts +94 -0
  138. package/specs/NativeComponentGoogleMapView.ts +916 -0
  139. package/specs/NativeComponentGooglePolygon.ts +94 -0
  140. package/specs/NativeComponentMapView.ts +1071 -0
  141. package/specs/NativeComponentMarker.ts +326 -0
  142. package/specs/NativeComponentOverlay.ts +89 -0
  143. package/specs/NativeComponentPolyline.ts +124 -0
  144. package/lib/FabricMapView.js +0 -175
package/lib/MapView.js CHANGED
@@ -30,9 +30,15 @@ exports.AnimatedMapView = exports.MAP_TYPES = void 0;
30
30
  const React = __importStar(require("react"));
31
31
  const react_native_1 = require("react-native");
32
32
  const decorateMapComponent_1 = require("./decorateMapComponent");
33
- const ProviderConstants = __importStar(require("./ProviderConstants"));
34
33
  const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
35
- const FabricMapView_1 = __importDefault(require("./FabricMapView"));
34
+ const NativeComponentMapView_1 = __importStar(require("./specs/NativeComponentMapView"));
35
+ const NativeComponentGoogleMapView_1 = __importStar(require("./specs/NativeComponentGoogleMapView"));
36
+ const createFabricMap_1 = __importDefault(require("./createFabricMap"));
37
+ const FabricMap = (0, createFabricMap_1.default)(NativeComponentMapView_1.default, NativeComponentMapView_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
+ }
36
42
  exports.MAP_TYPES = {
37
43
  STANDARD: 'standard',
38
44
  SATELLITE: 'satellite',
@@ -43,7 +49,6 @@ exports.MAP_TYPES = {
43
49
  SATELLITE_FLYOVER: 'satelliteFlyover',
44
50
  HYBRID_FLYOVER: 'hybridFlyover',
45
51
  };
46
- const GOOGLE_MAPS_ONLY_TYPES = [exports.MAP_TYPES.TERRAIN, exports.MAP_TYPES.NONE];
47
52
  class MapView extends React.Component {
48
53
  static Animated;
49
54
  map;
@@ -53,7 +58,7 @@ class MapView extends React.Component {
53
58
  this.map = React.createRef();
54
59
  this.fabricMap = React.createRef();
55
60
  this.state = {
56
- isReady: react_native_1.Platform.OS === 'ios',
61
+ isReady: false,
57
62
  };
58
63
  this._onMapReady = this._onMapReady.bind(this);
59
64
  this._onChange = this._onChange.bind(this);
@@ -83,13 +88,8 @@ class MapView extends React.Component {
83
88
  }
84
89
  }
85
90
  getCamera() {
86
- if (react_native_1.Platform.OS === 'android') {
87
- return react_native_1.NativeModules.AirMapModule.getCamera(this._getHandle());
88
- }
89
- else if (react_native_1.Platform.OS === 'ios') {
90
- if (this.fabricMap.current) {
91
- return this.fabricMap.current.getCamera();
92
- }
91
+ if (this.fabricMap.current) {
92
+ return this.fabricMap.current.getCamera();
93
93
  }
94
94
  return Promise.reject('getCamera not supported on this platform');
95
95
  }
@@ -117,6 +117,12 @@ class MapView extends React.Component {
117
117
  MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
118
118
  }
119
119
  }
120
+ setRegion(region) {
121
+ if (this.fabricMap.current) {
122
+ this.fabricMap.current.animateToRegion(region, 0);
123
+ }
124
+ //TODO fix for android
125
+ }
120
126
  fitToElements(options = {}) {
121
127
  const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
122
128
  if (this.fabricMap.current) {
@@ -150,13 +156,8 @@ class MapView extends React.Component {
150
156
  * @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
151
157
  */
152
158
  async getMapBoundaries() {
153
- if (react_native_1.Platform.OS === 'android') {
154
- return await react_native_1.NativeModules.AirMapModule.getMapBoundaries(this._getHandle());
155
- }
156
- else if (react_native_1.Platform.OS === 'ios') {
157
- if (this.fabricMap.current) {
158
- return this.fabricMap.current.getMapBoundaries();
159
- }
159
+ if (this.fabricMap.current) {
160
+ return this.fabricMap.current.getMapBoundaries();
160
161
  }
161
162
  return Promise.reject('getMapBoundaries not supported on this platform');
162
163
  }
@@ -166,9 +167,10 @@ class MapView extends React.Component {
166
167
  }
167
168
  }
168
169
  setIndoorActiveLevelIndex(activeLevelIndex) {
169
- if (this.map.current) {
170
- MapViewNativeComponent_1.Commands.setIndoorActiveLevelIndex(this.map.current, activeLevelIndex);
170
+ if (this.fabricMap.current) {
171
+ return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
171
172
  }
173
+ return Promise.reject('getMapBoundaries not supported on this platform');
172
174
  }
173
175
  /**
174
176
  * Takes a snapshot of the map and saves it to a picture
@@ -200,15 +202,9 @@ class MapView extends React.Component {
200
202
  if (config.result !== 'file' && config.result !== 'base64') {
201
203
  throw new Error('Invalid result specified');
202
204
  }
203
- // Call native function
204
- if (react_native_1.Platform.OS === 'android') {
205
- return react_native_1.NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
206
- }
207
- else if (react_native_1.Platform.OS === 'ios') {
208
- if (this.fabricMap.current) {
209
- // @ts-ignore
210
- return this.fabricMap.current.takeSnapshot(config);
211
- }
205
+ if (this.fabricMap.current) {
206
+ // @ts-ignore
207
+ return this.fabricMap.current.takeSnapshot(config);
212
208
  }
213
209
  return Promise.reject('takeSnapshot not supported on this platform');
214
210
  }
@@ -222,13 +218,8 @@ class MapView extends React.Component {
222
218
  * @return Promise with return type Address
223
219
  */
224
220
  addressForCoordinate(coordinate) {
225
- if (react_native_1.Platform.OS === 'android') {
226
- return react_native_1.NativeModules.AirMapModule.getAddressFromCoordinates(this._getHandle(), coordinate);
227
- }
228
- else if (react_native_1.Platform.OS === 'ios') {
229
- if (this.fabricMap.current) {
230
- return this.fabricMap.current.getAddressFromCoordinates(coordinate);
231
- }
221
+ if (this.fabricMap.current) {
222
+ return this.fabricMap.current.getAddressFromCoordinates(coordinate);
232
223
  }
233
224
  return Promise.reject('getAddress not supported on this platform');
234
225
  }
@@ -242,13 +233,8 @@ class MapView extends React.Component {
242
233
  * @return Promise Promise with the point ({ x: Number, y: Number })
243
234
  */
244
235
  pointForCoordinate(coordinate) {
245
- if (react_native_1.Platform.OS === 'android') {
246
- return react_native_1.NativeModules.AirMapModule.pointForCoordinate(this._getHandle(), coordinate);
247
- }
248
- else if (react_native_1.Platform.OS === 'ios') {
249
- if (this.fabricMap.current) {
250
- return this.fabricMap.current.getPointForCoordinate(coordinate);
251
- }
236
+ if (this.fabricMap.current) {
237
+ return this.fabricMap.current.getPointForCoordinate(coordinate);
252
238
  }
253
239
  return Promise.reject('pointForCoordinate not supported on this platform');
254
240
  }
@@ -262,13 +248,8 @@ class MapView extends React.Component {
262
248
  * @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
263
249
  */
264
250
  coordinateForPoint(point) {
265
- if (react_native_1.Platform.OS === 'android') {
266
- return react_native_1.NativeModules.AirMapModule.coordinateForPoint(this._getHandle(), point);
267
- }
268
- else if (react_native_1.Platform.OS === 'ios') {
269
- if (this.fabricMap.current) {
270
- return this.fabricMap.current.getCoordinateForPoint(point);
271
- }
251
+ if (this.fabricMap.current) {
252
+ return this.fabricMap.current.getCoordinateForPoint(point);
272
253
  }
273
254
  return Promise.reject('coordinateForPoint not supported on this platform');
274
255
  }
@@ -280,11 +261,9 @@ class MapView extends React.Component {
280
261
  * @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
281
262
  */
282
263
  getMarkersFrames(onlyVisible = false) {
283
- if (react_native_1.Platform.OS === 'ios') {
284
- if (this.fabricMap.current) {
285
- // @ts-ignore
286
- return this.fabricMap.current.getMarkersFrames(onlyVisible);
287
- }
264
+ if (this.fabricMap.current) {
265
+ // @ts-ignore
266
+ return this.fabricMap.current.getMarkersFrames(onlyVisible);
288
267
  }
289
268
  return Promise.reject('getMarkersFrames not supported on this platform');
290
269
  }
@@ -325,6 +304,11 @@ class MapView extends React.Component {
325
304
  this.props.onMarkerSelect(event);
326
305
  }
327
306
  };
307
+ handleKmlReady = (event) => {
308
+ if (this.props.onKmlReady) {
309
+ this.props.onKmlReady(event);
310
+ }
311
+ };
328
312
  handleMarkerDeselect = (event) => {
329
313
  if (this.props.onMarkerDeselect) {
330
314
  this.props.onMarkerDeselect(event);
@@ -342,82 +326,86 @@ class MapView extends React.Component {
342
326
  this.props.onRegionChangeComplete(event.nativeEvent.region, details);
343
327
  }
344
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
+ this.props.onIndoorBuildingFocused(event);
337
+ }
338
+ };
339
+ handleIndoorLevelActivated = (event) => {
340
+ if (this.props.onIndoorLevelActivated) {
341
+ this.props.onIndoorLevelActivated(event);
342
+ }
343
+ };
344
+ handleRegionChangeComplete = (event) => {
345
+ const isGesture = event.nativeEvent.isGesture;
346
+ const details = { isGesture };
347
+ if (this.props.onRegionChangeComplete) {
348
+ this.props.onRegionChangeComplete(event.nativeEvent.region, details);
349
+ }
350
+ };
345
351
  render() {
346
- if (react_native_1.Platform.OS === 'ios' &&
347
- this.props.provider === ProviderConstants.PROVIDER_DEFAULT) {
348
- const AIRMap = FabricMapView_1.default;
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, region, ...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
- onRegionChange: this.handleRegionChange,
365
- ...restProps,
352
+ // Define props specifically for MapFabricNativeProps
353
+ /* eslint-disable @typescript-eslint/no-unused-vars */
354
+ const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
355
+ /* eslint-enable @typescript-eslint/no-unused-vars */
356
+ const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
357
+ const props = {
358
+ onMapReady: this._onMapReady,
359
+ liteMode: this.props.liteMode,
360
+ googleMapId: this.props.googleMapId,
361
+ googleRenderer: this.props.googleRenderer,
362
+ onPress: this.handleMapPress,
363
+ onMarkerPress: this.handleMarkerPress,
364
+ onMarkerSelect: this.handleMarkerSelect,
365
+ onMarkerDeselect: this.handleMarkerDeselect,
366
+ onKmlReady: this.handleKmlReady,
367
+ userInterfaceStyle: userInterfaceStyle,
368
+ minZoom: minZoomLevel,
369
+ maxZoom: maxZoomLevel,
370
+ onRegionChange: this.handleRegionChange,
371
+ onRegionChangeStart: this.handleRegionChangeStarted,
372
+ onRegionChangeComplete: this.handleRegionChangeComplete,
373
+ onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
374
+ // @ts-ignore
375
+ onIndoorLevelActivated: this.handleIndoorLevelActivated,
376
+ ...restProps,
377
+ };
378
+ if (this.props.region) {
379
+ props.region = {
380
+ latitude: this.props.region.latitude,
381
+ longitude: this.props.region.longitude,
382
+ latitudeDelta: this.props.region.latitudeDelta,
383
+ longitudeDelta: this.props.region.longitudeDelta,
366
384
  };
367
- if (this.props.region) {
368
- props.region = {
369
- latitude: this.props.region.latitude,
370
- longitude: this.props.region.longitude,
371
- latitudeDelta: this.props.region.latitudeDelta,
372
- longitudeDelta: this.props.region.longitudeDelta,
373
- };
374
- }
375
- if (this.state.isReady) {
376
- if (props.mapType && GOOGLE_MAPS_ONLY_TYPES.includes(props.mapType)) {
377
- props.mapType = exports.MAP_TYPES.STANDARD;
378
- console.log('ready');
379
- }
380
- }
381
- else {
382
- props.style = this.props.style;
383
- props.initialCamera = this.props.initialCamera;
384
- props.onLayout = this.props.onLayout;
385
+ }
386
+ if (this.state.isReady) {
387
+ if (props.onPanDrag) {
388
+ props.handlePanDrag = !!props.onPanDrag;
385
389
  }
386
- // Render AIRMap with MapFabricNativeProps
390
+ }
391
+ else {
392
+ props.style = this.props.style;
393
+ props.initialCamera = this.props.initialCamera;
394
+ props.onLayout = this.props.onLayout;
395
+ }
396
+ const childrenNodes = this.state.isReady ? children : null;
397
+ if (provider === 'google' && react_native_1.Platform.OS === 'ios') {
387
398
  return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
388
- <AIRMap {...props} ref={this.fabricMap}/>
399
+ <FabricGoogleMap {...props} ref={this.fabricMap}>
400
+ {childrenNodes}
401
+ </FabricGoogleMap>
389
402
  </decorateMapComponent_1.ProviderContext.Provider>);
390
403
  }
391
404
  else {
392
- const AIRMap = getNativeMapComponent(this.props.provider);
393
- // Define props specifically for NativeProps
394
- const props = {
395
- region: null,
396
- initialRegion: null,
397
- onChange: this._onChange,
398
- onMapReady: this._onMapReady,
399
- liteMode: this.props.liteMode,
400
- googleMapId: this.props.googleMapId,
401
- googleRenderer: this.props.googleRenderer,
402
- ref: this.map,
403
- customMapStyleString: this.props.customMapStyle
404
- ? JSON.stringify(this.props.customMapStyle)
405
- : undefined,
406
- ...this.props,
407
- };
408
- if (this.state.isReady) {
409
- if (props.onPanDrag) {
410
- props.handlePanDrag = !!props.onPanDrag;
411
- }
412
- }
413
- else {
414
- props.style = this.props.style;
415
- props.initialCamera = this.props.initialCamera;
416
- props.onLayout = this.props.onLayout;
417
- }
418
- // Render AIRMap with NativeProps
419
405
  return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
420
- <AIRMap {...props}/>
406
+ <FabricMap {...props} ref={this.fabricMap}>
407
+ {childrenNodes}
408
+ </FabricMap>
421
409
  </decorateMapComponent_1.ProviderContext.Provider>);
422
410
  }
423
411
  }
@@ -434,7 +422,6 @@ else {
434
422
  ? (0, react_native_1.requireNativeComponent)('AIRGoogleMap')
435
423
  : (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
436
424
  }
437
- const getNativeMapComponent = (provider) => airMaps[provider || 'default'];
438
425
  exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
439
426
  MapView.Animated = exports.AnimatedMapView;
440
427
  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;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import type { MapBoundaries } from './specs/NativeAirMapsModule';
3
- import type { MapFabricNativeProps, Camera, Point } from './specs/NativeComponentMapView';
4
- import { LatLng, Region } from './sharedTypes';
5
- import { Address, EdgePadding, SnapshotOptions } from './MapView.types';
2
+ import type { LatLng, Point, Region } from './sharedTypes';
3
+ import type { Address, Camera, EdgePadding, SnapshotOptions } from './MapView.types';
4
+ import { MapBoundaries } from './specs/NativeAirMapsModule';
5
+ import { MapFabricNativeProps } from './specs/NativeComponentMapView';
6
+ export type FabricMapViewProps = MapFabricNativeProps;
6
7
  export interface FabricMapHandle {
7
8
  getCamera: () => Promise<Camera>;
8
9
  setCamera: (camera: Partial<Camera>) => void;
@@ -17,6 +18,7 @@ export interface FabricMapHandle {
17
18
  getAddressFromCoordinates: (coordinate: LatLng) => Promise<Address>;
18
19
  getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
19
20
  getCoordinateForPoint: (point: Point) => Promise<LatLng>;
21
+ setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
20
22
  }
21
- export declare const FabricMap: React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
22
- export default FabricMap;
23
+ declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
24
+ export default createFabricMap;
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const react_1 = __importStar(require("react"));
30
+ const react_native_1 = require("react-native");
31
+ const NativeAirMapsModule_1 = __importDefault(require("./specs/NativeAirMapsModule"));
32
+ const createFabricMap = (ViewComponent, Commands) => {
33
+ return (0, react_1.forwardRef)((props, ref) => {
34
+ const fabricRef = (0, react_1.useRef)(null);
35
+ (0, react_1.useImperativeHandle)(ref, () => ({
36
+ async getMarkersFrames(onlyVisible) {
37
+ if (fabricRef.current) {
38
+ return NativeAirMapsModule_1.default.getMarkersFrames((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, onlyVisible);
39
+ }
40
+ else {
41
+ throw new Error('getMarkersFrames is only supported on iOS with Fabric.');
42
+ }
43
+ },
44
+ async getCoordinateForPoint(point) {
45
+ if (fabricRef.current) {
46
+ return NativeAirMapsModule_1.default.getCoordinateForPoint((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, point);
47
+ }
48
+ else {
49
+ throw new Error('getCoordinateForPoint is only supported on iOS with Fabric.');
50
+ }
51
+ },
52
+ async getPointForCoordinate(coordinate) {
53
+ if (fabricRef.current) {
54
+ return NativeAirMapsModule_1.default.getPointForCoordinate((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, coordinate);
55
+ }
56
+ else {
57
+ throw new Error('getPointForCoordinate is not supported on this platform.');
58
+ }
59
+ },
60
+ async getAddressFromCoordinates(coordinate) {
61
+ if (fabricRef.current) {
62
+ return NativeAirMapsModule_1.default.getAddressFromCoordinates((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, coordinate);
63
+ }
64
+ else {
65
+ throw new Error('getAddressFromCoordinates is not supported on this platform');
66
+ }
67
+ },
68
+ async takeSnapshot(config) {
69
+ if (fabricRef.current) {
70
+ return NativeAirMapsModule_1.default.takeSnapshot((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, JSON.stringify(config));
71
+ }
72
+ else {
73
+ throw new Error('takeSnapshot is only supported on iOS with Fabric.');
74
+ }
75
+ },
76
+ async getCamera() {
77
+ if (fabricRef.current) {
78
+ return NativeAirMapsModule_1.default.getCamera((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1);
79
+ }
80
+ else {
81
+ throw new Error('getCamera is only supported on iOS with Fabric.');
82
+ }
83
+ },
84
+ async getMapBoundaries() {
85
+ if (fabricRef.current) {
86
+ return NativeAirMapsModule_1.default.getMapBoundaries((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1);
87
+ }
88
+ else {
89
+ throw new Error('getMapBoundaries is only supported on iOS with Fabric.');
90
+ }
91
+ },
92
+ animateToRegion(region, duration) {
93
+ if (fabricRef.current) {
94
+ try {
95
+ Commands.animateToRegion(fabricRef.current, JSON.stringify(region), duration);
96
+ }
97
+ catch (error) {
98
+ throw new Error('Failed to animateToRegion');
99
+ }
100
+ }
101
+ else {
102
+ throw new Error('animateToRegion is only supported on iOS with Fabric.');
103
+ }
104
+ },
105
+ fitToElements(edgePadding, animated) {
106
+ if (fabricRef.current) {
107
+ try {
108
+ Commands.fitToElements(fabricRef.current, JSON.stringify(edgePadding), animated);
109
+ }
110
+ catch (error) {
111
+ throw new Error('Failed to fitToElements');
112
+ }
113
+ }
114
+ else {
115
+ throw new Error('fitToElements is only supported on iOS with Fabric.');
116
+ }
117
+ },
118
+ fitToSuppliedMarkers(markers, edgePadding, animated) {
119
+ if (fabricRef.current) {
120
+ try {
121
+ Commands.fitToSuppliedMarkers(fabricRef.current, JSON.stringify(markers), JSON.stringify(edgePadding), animated);
122
+ }
123
+ catch (error) {
124
+ throw new Error('Failed to fitToSuppliedMarkers');
125
+ }
126
+ }
127
+ else {
128
+ throw new Error('fitToSuppliedMarkers is only supported on iOS with Fabric.');
129
+ }
130
+ },
131
+ animateCamera(camera, duration) {
132
+ if (fabricRef.current) {
133
+ try {
134
+ Commands.animateCamera(fabricRef.current, JSON.stringify(camera), duration);
135
+ }
136
+ catch (error) {
137
+ throw new Error('Failed to animateCamera');
138
+ }
139
+ }
140
+ else {
141
+ throw new Error('animateCamera is only supported on iOS with Fabric.');
142
+ }
143
+ },
144
+ fitToCoordinates(coordinates, edgePadding, animated) {
145
+ if (fabricRef.current) {
146
+ try {
147
+ Commands.fitToCoordinates(fabricRef.current, JSON.stringify(coordinates), JSON.stringify(edgePadding), animated);
148
+ }
149
+ catch (error) {
150
+ throw new Error('Failed to fitToCoordinates');
151
+ }
152
+ }
153
+ else {
154
+ throw new Error('fitToCoordinates is only supported on iOS with Fabric.');
155
+ }
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
+ },
170
+ setCamera(camera) {
171
+ if (fabricRef.current) {
172
+ try {
173
+ Commands.setCamera(fabricRef.current, JSON.stringify(camera));
174
+ }
175
+ catch (error) {
176
+ console.error('Failed to set camera:', error);
177
+ }
178
+ }
179
+ else {
180
+ console.warn('setCamera is not supported');
181
+ }
182
+ },
183
+ }));
184
+ // @ts-ignore
185
+ return <ViewComponent {...props} ref={fabricRef}/>;
186
+ });
187
+ };
188
+ exports.default = createFabricMap;
@@ -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>;