react-native-maps 1.21.0-alpha.6 → 1.21.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/AirGoogleMaps/AIRGoogleMap.h +6 -1
- package/ios/AirGoogleMaps/AIRGoogleMap.m +90 -7
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +13 -91
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -2
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +16 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +531 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
- package/ios/AirMaps/AIRMap.h +4 -4
- package/ios/AirMaps/AIRMap.m +14 -2
- package/ios/AirMaps/AIRMapManager.m +6 -21
- package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
- package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
- package/ios/AirMaps/RNMapsAirModule.h +3 -0
- package/ios/AirMaps/RNMapsMapView.h +3 -0
- package/ios/AirMaps/RNMapsMapView.mm +12 -25
- package/lib/MapOverlay.d.ts +1 -1
- package/lib/MapView.d.ts +2 -2
- package/lib/MapView.js +20 -18
- package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
- package/lib/createFabricMap.js +175 -0
- package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
- package/lib/specs/NativeComponentGoogleMapView.js +21 -0
- package/lib/specs/NativeComponentMapView.d.ts +4 -11
- package/package.json +7 -7
- package/lib/FabricMapView.js +0 -175
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
|
|
30
31
|
+ (MKMapCamera*)MKMapCamera:(id)json
|
|
31
32
|
{
|
|
32
33
|
json = [self NSDictionary:json];
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
error:&jsonError];
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
|
|
52
54
|
+ (MKMapCamera*)MKMapCameraWithDefaults:(id)json existingCamera:(MKMapCamera*)camera
|
|
53
55
|
{
|
|
54
56
|
json = [self NSDictionary:json];
|
|
@@ -5,6 +5,7 @@
|
|
|
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>
|
|
@@ -19,3 +20,5 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
19
20
|
@end
|
|
20
21
|
|
|
21
22
|
NS_ASSUME_NONNULL_END
|
|
23
|
+
|
|
24
|
+
#endif
|
|
@@ -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 = {
|
|
@@ -482,9 +470,9 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
482
470
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
483
471
|
|
|
484
472
|
REMAP_MAPVIEW_PROP(maxDelta)
|
|
485
|
-
REMAP_MAPVIEW_PROP(
|
|
473
|
+
REMAP_MAPVIEW_PROP(maxZoom)
|
|
486
474
|
REMAP_MAPVIEW_PROP(minDelta)
|
|
487
|
-
REMAP_MAPVIEW_PROP(
|
|
475
|
+
REMAP_MAPVIEW_PROP(minZoom)
|
|
488
476
|
|
|
489
477
|
REMAP_MAPVIEW_PROP(showsCompass)
|
|
490
478
|
REMAP_MAPVIEW_PROP(showsScale)
|
|
@@ -508,7 +496,6 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
|
|
|
508
496
|
REMAP_MAPVIEW_COLOR_PROP(loadingIndicatorColor)
|
|
509
497
|
REMAP_MAPVIEW_COLOR_PROP(tintColor)
|
|
510
498
|
|
|
511
|
-
// userLocationAnnotationTitle
|
|
512
499
|
REMAP_MAPVIEW_STRING_PROP(userLocationAnnotationTitle)
|
|
513
500
|
|
|
514
501
|
if (oldViewProps.mapType != newViewProps.mapType){
|
package/lib/MapOverlay.d.ts
CHANGED
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
|
|
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
|
|
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
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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 {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
22
|
-
export default
|
|
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;
|