react-native-maps 1.21.0-alpha.115 → 1.21.0-alpha.116
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/generated/RCTAppDependencyProvider.h +25 -0
- package/android/src/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/src/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/src/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/src/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/src/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/android/src/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/src/generated/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +206 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +73 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +46 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +23 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/src/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
- package/android/src/generated/jni/CMakeLists.txt +36 -0
- package/android/src/generated/jni/RNMapsSpecs-generated.cpp +68 -0
- package/android/src/generated/jni/RNMapsSpecs.h +31 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +846 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +193 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1223 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +109 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/src/generated/jni/react/renderer/components/RNMapsSpecs/States.h +113 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +0 -12
- package/ios/generated/ReactAppDependencyProvider.podspec +1 -1
- package/package.json +16 -18
- package/src/AnimatedRegion.ts +169 -0
- package/src/Geojson.tsx +541 -0
- package/src/MapCallout.tsx +77 -0
- package/src/MapCalloutSubview.tsx +64 -0
- package/src/MapCircle.tsx +162 -0
- package/src/MapHeatmap.tsx +125 -0
- package/src/MapLocalTile.tsx +60 -0
- package/src/MapMarker.tsx +531 -0
- package/src/MapMarkerNativeComponent.ts +51 -0
- package/src/MapOverlay.tsx +156 -0
- package/src/MapPolygon.tsx +188 -0
- package/src/MapPolygon.types.ts +25 -0
- package/src/MapPolyline.tsx +215 -0
- package/src/MapUrlTile.tsx +169 -0
- package/src/MapView.tsx +1223 -0
- package/src/MapView.types.ts +212 -0
- package/src/MapView.web.ts +2 -0
- package/src/MapViewNativeComponent.ts +86 -0
- package/src/MapWMSTile.tsx +148 -0
- package/src/ProviderConstants.ts +2 -0
- package/src/createFabricMap.tsx +253 -0
- package/src/decorateMapComponent.ts +219 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/src/specs/NativeAirMapsModule.ts +36 -0
- package/src/specs/NativeComponentCallout.ts +63 -0
- package/src/specs/NativeComponentCircle.ts +93 -0
- package/src/specs/NativeComponentGoogleMapView.ts +913 -0
- package/src/specs/NativeComponentGooglePolygon.ts +94 -0
- package/src/specs/NativeComponentMapView.ts +1091 -0
- package/src/specs/NativeComponentMarker.ts +326 -0
- package/src/specs/NativeComponentOverlay.ts +89 -0
- package/src/specs/NativeComponentPolyline.ts +124 -0
- package/lib/AnimatedRegion.d.ts +0 -19
- package/lib/AnimatedRegion.js +0 -134
- package/lib/Geojson.d.ts +0 -204
- package/lib/Geojson.js +0 -166
- package/lib/MapCallout.d.ts +0 -40
- package/lib/MapCallout.js +0 -51
- package/lib/MapCalloutSubview.d.ts +0 -34
- package/lib/MapCalloutSubview.js +0 -48
- package/lib/MapCircle.d.ts +0 -117
- package/lib/MapCircle.js +0 -53
- package/lib/MapHeatmap.d.ts +0 -78
- package/lib/MapHeatmap.js +0 -59
- package/lib/MapLocalTile.d.ts +0 -35
- package/lib/MapLocalTile.js +0 -44
- package/lib/MapMarker.d.ts +0 -322
- package/lib/MapMarker.js +0 -158
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -15
- package/lib/MapOverlay.d.ts +0 -88
- package/lib/MapOverlay.js +0 -65
- package/lib/MapPolygon.d.ts +0 -140
- package/lib/MapPolygon.js +0 -53
- package/lib/MapPolygon.types.d.ts +0 -18
- package/lib/MapPolygon.types.js +0 -2
- package/lib/MapPolyline.d.ts +0 -156
- package/lib/MapPolyline.js +0 -53
- package/lib/MapUrlTile.d.ts +0 -134
- package/lib/MapUrlTile.js +0 -44
- package/lib/MapView.d.ts +0 -703
- package/lib/MapView.js +0 -428
- package/lib/MapView.types.d.ts +0 -161
- package/lib/MapView.types.js +0 -2
- package/lib/MapView.web.d.ts +0 -1
- package/lib/MapView.web.js +0 -9
- package/lib/MapViewNativeComponent.d.ts +0 -18
- package/lib/MapViewNativeComponent.js +0 -19
- package/lib/MapWMSTile.d.ts +0 -116
- package/lib/MapWMSTile.js +0 -44
- package/lib/ProviderConstants.d.ts +0 -2
- package/lib/ProviderConstants.js +0 -5
- package/lib/createFabricMap.d.ts +0 -24
- package/lib/createFabricMap.js +0 -188
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -120
- package/lib/fixImageProp.d.ts +0 -4
- package/lib/fixImageProp.js +0 -16
- package/lib/index.d.ts +0 -38
- package/lib/index.js +0 -81
- package/lib/sharedTypes.d.ts +0 -81
- package/lib/sharedTypes.js +0 -2
- package/lib/sharedTypesInternal.js +0 -2
- package/lib/specs/NativeAirMapsModule.d.ts +0 -31
- package/lib/specs/NativeAirMapsModule.js +0 -4
- package/lib/specs/NativeComponentCallout.d.ts +0 -46
- package/lib/specs/NativeComponentCallout.js +0 -9
- package/lib/specs/NativeComponentCircle.d.ts +0 -74
- package/lib/specs/NativeComponentCircle.js +0 -7
- package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -710
- package/lib/specs/NativeComponentGoogleMapView.js +0 -22
- package/lib/specs/NativeComponentGooglePolygon.d.ts +0 -75
- package/lib/specs/NativeComponentGooglePolygon.js +0 -7
- package/lib/specs/NativeComponentMapView.d.ts +0 -872
- package/lib/specs/NativeComponentMapView.js +0 -20
- package/lib/specs/NativeComponentMarker.d.ts +0 -258
- package/lib/specs/NativeComponentMarker.js +0 -19
- package/lib/specs/NativeComponentOverlay.d.ts +0 -67
- package/lib/specs/NativeComponentOverlay.js +0 -7
- package/lib/specs/NativeComponentPolyline.d.ts +0 -101
- package/lib/specs/NativeComponentPolyline.js +0 -7
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
package/lib/MapView.js
DELETED
|
@@ -1,428 +0,0 @@
|
|
|
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
|
-
exports.AnimatedMapView = exports.MAP_TYPES = void 0;
|
|
30
|
-
const React = __importStar(require("react"));
|
|
31
|
-
const react_native_1 = require("react-native");
|
|
32
|
-
const decorateMapComponent_1 = require("./decorateMapComponent");
|
|
33
|
-
const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
|
|
34
|
-
const NativeComponentMapView_1 = __importStar(require("./specs/NativeComponentMapView"));
|
|
35
|
-
const NativeComponentGoogleMapView_1 = __importStar(require("./specs/NativeComponentGoogleMapView"));
|
|
36
|
-
const createFabricMap_1 = __importDefault(require("./createFabricMap"));
|
|
37
|
-
const FabricMap = (0, createFabricMap_1.default)(NativeComponentMapView_1.default, NativeComponentMapView_1.Commands);
|
|
38
|
-
var FabricGoogleMap = null;
|
|
39
|
-
if (react_native_1.Platform.OS === 'ios') {
|
|
40
|
-
FabricGoogleMap = (0, createFabricMap_1.default)(NativeComponentGoogleMapView_1.default, NativeComponentGoogleMapView_1.Commands);
|
|
41
|
-
}
|
|
42
|
-
exports.MAP_TYPES = {
|
|
43
|
-
STANDARD: 'standard',
|
|
44
|
-
SATELLITE: 'satellite',
|
|
45
|
-
HYBRID: 'hybrid',
|
|
46
|
-
TERRAIN: 'terrain',
|
|
47
|
-
NONE: 'none',
|
|
48
|
-
MUTEDSTANDARD: 'mutedStandard',
|
|
49
|
-
SATELLITE_FLYOVER: 'satelliteFlyover',
|
|
50
|
-
HYBRID_FLYOVER: 'hybridFlyover',
|
|
51
|
-
};
|
|
52
|
-
class MapView extends React.Component {
|
|
53
|
-
static Animated;
|
|
54
|
-
map;
|
|
55
|
-
fabricMap = React.createRef();
|
|
56
|
-
constructor(props) {
|
|
57
|
-
super(props);
|
|
58
|
-
this.map = React.createRef();
|
|
59
|
-
this.fabricMap = React.createRef();
|
|
60
|
-
this.state = {
|
|
61
|
-
isReady: false,
|
|
62
|
-
};
|
|
63
|
-
this._onMapReady = this._onMapReady.bind(this);
|
|
64
|
-
this._onChange = this._onChange.bind(this);
|
|
65
|
-
}
|
|
66
|
-
setNativeProps(props) {
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
this.map.current?.setNativeProps(props);
|
|
69
|
-
}
|
|
70
|
-
_onMapReady() {
|
|
71
|
-
const { onMapReady } = this.props;
|
|
72
|
-
this.setState({ isReady: true }, () => {
|
|
73
|
-
if (onMapReady) {
|
|
74
|
-
onMapReady();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
_onChange({ nativeEvent }) {
|
|
79
|
-
const isGesture = nativeEvent.isGesture;
|
|
80
|
-
const details = { isGesture };
|
|
81
|
-
if (nativeEvent.continuous) {
|
|
82
|
-
if (this.props.onRegionChange) {
|
|
83
|
-
this.props.onRegionChange(nativeEvent.region, details);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (this.props.onRegionChangeComplete) {
|
|
87
|
-
this.props.onRegionChangeComplete(nativeEvent.region, details);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
getCamera() {
|
|
91
|
-
if (this.fabricMap.current) {
|
|
92
|
-
return this.fabricMap.current.getCamera();
|
|
93
|
-
}
|
|
94
|
-
return Promise.reject('getCamera not supported on this platform');
|
|
95
|
-
}
|
|
96
|
-
setCamera(camera) {
|
|
97
|
-
if (this.fabricMap.current) {
|
|
98
|
-
this.fabricMap.current.setCamera(camera);
|
|
99
|
-
}
|
|
100
|
-
else if (this.map.current) {
|
|
101
|
-
MapViewNativeComponent_1.Commands.setCamera(this.map.current, camera);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
animateCamera(camera, opts) {
|
|
105
|
-
if (this.fabricMap.current) {
|
|
106
|
-
this.fabricMap.current.animateCamera(camera, opts?.duration ? opts.duration : 500);
|
|
107
|
-
}
|
|
108
|
-
else if (this.map.current) {
|
|
109
|
-
MapViewNativeComponent_1.Commands.animateCamera(this.map.current, camera, opts?.duration ? opts.duration : 500);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
animateToRegion(region, duration = 500) {
|
|
113
|
-
if (this.fabricMap.current) {
|
|
114
|
-
this.fabricMap.current.animateToRegion(region, duration);
|
|
115
|
-
}
|
|
116
|
-
else if (this.map.current) {
|
|
117
|
-
MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
setRegion(region) {
|
|
121
|
-
if (this.fabricMap.current) {
|
|
122
|
-
this.fabricMap.current.animateToRegion(region, 0);
|
|
123
|
-
}
|
|
124
|
-
//TODO fix for android
|
|
125
|
-
}
|
|
126
|
-
fitToElements(options = {}) {
|
|
127
|
-
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
|
|
128
|
-
if (this.fabricMap.current) {
|
|
129
|
-
this.fabricMap.current.fitToElements(edgePadding, animated);
|
|
130
|
-
}
|
|
131
|
-
else if (this.map.current) {
|
|
132
|
-
MapViewNativeComponent_1.Commands.fitToElements(this.map.current, edgePadding, animated);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
fitToSuppliedMarkers(markers, options = {}) {
|
|
136
|
-
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
|
|
137
|
-
if (this.fabricMap.current) {
|
|
138
|
-
this.fabricMap.current.fitToSuppliedMarkers(markers, edgePadding, animated);
|
|
139
|
-
}
|
|
140
|
-
else if (this.map.current) {
|
|
141
|
-
MapViewNativeComponent_1.Commands.fitToSuppliedMarkers(this.map.current, markers, edgePadding, animated);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
fitToCoordinates(coordinates = [], options = {}) {
|
|
145
|
-
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
|
|
146
|
-
if (this.fabricMap.current) {
|
|
147
|
-
this.fabricMap.current.fitToCoordinates(coordinates, edgePadding, animated);
|
|
148
|
-
}
|
|
149
|
-
else if (this.map.current) {
|
|
150
|
-
MapViewNativeComponent_1.Commands.fitToCoordinates(this.map.current, coordinates, edgePadding, animated);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Get visible boudaries
|
|
155
|
-
*
|
|
156
|
-
* @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
157
|
-
*/
|
|
158
|
-
async getMapBoundaries() {
|
|
159
|
-
if (this.fabricMap.current) {
|
|
160
|
-
return this.fabricMap.current.getMapBoundaries();
|
|
161
|
-
}
|
|
162
|
-
return Promise.reject('getMapBoundaries not supported on this platform');
|
|
163
|
-
}
|
|
164
|
-
setMapBoundaries(northEast, southWest) {
|
|
165
|
-
if (this.map.current) {
|
|
166
|
-
MapViewNativeComponent_1.Commands.setMapBoundaries(this.map.current, northEast, southWest);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
170
|
-
if (this.fabricMap.current) {
|
|
171
|
-
return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
|
|
172
|
-
}
|
|
173
|
-
return Promise.reject('getMapBoundaries not supported on this platform');
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Takes a snapshot of the map and saves it to a picture
|
|
177
|
-
* file or returns the image as a base64 encoded string.
|
|
178
|
-
*
|
|
179
|
-
* @param args Configuration options
|
|
180
|
-
* @param [args.width] Width of the rendered map-view (when omitted actual view width is used).
|
|
181
|
-
* @param [args.height] Height of the rendered map-view (when omitted actual height is used).
|
|
182
|
-
* @param [args.region] Region to render (Only supported on iOS).
|
|
183
|
-
* @param [args.format] Encoding format ('png', 'jpg') (default: 'png').
|
|
184
|
-
* @param [args.quality] Compression quality (only used for jpg) (default: 1.0).
|
|
185
|
-
* @param [args.result] Result format ('file', 'base64') (default: 'file').
|
|
186
|
-
*
|
|
187
|
-
* @return Promise Promise with either the file-uri or base64 encoded string
|
|
188
|
-
*/
|
|
189
|
-
takeSnapshot(args) {
|
|
190
|
-
// Sanitize inputs
|
|
191
|
-
const config = {
|
|
192
|
-
width: args.width || 0,
|
|
193
|
-
height: args.height || 0,
|
|
194
|
-
region: args.region || {},
|
|
195
|
-
format: args.format || 'png',
|
|
196
|
-
quality: args.quality || 1.0,
|
|
197
|
-
result: args.result || 'file',
|
|
198
|
-
};
|
|
199
|
-
if (config.format !== 'png' && config.format !== 'jpg') {
|
|
200
|
-
throw new Error('Invalid format specified');
|
|
201
|
-
}
|
|
202
|
-
if (config.result !== 'file' && config.result !== 'base64') {
|
|
203
|
-
throw new Error('Invalid result specified');
|
|
204
|
-
}
|
|
205
|
-
if (this.fabricMap.current) {
|
|
206
|
-
// @ts-ignore
|
|
207
|
-
return this.fabricMap.current.takeSnapshot(config);
|
|
208
|
-
}
|
|
209
|
-
return Promise.reject('takeSnapshot not supported on this platform');
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Convert a coordinate to address by using default Geocoder
|
|
213
|
-
*
|
|
214
|
-
* @param coordinate Coordinate
|
|
215
|
-
* @param [coordinate.latitude] Latitude
|
|
216
|
-
* @param [coordinate.longitude] Longitude
|
|
217
|
-
*
|
|
218
|
-
* @return Promise with return type Address
|
|
219
|
-
*/
|
|
220
|
-
addressForCoordinate(coordinate) {
|
|
221
|
-
if (this.fabricMap.current) {
|
|
222
|
-
return this.fabricMap.current.getAddressFromCoordinates(coordinate);
|
|
223
|
-
}
|
|
224
|
-
return Promise.reject('getAddress not supported on this platform');
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Convert a map coordinate to user-space point
|
|
228
|
-
*
|
|
229
|
-
* @param coordinate Coordinate
|
|
230
|
-
* @param [coordinate.latitude] Latitude
|
|
231
|
-
* @param [coordinate.longitude] Longitude
|
|
232
|
-
*
|
|
233
|
-
* @return Promise Promise with the point ({ x: Number, y: Number })
|
|
234
|
-
*/
|
|
235
|
-
pointForCoordinate(coordinate) {
|
|
236
|
-
if (this.fabricMap.current) {
|
|
237
|
-
return this.fabricMap.current.getPointForCoordinate(coordinate);
|
|
238
|
-
}
|
|
239
|
-
return Promise.reject('pointForCoordinate not supported on this platform');
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Convert a user-space point to a map coordinate
|
|
243
|
-
*
|
|
244
|
-
* @param point Point
|
|
245
|
-
* @param [point.x] X
|
|
246
|
-
* @param [point.x] Y
|
|
247
|
-
*
|
|
248
|
-
* @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
|
|
249
|
-
*/
|
|
250
|
-
coordinateForPoint(point) {
|
|
251
|
-
if (this.fabricMap.current) {
|
|
252
|
-
return this.fabricMap.current.getCoordinateForPoint(point);
|
|
253
|
-
}
|
|
254
|
-
return Promise.reject('coordinateForPoint not supported on this platform');
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Get markers' centers and frames in user-space coordinates
|
|
258
|
-
*
|
|
259
|
-
* @param onlyVisible boolean true to include only visible markers, false to include all
|
|
260
|
-
*
|
|
261
|
-
* @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
|
|
262
|
-
*/
|
|
263
|
-
getMarkersFrames(onlyVisible = false) {
|
|
264
|
-
if (this.fabricMap.current) {
|
|
265
|
-
// @ts-ignore
|
|
266
|
-
return this.fabricMap.current.getMarkersFrames(onlyVisible);
|
|
267
|
-
}
|
|
268
|
-
return Promise.reject('getMarkersFrames not supported on this platform');
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Get bounding box from region
|
|
272
|
-
*
|
|
273
|
-
* @param region Region
|
|
274
|
-
*
|
|
275
|
-
* @return Object Object bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
276
|
-
*/
|
|
277
|
-
boundingBoxForRegion(region) {
|
|
278
|
-
return {
|
|
279
|
-
northEast: {
|
|
280
|
-
latitude: region.latitude + region.latitudeDelta / 2,
|
|
281
|
-
longitude: region.longitude + region.longitudeDelta / 2,
|
|
282
|
-
},
|
|
283
|
-
southWest: {
|
|
284
|
-
latitude: region.latitude - region.latitudeDelta / 2,
|
|
285
|
-
longitude: region.longitude - region.longitudeDelta / 2,
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
_getHandle() {
|
|
290
|
-
return (0, react_native_1.findNodeHandle)(this.map.current);
|
|
291
|
-
}
|
|
292
|
-
handleMapPress = (event) => {
|
|
293
|
-
if (this.props.onPress) {
|
|
294
|
-
this.props.onPress(event);
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
handleMarkerPress = (event) => {
|
|
298
|
-
if (this.props.onMarkerPress) {
|
|
299
|
-
this.props.onMarkerPress(event);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
handleMarkerSelect = (event) => {
|
|
303
|
-
if (this.props.onMarkerSelect) {
|
|
304
|
-
this.props.onMarkerSelect(event);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
handleKmlReady = (event) => {
|
|
308
|
-
if (this.props.onKmlReady) {
|
|
309
|
-
this.props.onKmlReady(event);
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
handleMarkerDeselect = (event) => {
|
|
313
|
-
if (this.props.onMarkerDeselect) {
|
|
314
|
-
this.props.onMarkerDeselect(event);
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
handleRegionChange = (event) => {
|
|
318
|
-
const isGesture = event.nativeEvent.isGesture;
|
|
319
|
-
const details = { isGesture };
|
|
320
|
-
if (event.nativeEvent.continuous) {
|
|
321
|
-
if (this.props.onRegionChange) {
|
|
322
|
-
this.props.onRegionChange(event.nativeEvent.region, details);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
else if (this.props.onRegionChangeComplete) {
|
|
326
|
-
this.props.onRegionChangeComplete(event.nativeEvent.region, details);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
handleRegionChangeStarted = (event) => {
|
|
330
|
-
if (this.props.onRegionChangeStart) {
|
|
331
|
-
this.props.onRegionChangeStart(event);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
handleIndoorBuildingFocused = (event) => {
|
|
335
|
-
if (this.props.onIndoorBuildingFocused) {
|
|
336
|
-
if (typeof event.nativeEvent.levels === 'string') {
|
|
337
|
-
event.nativeEvent.levels = JSON.parse(event.nativeEvent.levels);
|
|
338
|
-
}
|
|
339
|
-
this.props.onIndoorBuildingFocused(event);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
handleIndoorLevelActivated = (event) => {
|
|
343
|
-
if (this.props.onIndoorLevelActivated) {
|
|
344
|
-
this.props.onIndoorLevelActivated(event);
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
handleRegionChangeComplete = (event) => {
|
|
348
|
-
const isGesture = event.nativeEvent.isGesture;
|
|
349
|
-
const details = { isGesture };
|
|
350
|
-
if (this.props.onRegionChangeComplete) {
|
|
351
|
-
this.props.onRegionChangeComplete(event.nativeEvent.region, details);
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
render() {
|
|
355
|
-
// Define props specifically for MapFabricNativeProps
|
|
356
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
357
|
-
const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
|
|
358
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
359
|
-
const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
|
|
360
|
-
const props = {
|
|
361
|
-
onMapReady: this._onMapReady,
|
|
362
|
-
liteMode: this.props.liteMode,
|
|
363
|
-
googleMapId: this.props.googleMapId,
|
|
364
|
-
googleRenderer: this.props.googleRenderer,
|
|
365
|
-
onPress: this.handleMapPress,
|
|
366
|
-
onMarkerPress: this.handleMarkerPress,
|
|
367
|
-
onMarkerSelect: this.handleMarkerSelect,
|
|
368
|
-
onMarkerDeselect: this.handleMarkerDeselect,
|
|
369
|
-
onKmlReady: this.handleKmlReady,
|
|
370
|
-
userInterfaceStyle: userInterfaceStyle,
|
|
371
|
-
minZoom: minZoomLevel,
|
|
372
|
-
maxZoom: maxZoomLevel,
|
|
373
|
-
onRegionChange: this.handleRegionChange,
|
|
374
|
-
onRegionChangeStart: this.handleRegionChangeStarted,
|
|
375
|
-
onRegionChangeComplete: this.handleRegionChangeComplete,
|
|
376
|
-
onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
|
|
377
|
-
// @ts-ignore
|
|
378
|
-
onIndoorLevelActivated: this.handleIndoorLevelActivated,
|
|
379
|
-
...restProps,
|
|
380
|
-
};
|
|
381
|
-
if (this.props.region) {
|
|
382
|
-
props.region = {
|
|
383
|
-
latitude: this.props.region.latitude,
|
|
384
|
-
longitude: this.props.region.longitude,
|
|
385
|
-
latitudeDelta: this.props.region.latitudeDelta,
|
|
386
|
-
longitudeDelta: this.props.region.longitudeDelta,
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
if (this.state.isReady) {
|
|
390
|
-
if (props.onPanDrag) {
|
|
391
|
-
props.handlePanDrag = !!props.onPanDrag;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
props.style = this.props.style;
|
|
396
|
-
props.initialCamera = this.props.initialCamera;
|
|
397
|
-
props.onLayout = this.props.onLayout;
|
|
398
|
-
}
|
|
399
|
-
const childrenNodes = this.state.isReady ? children : null;
|
|
400
|
-
if (provider === 'google' && react_native_1.Platform.OS === 'ios') {
|
|
401
|
-
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
402
|
-
<FabricGoogleMap {...props} ref={this.fabricMap}>
|
|
403
|
-
{childrenNodes}
|
|
404
|
-
</FabricGoogleMap>
|
|
405
|
-
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
409
|
-
<FabricMap {...props} ref={this.fabricMap}>
|
|
410
|
-
{childrenNodes}
|
|
411
|
-
</FabricMap>
|
|
412
|
-
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
const airMaps = {
|
|
417
|
-
default: (0, react_native_1.requireNativeComponent)('AIRMap'),
|
|
418
|
-
google: () => null,
|
|
419
|
-
};
|
|
420
|
-
if (react_native_1.Platform.OS === 'android') {
|
|
421
|
-
airMaps.google = airMaps.default;
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
airMaps.google = (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
|
|
425
|
-
}
|
|
426
|
-
exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
|
|
427
|
-
MapView.Animated = exports.AnimatedMapView;
|
|
428
|
-
exports.default = MapView;
|
package/lib/MapView.types.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { ClickEvent, LatLng, Point, Region } from './sharedTypes';
|
|
2
|
-
import { NativeSyntheticEvent } from 'react-native';
|
|
3
|
-
export type Camera = {
|
|
4
|
-
/**
|
|
5
|
-
* Apple Maps
|
|
6
|
-
*/
|
|
7
|
-
altitude?: number;
|
|
8
|
-
center: LatLng;
|
|
9
|
-
heading: number;
|
|
10
|
-
pitch: number;
|
|
11
|
-
/**
|
|
12
|
-
* Google Maps
|
|
13
|
-
*/
|
|
14
|
-
zoom?: number;
|
|
15
|
-
};
|
|
16
|
-
export type MapStyleElement = {
|
|
17
|
-
featureType?: string;
|
|
18
|
-
elementType?: string;
|
|
19
|
-
stylers: object[];
|
|
20
|
-
};
|
|
21
|
-
export type EdgePadding = {
|
|
22
|
-
top: number;
|
|
23
|
-
right: number;
|
|
24
|
-
bottom: number;
|
|
25
|
-
left: number;
|
|
26
|
-
};
|
|
27
|
-
export type MapType = 'hybrid' | 'mutedStandard' | 'none' | 'satellite' | 'standard' | 'terrain' | 'satelliteFlyover' | 'hybridFlyover';
|
|
28
|
-
export type MapTypes = {
|
|
29
|
-
STANDARD: 'standard';
|
|
30
|
-
SATELLITE: 'satellite';
|
|
31
|
-
HYBRID: 'hybrid';
|
|
32
|
-
TERRAIN: 'terrain';
|
|
33
|
-
NONE: 'none';
|
|
34
|
-
MUTEDSTANDARD: 'mutedStandard';
|
|
35
|
-
SATELLITE_FLYOVER: 'satelliteFlyover';
|
|
36
|
-
HYBRID_FLYOVER: 'hybridFlyover';
|
|
37
|
-
};
|
|
38
|
-
export type IndoorLevel = {
|
|
39
|
-
index: number;
|
|
40
|
-
name: string;
|
|
41
|
-
shortName: string;
|
|
42
|
-
};
|
|
43
|
-
export type ActiveIndoorLevel = {
|
|
44
|
-
activeLevelIndex: number;
|
|
45
|
-
name: string;
|
|
46
|
-
shortName: string;
|
|
47
|
-
};
|
|
48
|
-
export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
|
|
49
|
-
indoorLevel: ActiveIndoorLevel;
|
|
50
|
-
}>;
|
|
51
|
-
export type IndoorBuilding = {
|
|
52
|
-
underground: boolean;
|
|
53
|
-
activeLevelIndex: number;
|
|
54
|
-
levels: IndoorLevel[];
|
|
55
|
-
};
|
|
56
|
-
export type IndoorBuildingEvent = NativeSyntheticEvent<{
|
|
57
|
-
IndoorBuilding: IndoorBuilding;
|
|
58
|
-
}>;
|
|
59
|
-
export type KmlMarker = {
|
|
60
|
-
id: string;
|
|
61
|
-
title: string;
|
|
62
|
-
description: string;
|
|
63
|
-
coordinate: LatLng;
|
|
64
|
-
position: Point;
|
|
65
|
-
};
|
|
66
|
-
export type KmlMapEvent = NativeSyntheticEvent<{
|
|
67
|
-
markers: KmlMarker[];
|
|
68
|
-
}>;
|
|
69
|
-
export type LongPressEvent = ClickEvent<{
|
|
70
|
-
/**
|
|
71
|
-
* @platform Android
|
|
72
|
-
*/
|
|
73
|
-
action?: 'long-press';
|
|
74
|
-
}>;
|
|
75
|
-
export type PanDragEvent = ClickEvent;
|
|
76
|
-
export type PoiClickEvent = NativeSyntheticEvent<{
|
|
77
|
-
placeId: string;
|
|
78
|
-
name: string;
|
|
79
|
-
coordinate: LatLng;
|
|
80
|
-
/**
|
|
81
|
-
* @platform Android
|
|
82
|
-
*/
|
|
83
|
-
position?: Point;
|
|
84
|
-
}>;
|
|
85
|
-
export type MapPressEvent = ClickEvent<{
|
|
86
|
-
/**
|
|
87
|
-
* @platform Android
|
|
88
|
-
*/
|
|
89
|
-
action?: 'press' | 'marker-press';
|
|
90
|
-
}>;
|
|
91
|
-
export type Details = {
|
|
92
|
-
isGesture?: boolean;
|
|
93
|
-
};
|
|
94
|
-
export type UserLocationChangeEvent = NativeSyntheticEvent<{
|
|
95
|
-
coordinate?: LatLng & {
|
|
96
|
-
altitude: number;
|
|
97
|
-
timestamp: number;
|
|
98
|
-
accuracy: number;
|
|
99
|
-
speed: number;
|
|
100
|
-
heading: number;
|
|
101
|
-
/**
|
|
102
|
-
* @platform iOS
|
|
103
|
-
*/
|
|
104
|
-
altitudeAccuracy?: number;
|
|
105
|
-
/**
|
|
106
|
-
* @platform Android
|
|
107
|
-
*/
|
|
108
|
-
isFromMockProvider?: boolean;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* @platform iOS
|
|
112
|
-
*/
|
|
113
|
-
error?: {
|
|
114
|
-
message: string;
|
|
115
|
-
};
|
|
116
|
-
}>;
|
|
117
|
-
export type ChangeEvent = NativeSyntheticEvent<{
|
|
118
|
-
continuous: boolean;
|
|
119
|
-
region: Region;
|
|
120
|
-
isGesture?: boolean;
|
|
121
|
-
}>;
|
|
122
|
-
export type FitToOptions = {
|
|
123
|
-
edgePadding?: EdgePadding;
|
|
124
|
-
animated?: boolean;
|
|
125
|
-
};
|
|
126
|
-
export type BoundingBox = {
|
|
127
|
-
northEast: LatLng;
|
|
128
|
-
southWest: LatLng;
|
|
129
|
-
};
|
|
130
|
-
export type SnapshotOptions = {
|
|
131
|
-
/** optional, when omitted the view-width is used */
|
|
132
|
-
width?: number;
|
|
133
|
-
/** optional, when omitted the view-height is used */
|
|
134
|
-
height?: number;
|
|
135
|
-
/** __iOS only__, optional region to render */
|
|
136
|
-
region?: Region;
|
|
137
|
-
/** image formats, defaults to 'png' */
|
|
138
|
-
format?: 'png' | 'jpg';
|
|
139
|
-
/** image quality: 0..1 (only relevant for jpg, default: 1) */
|
|
140
|
-
quality?: number;
|
|
141
|
-
/** result types, defaults to 'file' */
|
|
142
|
-
result?: 'file' | 'base64';
|
|
143
|
-
};
|
|
144
|
-
export type Address = {
|
|
145
|
-
administrativeArea: string;
|
|
146
|
-
country: string;
|
|
147
|
-
countryCode: string;
|
|
148
|
-
locality: string;
|
|
149
|
-
name: string;
|
|
150
|
-
postalCode: string;
|
|
151
|
-
subAdministrativeArea: string;
|
|
152
|
-
subLocality: string;
|
|
153
|
-
thoroughfare: string;
|
|
154
|
-
subThoroughfare?: string;
|
|
155
|
-
};
|
|
156
|
-
export type CameraZoomRange = {
|
|
157
|
-
minCenterCoordinateDistance?: number;
|
|
158
|
-
maxCenterCoordinateDistance?: number;
|
|
159
|
-
animated?: boolean;
|
|
160
|
-
};
|
|
161
|
-
export type NativeCommandName = 'animateCamera' | 'animateToRegion' | 'coordinateForPoint' | 'fitToCoordinates' | 'fitToElements' | 'fitToSuppliedMarkers' | 'getAddressFromCoordinates' | 'getCamera' | 'getMapBoundaries' | 'getMarkersFrames' | 'pointForCoordinate' | 'setCamera' | 'setIndoorActiveLevelIndex' | 'setMapBoundaries' | 'takeSnapshot';
|
package/lib/MapView.types.js
DELETED
package/lib/MapView.web.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from 'react-native-web/dist/modules/UnimplementedView';
|
package/lib/MapView.web.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
//@ts-ignore
|
|
8
|
-
var UnimplementedView_1 = require("react-native-web/dist/modules/UnimplementedView");
|
|
9
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(UnimplementedView_1).default; } });
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { HostComponent } from 'react-native';
|
|
3
|
-
import { NativeProps } from './MapView';
|
|
4
|
-
import { Camera, EdgePadding } from './MapView.types';
|
|
5
|
-
import { LatLng, Region } from './sharedTypes';
|
|
6
|
-
export type MapViewNativeComponentType = HostComponent<NativeProps>;
|
|
7
|
-
interface NativeCommands {
|
|
8
|
-
animateToRegion: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, region: Region, duration: number) => void;
|
|
9
|
-
setCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>) => void;
|
|
10
|
-
animateCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>, duration: number) => void;
|
|
11
|
-
fitToElements: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, edgePadding: EdgePadding, animated: boolean) => void;
|
|
12
|
-
fitToSuppliedMarkers: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, markers: string[], edgePadding: EdgePadding, animated: boolean) => void;
|
|
13
|
-
fitToCoordinates: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, coordinates: LatLng[], edgePadding: EdgePadding, animated: boolean) => void;
|
|
14
|
-
setMapBoundaries: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, northEast: LatLng, southWest: LatLng) => void;
|
|
15
|
-
setIndoorActiveLevelIndex: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, activeLevelIndex: number) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare const Commands: NativeCommands;
|
|
18
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Commands = void 0;
|
|
7
|
-
const codegenNativeCommands_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
|
|
8
|
-
exports.Commands = (0, codegenNativeCommands_1.default)({
|
|
9
|
-
supportedCommands: [
|
|
10
|
-
'animateToRegion',
|
|
11
|
-
'setCamera',
|
|
12
|
-
'animateCamera',
|
|
13
|
-
'fitToElements',
|
|
14
|
-
'fitToSuppliedMarkers',
|
|
15
|
-
'fitToCoordinates',
|
|
16
|
-
'setMapBoundaries',
|
|
17
|
-
'setIndoorActiveLevelIndex',
|
|
18
|
-
],
|
|
19
|
-
});
|