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

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 (47) 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/AIRGMSMarker.h +1 -1
  5. package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
  6. package/ios/AirGoogleMaps/AIRGoogleMap.m +151 -7
  7. package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
  8. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
  9. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
  10. package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
  11. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +28 -119
  12. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
  13. package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
  14. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +3 -3
  15. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +2 -2
  16. package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
  17. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -2
  18. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -3
  19. package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
  20. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
  21. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +16 -0
  22. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
  23. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +572 -0
  24. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
  25. package/ios/AirMaps/AIRMap.h +6 -4
  26. package/ios/AirMaps/AIRMap.m +179 -26
  27. package/ios/AirMaps/AIRMapManager.m +6 -21
  28. package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
  29. package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
  30. package/ios/AirMaps/RNMapsAirModule.h +3 -0
  31. package/ios/AirMaps/RNMapsAirModule.mm +40 -171
  32. package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
  33. package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
  34. package/ios/AirMaps/RNMapsMapView.h +6 -3
  35. package/ios/AirMaps/RNMapsMapView.mm +20 -38
  36. package/ios/AirMaps/UIView +AirMap.m +20 -0
  37. package/ios/AirMaps/UIView+AirMap.h +11 -0
  38. package/lib/MapOverlay.d.ts +1 -1
  39. package/lib/MapView.d.ts +2 -2
  40. package/lib/MapView.js +20 -18
  41. package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
  42. package/lib/createFabricMap.js +175 -0
  43. package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
  44. package/lib/specs/NativeComponentGoogleMapView.js +21 -0
  45. package/lib/specs/NativeComponentMapView.d.ts +4 -11
  46. package/package.json +10 -7
  47. package/lib/FabricMapView.js +0 -175
@@ -5,17 +5,20 @@
5
5
  // Created by Salah Ghanim on 23.11.24.
6
6
  // Copyright © 2024 react-native-maps. All rights reserved.
7
7
  //
8
+ #ifdef RCT_NEW_ARCH_ENABLED
8
9
 
9
10
  #import <React/RCTViewComponentView.h>
10
11
  #import <UIKit/UIKit.h>
12
+ #import "RNMapsHostVewDelegate.h"
13
+
11
14
  @class AIRMap;
12
15
 
13
16
  NS_ASSUME_NONNULL_BEGIN
14
17
 
15
- @interface RNMapsMapView : RCTViewComponentView
16
-
17
- - (AIRMap *) mapView;
18
+ @interface RNMapsMapView : RCTViewComponentView<RNMapsHostVewDelegate>
18
19
 
19
20
  @end
20
21
 
21
22
  NS_ASSUME_NONNULL_END
23
+
24
+ #endif
@@ -14,9 +14,9 @@
14
14
  #import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
15
15
  #import <react/renderer/components/RNMapsSpecs/Props.h>
16
16
  #import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
17
-
18
17
  #import "RCTFabricComponentsPlugins.h"
19
18
  #import <React/RCTConversions.h>
19
+ #import "UIView+AirMap.h"
20
20
 
21
21
  using namespace facebook::react;
22
22
 
@@ -29,7 +29,7 @@ using namespace facebook::react;
29
29
  }
30
30
 
31
31
 
32
- - (AIRMap *) mapView {
32
+ - (id<RNMapsAirModuleDelegate>) mapView {
33
33
  return _view;
34
34
  }
35
35
 
@@ -76,6 +76,16 @@ using namespace facebook::react;
76
76
 
77
77
  }
78
78
  - (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated {
79
+ NSArray* coordinatesArr = [RCTConvert arrayFromString:coordinatesJSON];
80
+ NSMutableArray<AIRMapCoordinate*>* mutableArray = [NSMutableArray new];
81
+ for (id json : coordinatesArr){
82
+ [mutableArray addObject:[RCTConvert AIRMapCoordinate:json]];
83
+ }
84
+
85
+ NSDictionary* edgePadding = [RCTConvert dictonaryFromString:edgePaddingJSON];
86
+
87
+ UIEdgeInsets edgeInsets = [RCTConvert UIEdgeInsets:edgePadding];
88
+ [_view fitToCoordinates:mutableArray edgePadding:edgeInsets animated:animated];
79
89
 
80
90
  }
81
91
 
@@ -255,28 +265,6 @@ using namespace facebook::react;
255
265
  .width = [positionDict[@"width"] doubleValue],
256
266
  .height = [positionDict[@"height"] doubleValue],
257
267
  };
258
- /*
259
- std::string action;
260
- OnCalloutPressFrame frame;
261
- std::string id;
262
- OnCalloutPressPoint point;
263
- OnCalloutPressCoordinate coordinate;
264
- OnCalloutPressPosition position;
265
- id event = @{
266
- @"action": calloutSubview ? @"callout-inside-press" : @"callout-press",
267
- @"id": marker.identifier ?: @"unknown",
268
- @"point": @{
269
- @"x": @(touchPointReal.x),
270
- @"y": @(touchPointReal.y),
271
- },
272
- @"frame": @{
273
- @"x": @(bubbleFrame.origin.x),
274
- @"y": @(bubbleFrame.origin.y),
275
- @"width": @(bubbleFrame.size.width),
276
- @"height": @(bubbleFrame.size.height),
277
- }
278
- };
279
- */
280
268
 
281
269
  auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
282
270
  facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
@@ -371,27 +359,22 @@ OnCalloutPressPosition position;
371
359
  return self;
372
360
  }
373
361
 
374
- - (id)getPaperViewFromChildComponentView:(UIView *)childComponentView {
375
- // Check if the childComponentView responds to the "adapter" selector
376
- if ([childComponentView respondsToSelector:@selector(paperView)]) {
377
- // Safely return the paperView
378
- return [childComponentView valueForKey:@"paperView"];
379
- }
380
- // Return nil if paperView is not accessible
381
- return nil;
382
- }
383
362
 
384
363
  - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
385
- id<RCTComponent> paperView = [self getPaperViewFromChildComponentView:childComponentView];
364
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
386
365
  if (paperView){
387
366
  [_view insertReactSubview:paperView atIndex:index];
367
+ } else {
368
+ [_view insertReactSubview:childComponentView atIndex:index];
388
369
  }
389
370
  }
390
371
  - (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
391
372
  {
392
- id<RCTComponent> paperView = [self getPaperViewFromChildComponentView:childComponentView];
373
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
393
374
  if (paperView){
394
375
  [_view removeReactSubview:paperView];
376
+ } else {
377
+ [_view removeReactSubview:childComponentView];
395
378
  }
396
379
  }
397
380
 
@@ -482,9 +465,9 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
482
465
  REMAP_MAPVIEW_PROP(scrollEnabled)
483
466
 
484
467
  REMAP_MAPVIEW_PROP(maxDelta)
485
- REMAP_MAPVIEW_PROP(maxZoomLevel)
468
+ REMAP_MAPVIEW_PROP(maxZoom)
486
469
  REMAP_MAPVIEW_PROP(minDelta)
487
- REMAP_MAPVIEW_PROP(minZoomLevel)
470
+ REMAP_MAPVIEW_PROP(minZoom)
488
471
 
489
472
  REMAP_MAPVIEW_PROP(showsCompass)
490
473
  REMAP_MAPVIEW_PROP(showsScale)
@@ -508,7 +491,6 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
508
491
  REMAP_MAPVIEW_COLOR_PROP(loadingIndicatorColor)
509
492
  REMAP_MAPVIEW_COLOR_PROP(tintColor)
510
493
 
511
- // userLocationAnnotationTitle
512
494
  REMAP_MAPVIEW_STRING_PROP(userLocationAnnotationTitle)
513
495
 
514
496
  if (oldViewProps.mapType != newViewProps.mapType){
@@ -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
@@ -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
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;
@@ -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, ...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
  };
@@ -372,21 +374,21 @@ class MapView extends React.Component {
372
374
  longitudeDelta: this.props.region.longitudeDelta,
373
375
  };
374
376
  }
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 {
377
+ if (!this.state.isReady) {
382
378
  props.style = this.props.style;
383
379
  props.initialCamera = this.props.initialCamera;
384
380
  props.onLayout = this.props.onLayout;
385
381
  }
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>);
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>);
391
+ }
390
392
  }
391
393
  else {
392
394
  const AIRMap = getNativeMapComponent(this.props.provider);
@@ -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;