react-native-maps 1.21.0-alpha.2 → 1.21.0-alpha.20

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 (63) hide show
  1. package/android/build.gradle +19 -4
  2. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +51 -0
  3. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +46 -0
  4. package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
  5. package/ios/AirGoogleMaps/AIRGoogleMap.m +166 -11
  6. package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
  7. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
  8. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
  9. package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
  10. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +28 -119
  11. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
  12. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +344 -243
  13. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
  14. package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
  15. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +5 -4
  16. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +29 -2
  17. package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
  18. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -2
  19. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -3
  20. package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
  21. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
  22. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
  23. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
  24. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +18 -0
  25. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
  26. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +599 -0
  27. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
  28. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
  29. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
  30. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
  31. package/ios/AirMaps/AIRMap.h +8 -4
  32. package/ios/AirMaps/AIRMap.m +227 -137
  33. package/ios/AirMaps/AIRMapManager.m +9 -21
  34. package/ios/AirMaps/AIRMapMarker.m +8 -2
  35. package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
  36. package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
  37. package/ios/AirMaps/RNMapsAirModule.h +3 -0
  38. package/ios/AirMaps/RNMapsAirModule.mm +40 -171
  39. package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
  40. package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
  41. package/ios/AirMaps/RNMapsMapView.h +6 -3
  42. package/ios/AirMaps/RNMapsMapView.mm +340 -334
  43. package/ios/AirMaps/UIView +AirMap.m +20 -0
  44. package/ios/AirMaps/UIView+AirMap.h +11 -0
  45. package/lib/MapMarker.d.ts +2 -2
  46. package/lib/MapMarker.js +12 -5
  47. package/lib/MapMarkerNativeComponent.js +0 -2
  48. package/lib/MapOverlay.d.ts +1 -1
  49. package/lib/MapView.d.ts +4 -22
  50. package/lib/MapView.js +28 -21
  51. package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
  52. package/lib/createFabricMap.js +175 -0
  53. package/lib/decorateMapComponent.js +18 -0
  54. package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
  55. package/lib/specs/NativeComponentGoogleMapView.js +21 -0
  56. package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
  57. package/lib/specs/NativeComponentGooglePolygon.js +9 -0
  58. package/lib/specs/NativeComponentMapView.d.ts +21 -45
  59. package/lib/specs/NativeComponentMarker.d.ts +245 -0
  60. package/lib/specs/NativeComponentMarker.js +20 -0
  61. package/package.json +10 -7
  62. package/react-native-maps.podspec +1 -1
  63. package/lib/FabricMapView.js +0 -175
@@ -0,0 +1,20 @@
1
+ //
2
+ // Created by Leland Richardson on 12/27/15.
3
+ // Copyright (c) 2015 Facebook. All rights reserved.
4
+ //
5
+
6
+ #import "UIView+AirMap.h"
7
+
8
+ @implementation UIView (AirMap)
9
+
10
+ - (UIView *) getPaperViewFromChildComponentView {
11
+ // Check if the childComponentView responds to the "adapter" selector
12
+ if ([self respondsToSelector:@selector(paperView)]) {
13
+ // Safely return the paperView
14
+ return [self valueForKey:@"paperView"];
15
+ }
16
+ // Return nil if paperView is not accessible
17
+ return nil;
18
+ }
19
+
20
+ @end
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by Salah Ghanim on 29/12/2024.
3
+ // Copyright (c) 2015 Facebook. All rights reserved.
4
+ //
5
+
6
+ #import <UIKit/UIKit.h>
7
+
8
+ @interface UIView (AirMap)
9
+ - (UIView *) getPaperViewFromChildComponentView;
10
+
11
+ @end
@@ -42,7 +42,7 @@ export type MapMarkerProps = ViewProps & {
42
42
  *
43
43
  * @default {x: 0.0, y: 0.0}
44
44
  * @platform iOS: Apple Maps only. For Google Maps, see the `calloutAnchor` prop
45
- * @platform Android: Not supported. See see the `calloutAnchor` prop
45
+ * @platform Android: Not supported. see the `calloutAnchor` prop
46
46
  */
47
47
  calloutOffset?: Point;
48
48
  /**
@@ -54,7 +54,7 @@ export type MapMarkerProps = ViewProps & {
54
54
  *
55
55
  * @default {x: 0.0, y: 0.0}
56
56
  * @platform iOS: Apple Maps only. For Google Maps, see the `anchor` prop
57
- * @platform Android: Not supported. See see the `anchor` prop
57
+ * @platform Android: Not supported. see the `anchor` prop
58
58
  */
59
59
  centerOffset?: Point;
60
60
  /**
package/lib/MapMarker.js CHANGED
@@ -28,6 +28,7 @@ const React = __importStar(require("react"));
28
28
  const react_native_1 = require("react-native");
29
29
  const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
30
  const MapMarkerNativeComponent_1 = require("./MapMarkerNativeComponent");
31
+ const ProviderConstants_1 = require("./ProviderConstants");
31
32
  class MapMarker extends React.Component {
32
33
  getNativeComponent;
33
34
  getMapManagerCommand;
@@ -79,17 +80,23 @@ class MapMarker extends React.Component {
79
80
  }
80
81
  render() {
81
82
  const { stopPropagation = false } = this.props;
82
- let image;
83
- if (this.props.image) {
84
- image = react_native_1.Image.resolveAssetSource(this.props.image) || {};
85
- image = image.uri || this.props.image;
86
- }
87
83
  let icon;
88
84
  if (this.props.icon) {
89
85
  icon = react_native_1.Image.resolveAssetSource(this.props.icon) || {};
90
86
  icon = icon.uri;
91
87
  }
92
88
  const AIRMapMarker = this.getNativeComponent();
89
+ const provider = this.context;
90
+ let image;
91
+ if (this.props.image) {
92
+ if (provider !== ProviderConstants_1.PROVIDER_GOOGLE && react_native_1.Platform.OS === 'ios') {
93
+ image = this.props.image;
94
+ }
95
+ else {
96
+ image = react_native_1.Image.resolveAssetSource(this.props.image) || {};
97
+ image = image.uri || this.props.image;
98
+ }
99
+ }
93
100
  return (<AIRMapMarker {...this.props} ref={this.marker} image={image} icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
94
101
  if (stopPropagation) {
95
102
  event.stopPropagation();
@@ -9,9 +9,7 @@ exports.Commands = (0, codegenNativeCommands_1.default)({
9
9
  supportedCommands: [
10
10
  'showCallout',
11
11
  'hideCallout',
12
- 'redrawCallout',
13
12
  'animateMarkerToCoordinate',
14
- 'redraw',
15
13
  'setCoordinates',
16
14
  ],
17
15
  });
@@ -70,7 +70,7 @@ type OverlayPressEvent = NativeSyntheticEvent<{
70
70
  */
71
71
  action: 'overlay-press' | 'image-overlay-press';
72
72
  /**
73
- * @platform iOS: Apple maps
73
+ * @platform iOS: Apple Maps
74
74
  */
75
75
  name?: string;
76
76
  /**
package/lib/MapView.d.ts CHANGED
@@ -11,7 +11,7 @@ export type MapViewProps = ViewProps & {
11
11
  * If `true` map will be cached and displayed as an image instead of being interactable, for performance usage.
12
12
  *
13
13
  * @default false
14
- * @platform iOS: Apple maps only
14
+ * @platform iOS: Apple Maps only
15
15
  * @platform Android: Supported
16
16
  */
17
17
  cacheEnabled?: boolean;
@@ -92,7 +92,7 @@ export type MapViewProps = ViewProps & {
92
92
  */
93
93
  kmlSrc?: string;
94
94
  /**
95
- * If set, changes the position of the "Legal" label link in Apple maps.
95
+ * If set, changes the position of the "Legal" label link in Apple Maps.
96
96
  *
97
97
  * @platform iOS: Apple Maps only
98
98
  * @platform Android: Not supported
@@ -426,7 +426,7 @@ export type MapViewProps = ViewProps & {
426
426
  * If `false` compass won't be displayed on the map.
427
427
  *
428
428
  * @default true
429
- * @platform iOS: Supported
429
+ * @platform iOS: Supported (adaptive on Apple Maps, visible only if map is not pointing north)
430
430
  * @platform Android: Supported
431
431
  */
432
432
  showsCompass?: boolean;
@@ -454,32 +454,14 @@ export type MapViewProps = ViewProps & {
454
454
  * @platform Android: Supported
455
455
  */
456
456
  showsMyLocationButton?: boolean;
457
- /**
458
- * If `false` points of interest won't be displayed on the map.
459
- * TODO: DEPRECATED? Doesn't seem to do anything
460
- *
461
- * @default true
462
- * @platform iOS: Maybe Apple Maps?
463
- * @platform Android: Not supported
464
- */
465
- showsPointsOfInterest?: boolean;
466
457
  /**
467
458
  * A Boolean indicating whether the map shows scale information.
468
459
  *
469
- * @default true
460
+ * @default false
470
461
  * @platform iOS: Apple Maps only
471
462
  * @platform Android: Not supported
472
463
  */
473
464
  showsScale?: boolean;
474
- /**
475
- * A Boolean value indicating whether the map displays traffic information.
476
- * TODO: Look into android support
477
- *
478
- * @default false
479
- * @platform iOS: Supported
480
- * @platform Android: Not supported?
481
- */
482
- showsTraffic?: boolean;
483
465
  /**
484
466
  * If `true` the users location will be displayed on the map.
485
467
  *
package/lib/MapView.js CHANGED
@@ -30,9 +30,12 @@ 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
+ const FabricGoogleMap = (0, createFabricMap_1.default)(NativeComponentGoogleMapView_1.default, NativeComponentGoogleMapView_1.Commands);
36
39
  exports.MAP_TYPES = {
37
40
  STANDARD: 'standard',
38
41
  SATELLITE: 'satellite',
@@ -43,7 +46,6 @@ exports.MAP_TYPES = {
43
46
  SATELLITE_FLYOVER: 'satelliteFlyover',
44
47
  HYBRID_FLYOVER: 'hybridFlyover',
45
48
  };
46
- const GOOGLE_MAPS_ONLY_TYPES = [exports.MAP_TYPES.TERRAIN, exports.MAP_TYPES.NONE];
47
49
  class MapView extends React.Component {
48
50
  static Animated;
49
51
  map;
@@ -53,7 +55,7 @@ class MapView extends React.Component {
53
55
  this.map = React.createRef();
54
56
  this.fabricMap = React.createRef();
55
57
  this.state = {
56
- isReady: react_native_1.Platform.OS === 'ios',
58
+ isReady: false,
57
59
  };
58
60
  this._onMapReady = this._onMapReady.bind(this);
59
61
  this._onChange = this._onChange.bind(this);
@@ -343,12 +345,10 @@ class MapView extends React.Component {
343
345
  }
344
346
  };
345
347
  render() {
346
- if (react_native_1.Platform.OS === 'ios' &&
347
- this.props.provider === ProviderConstants.PROVIDER_DEFAULT) {
348
- const AIRMap = FabricMapView_1.default;
348
+ if (react_native_1.Platform.OS === 'ios') {
349
349
  // Define props specifically for MapFabricNativeProps
350
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;
351
+ const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
352
352
  /* eslint-enable @typescript-eslint/no-unused-vars */
353
353
  const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
354
354
  const props = {
@@ -361,6 +361,8 @@ class MapView extends React.Component {
361
361
  onMarkerSelect: this.handleMarkerSelect,
362
362
  onMarkerDeselect: this.handleMarkerDeselect,
363
363
  userInterfaceStyle: userInterfaceStyle,
364
+ minZoom: minZoomLevel,
365
+ maxZoom: maxZoomLevel,
364
366
  onRegionChange: this.handleRegionChange,
365
367
  ...restProps,
366
368
  };
@@ -373,9 +375,8 @@ class MapView extends React.Component {
373
375
  };
374
376
  }
375
377
  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');
378
+ if (props.onPanDrag) {
379
+ props.handlePanDrag = !!props.onPanDrag;
379
380
  }
380
381
  }
381
382
  else {
@@ -383,10 +384,21 @@ class MapView extends React.Component {
383
384
  props.initialCamera = this.props.initialCamera;
384
385
  props.onLayout = this.props.onLayout;
385
386
  }
386
- // Render AIRMap with MapFabricNativeProps
387
- return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
388
- <AIRMap {...props} ref={this.fabricMap}/>
389
- </decorateMapComponent_1.ProviderContext.Provider>);
387
+ const childrenNodes = this.state.isReady ? children : null;
388
+ if (provider === 'google') {
389
+ return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
390
+ <FabricGoogleMap {...props} ref={this.fabricMap}>
391
+ {childrenNodes}
392
+ </FabricGoogleMap>
393
+ </decorateMapComponent_1.ProviderContext.Provider>);
394
+ }
395
+ else {
396
+ return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
397
+ <FabricMap {...props} ref={this.fabricMap}>
398
+ {childrenNodes}
399
+ </FabricMap>
400
+ </decorateMapComponent_1.ProviderContext.Provider>);
401
+ }
390
402
  }
391
403
  else {
392
404
  const AIRMap = getNativeMapComponent(this.props.provider);
@@ -405,12 +417,7 @@ class MapView extends React.Component {
405
417
  : undefined,
406
418
  ...this.props,
407
419
  };
408
- if (this.state.isReady) {
409
- if (props.onPanDrag) {
410
- props.handlePanDrag = !!props.onPanDrag;
411
- }
412
- }
413
- else {
420
+ if (!this.state.isReady) {
414
421
  props.style = this.props.style;
415
422
  props.initialCamera = this.props.initialCamera;
416
423
  props.onLayout = this.props.onLayout;
@@ -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;
@@ -18,5 +19,5 @@ export interface FabricMapHandle {
18
19
  getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
19
20
  getCoordinateForPoint: (point: Point) => Promise<LatLng>;
20
21
  }
21
- export declare const FabricMap: React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
22
- export default FabricMap;
22
+ declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
23
+ export default createFabricMap;
@@ -0,0 +1,175 @@
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 only supported on iOS with Fabric.');
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 only supported on iOS with Fabric.');
66
+ }
67
+ },
68
+ async takeSnapshot(config) {
69
+ if (fabricRef.current) {
70
+ return NativeAirMapsModule_1.default.takeSnapshot((0, react_native_1.findNodeHandle)(fabricRef.current) ?? -1, 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
+ setCamera(camera) {
158
+ if (fabricRef.current) {
159
+ try {
160
+ Commands.setCamera(fabricRef.current, JSON.stringify(camera));
161
+ }
162
+ catch (error) {
163
+ console.error('Failed to set camera:', error);
164
+ }
165
+ }
166
+ else {
167
+ console.warn('setCamera is only supported on iOS with Fabric.');
168
+ }
169
+ },
170
+ }));
171
+ // @ts-ignore
172
+ return <ViewComponent {...props} ref={fabricRef}/>;
173
+ });
174
+ };
175
+ exports.default = createFabricMap;
@@ -1,9 +1,14 @@
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"));
7
12
  exports.SUPPORTED = 'SUPPORTED';
8
13
  exports.USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
9
14
  exports.NOT_SUPPORTED = 'NOT_SUPPORTED';
@@ -34,6 +39,12 @@ function decorateMapComponent(Component, componentName, providers) {
34
39
  Component.prototype.getNativeComponent =
35
40
  function getNativeComponent() {
36
41
  const provider = this.context;
42
+ if (componentName === 'Marker' &&
43
+ provider !== ProviderConstants_1.PROVIDER_GOOGLE &&
44
+ react_native_1.Platform.OS === 'ios') {
45
+ // @ts-ignore
46
+ return NativeComponentMarker_1.default;
47
+ }
37
48
  const key = provider || 'default';
38
49
  if (components[key]) {
39
50
  return components[key];
@@ -47,6 +58,13 @@ function decorateMapComponent(Component, componentName, providers) {
47
58
  if (react_native_1.Platform.OS !== 'android' && react_native_1.Platform.OS !== 'ios') {
48
59
  throw new Error(`react-native-maps doesn't support ${react_native_1.Platform.OS}`);
49
60
  }
61
+ if (componentName === 'Polygon' &&
62
+ provider === ProviderConstants_1.PROVIDER_GOOGLE &&
63
+ react_native_1.Platform.OS === 'ios' &&
64
+ exports.googleMapIsInstalled) {
65
+ // @ts-ignore
66
+ return NativeComponentGooglePolygon_1.default;
67
+ }
50
68
  const platformSupport = providerInfo[react_native_1.Platform.OS];
51
69
  const nativeComponentName = getNativeComponentName(provider, componentName);
52
70
  if (platformSupport === exports.NOT_SUPPORTED) {