react-native-maps 1.21.0-alpha.4 → 1.21.0-alpha.41
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/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +51 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +46 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.m +179 -11
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- 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 +30 -119
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +5 -4
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +32 -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/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +18 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +599 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
- package/ios/AirMaps/AIRMap.h +8 -5
- package/ios/AirMaps/AIRMap.m +284 -141
- package/ios/AirMaps/AIRMapManager.m +12 -21
- package/ios/AirMaps/AIRMapMarker.h +1 -0
- package/ios/AirMaps/AIRMapMarker.m +165 -103
- package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
- 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/RNMapsAirModule.mm +42 -172
- package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
- package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
- package/ios/AirMaps/RNMapsMapView.h +6 -3
- package/ios/AirMaps/RNMapsMapView.mm +341 -334
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +422 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +21 -0
- package/ios/AirMaps/UIView +AirMap.m +20 -0
- package/ios/AirMaps/UIView+AirMap.h +11 -0
- package/lib/MapMarker.d.ts +15 -2
- package/lib/MapMarker.js +53 -9
- package/lib/MapMarkerNativeComponent.js +0 -2
- package/lib/MapOverlay.d.ts +1 -1
- package/lib/MapView.d.ts +5 -22
- package/lib/MapView.js +34 -21
- package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -6
- package/lib/createFabricMap.js +175 -0
- package/lib/decorateMapComponent.js +18 -0
- package/lib/specs/NativeAirMapsModule.d.ts +2 -2
- package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
- package/lib/specs/NativeComponentGoogleMapView.js +21 -0
- package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
- package/lib/specs/NativeComponentGooglePolygon.js +9 -0
- package/lib/specs/NativeComponentMapView.d.ts +21 -45
- package/lib/specs/NativeComponentMarker.d.ts +258 -0
- package/lib/specs/NativeComponentMarker.js +21 -0
- package/package.json +7 -7
- package/react-native-maps.podspec +1 -1
- package/lib/FabricMapView.js +0 -175
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
|
|
@@ -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
|
|
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
|
*
|
|
@@ -626,6 +608,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
626
608
|
duration?: number;
|
|
627
609
|
}): void;
|
|
628
610
|
animateToRegion(region: Region, duration?: number): void;
|
|
611
|
+
setRegion(region: Region): void;
|
|
629
612
|
fitToElements(options?: FitToOptions): void;
|
|
630
613
|
fitToSuppliedMarkers(markers: string[], options?: FitToOptions): void;
|
|
631
614
|
fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): void;
|
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;
|
|
@@ -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:
|
|
58
|
+
isReady: false,
|
|
57
59
|
};
|
|
58
60
|
this._onMapReady = this._onMapReady.bind(this);
|
|
59
61
|
this._onChange = this._onChange.bind(this);
|
|
@@ -117,6 +119,12 @@ class MapView extends React.Component {
|
|
|
117
119
|
MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
122
|
+
setRegion(region) {
|
|
123
|
+
if (this.fabricMap.current) {
|
|
124
|
+
this.fabricMap.current.animateToRegion(region, 0);
|
|
125
|
+
}
|
|
126
|
+
//TODO fix for android
|
|
127
|
+
}
|
|
120
128
|
fitToElements(options = {}) {
|
|
121
129
|
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
|
|
122
130
|
if (this.fabricMap.current) {
|
|
@@ -343,12 +351,10 @@ class MapView extends React.Component {
|
|
|
343
351
|
}
|
|
344
352
|
};
|
|
345
353
|
render() {
|
|
346
|
-
if (react_native_1.Platform.OS === 'ios'
|
|
347
|
-
this.props.provider === ProviderConstants.PROVIDER_DEFAULT) {
|
|
348
|
-
const AIRMap = FabricMapView_1.default;
|
|
354
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
349
355
|
// Define props specifically for MapFabricNativeProps
|
|
350
356
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
351
|
-
const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, region, ...restProps } = this.props;
|
|
357
|
+
const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
|
|
352
358
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
353
359
|
const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
|
|
354
360
|
const props = {
|
|
@@ -361,6 +367,8 @@ class MapView extends React.Component {
|
|
|
361
367
|
onMarkerSelect: this.handleMarkerSelect,
|
|
362
368
|
onMarkerDeselect: this.handleMarkerDeselect,
|
|
363
369
|
userInterfaceStyle: userInterfaceStyle,
|
|
370
|
+
minZoom: minZoomLevel,
|
|
371
|
+
maxZoom: maxZoomLevel,
|
|
364
372
|
onRegionChange: this.handleRegionChange,
|
|
365
373
|
...restProps,
|
|
366
374
|
};
|
|
@@ -373,9 +381,8 @@ class MapView extends React.Component {
|
|
|
373
381
|
};
|
|
374
382
|
}
|
|
375
383
|
if (this.state.isReady) {
|
|
376
|
-
if (props.
|
|
377
|
-
props.
|
|
378
|
-
console.log('ready');
|
|
384
|
+
if (props.onPanDrag) {
|
|
385
|
+
props.handlePanDrag = !!props.onPanDrag;
|
|
379
386
|
}
|
|
380
387
|
}
|
|
381
388
|
else {
|
|
@@ -383,10 +390,21 @@ class MapView extends React.Component {
|
|
|
383
390
|
props.initialCamera = this.props.initialCamera;
|
|
384
391
|
props.onLayout = this.props.onLayout;
|
|
385
392
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
393
|
+
const childrenNodes = this.state.isReady ? children : null;
|
|
394
|
+
if (provider === 'google') {
|
|
395
|
+
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
396
|
+
<FabricGoogleMap {...props} ref={this.fabricMap}>
|
|
397
|
+
{childrenNodes}
|
|
398
|
+
</FabricGoogleMap>
|
|
399
|
+
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
403
|
+
<FabricMap {...props} ref={this.fabricMap}>
|
|
404
|
+
{childrenNodes}
|
|
405
|
+
</FabricMap>
|
|
406
|
+
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
407
|
+
}
|
|
390
408
|
}
|
|
391
409
|
else {
|
|
392
410
|
const AIRMap = getNativeMapComponent(this.props.provider);
|
|
@@ -405,12 +423,7 @@ class MapView extends React.Component {
|
|
|
405
423
|
: undefined,
|
|
406
424
|
...this.props,
|
|
407
425
|
};
|
|
408
|
-
if (this.state.isReady) {
|
|
409
|
-
if (props.onPanDrag) {
|
|
410
|
-
props.handlePanDrag = !!props.onPanDrag;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
else {
|
|
426
|
+
if (!this.state.isReady) {
|
|
414
427
|
props.style = this.props.style;
|
|
415
428
|
props.initialCamera = this.props.initialCamera;
|
|
416
429
|
props.onLayout = this.props.onLayout;
|
|
@@ -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, 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
|
+
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) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
|
-
import type { Double
|
|
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:
|
|
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>;
|