react-native-maps 1.23.1 → 1.23.3
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.
|
@@ -573,8 +573,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
573
573
|
LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
|
|
574
574
|
cameraLastIdleBounds = null;
|
|
575
575
|
boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
|
|
576
|
-
WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds,
|
|
577
|
-
dispatchEvent(payload,
|
|
576
|
+
WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, true, isGesture);
|
|
577
|
+
dispatchEvent(payload, OnRegionChangeEvent::new);
|
|
578
578
|
});
|
|
579
579
|
|
|
580
580
|
map.setOnCameraIdleListener(() -> {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.23.
|
|
8
|
+
"version": "1.23.3",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|
package/plugin/build/ios.js
CHANGED
|
@@ -62,7 +62,7 @@ var withMapsIOS = function (config, props) {
|
|
|
62
62
|
});
|
|
63
63
|
// Adds/Removes AppDelegate setup for Google Maps API on iOS
|
|
64
64
|
config = withGoogleMapsAppDelegate(config, {
|
|
65
|
-
apiKey: props === null || props === void 0 ? void 0 : props.iosGoogleMapsApiKey,
|
|
65
|
+
apiKey: (props === null || props === void 0 ? void 0 : props.iosGoogleMapsApiKey) || null,
|
|
66
66
|
});
|
|
67
67
|
return config;
|
|
68
68
|
};
|
package/src/createFabricMap.tsx
CHANGED
|
@@ -41,213 +41,217 @@ export interface FabricMapHandle {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
|
|
44
|
-
return forwardRef<FabricMapHandle, FabricMapViewProps>(
|
|
45
|
-
|
|
44
|
+
return forwardRef<FabricMapHandle | null, FabricMapViewProps>(
|
|
45
|
+
(props, ref) => {
|
|
46
|
+
const fabricRef = useRef<React.ElementRef<typeof ViewComponent>>(null);
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
async getCoordinateForPoint(point: Point) {
|
|
61
|
-
if (fabricRef.current) {
|
|
62
|
-
return NativeAirMapsModule.getCoordinateForPoint(
|
|
63
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
64
|
-
point,
|
|
65
|
-
);
|
|
66
|
-
} else {
|
|
67
|
-
throw new Error(
|
|
68
|
-
'getCoordinateForPoint is only supported on iOS with Fabric.',
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
async getPointForCoordinate(coordinate: LatLng) {
|
|
73
|
-
if (fabricRef.current) {
|
|
74
|
-
return NativeAirMapsModule.getPointForCoordinate(
|
|
75
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
76
|
-
coordinate,
|
|
77
|
-
);
|
|
78
|
-
} else {
|
|
79
|
-
throw new Error(
|
|
80
|
-
'getPointForCoordinate is not supported on this platform.',
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
async getAddressFromCoordinates(coordinate: LatLng) {
|
|
85
|
-
if (fabricRef.current) {
|
|
86
|
-
return NativeAirMapsModule.getAddressFromCoordinates(
|
|
87
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
88
|
-
coordinate,
|
|
89
|
-
);
|
|
90
|
-
} else {
|
|
91
|
-
throw new Error(
|
|
92
|
-
'getAddressFromCoordinates is not supported on this platform',
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
async takeSnapshot(config: SnapshotOptions) {
|
|
97
|
-
if (fabricRef.current) {
|
|
98
|
-
return NativeAirMapsModule.takeSnapshot(
|
|
99
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
100
|
-
JSON.stringify(config),
|
|
101
|
-
);
|
|
102
|
-
} else {
|
|
103
|
-
throw new Error('takeSnapshot is only supported on iOS with Fabric.');
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
async getCamera() {
|
|
107
|
-
if (fabricRef.current) {
|
|
108
|
-
return NativeAirMapsModule.getCamera(
|
|
109
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
110
|
-
);
|
|
111
|
-
} else {
|
|
112
|
-
throw new Error('getCamera is only supported on iOS with Fabric.');
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
async getMapBoundaries() {
|
|
116
|
-
if (fabricRef.current) {
|
|
117
|
-
return NativeAirMapsModule.getMapBoundaries(
|
|
118
|
-
findNodeHandle(fabricRef.current) ?? -1,
|
|
119
|
-
);
|
|
120
|
-
} else {
|
|
121
|
-
throw new Error(
|
|
122
|
-
'getMapBoundaries is only supported on iOS with Fabric.',
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
animateToRegion(region: Region, duration: number) {
|
|
127
|
-
if (fabricRef.current) {
|
|
128
|
-
try {
|
|
129
|
-
Commands.animateToRegion(
|
|
130
|
-
fabricRef.current,
|
|
131
|
-
JSON.stringify(region),
|
|
132
|
-
duration,
|
|
133
|
-
);
|
|
134
|
-
} catch (error) {
|
|
135
|
-
throw new Error('Failed to animateToRegion');
|
|
48
|
+
useImperativeHandle(ref, () => ({
|
|
49
|
+
async getMarkersFrames(onlyVisible: boolean) {
|
|
50
|
+
if (fabricRef.current) {
|
|
51
|
+
return NativeAirMapsModule.getMarkersFrames(
|
|
52
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
53
|
+
onlyVisible,
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
throw new Error(
|
|
57
|
+
'getMarkersFrames is only supported on iOS with Fabric.',
|
|
58
|
+
);
|
|
136
59
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
JSON.stringify(edgePadding),
|
|
149
|
-
animated,
|
|
150
|
-
);
|
|
151
|
-
} catch (error) {
|
|
152
|
-
throw new Error('Failed to fitToElements');
|
|
60
|
+
},
|
|
61
|
+
async getCoordinateForPoint(point: Point) {
|
|
62
|
+
if (fabricRef.current) {
|
|
63
|
+
return NativeAirMapsModule.getCoordinateForPoint(
|
|
64
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
65
|
+
point,
|
|
66
|
+
);
|
|
67
|
+
} else {
|
|
68
|
+
throw new Error(
|
|
69
|
+
'getCoordinateForPoint is only supported on iOS with Fabric.',
|
|
70
|
+
);
|
|
153
71
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (fabricRef.current) {
|
|
166
|
-
try {
|
|
167
|
-
Commands.fitToSuppliedMarkers(
|
|
168
|
-
fabricRef.current,
|
|
169
|
-
JSON.stringify(markers),
|
|
170
|
-
JSON.stringify(edgePadding),
|
|
171
|
-
animated,
|
|
172
|
-
);
|
|
173
|
-
} catch (error) {
|
|
174
|
-
throw new Error('Failed to fitToSuppliedMarkers');
|
|
72
|
+
},
|
|
73
|
+
async getPointForCoordinate(coordinate: LatLng) {
|
|
74
|
+
if (fabricRef.current) {
|
|
75
|
+
return NativeAirMapsModule.getPointForCoordinate(
|
|
76
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
77
|
+
coordinate,
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
throw new Error(
|
|
81
|
+
'getPointForCoordinate is not supported on this platform.',
|
|
82
|
+
);
|
|
175
83
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
84
|
+
},
|
|
85
|
+
async getAddressFromCoordinates(coordinate: LatLng) {
|
|
86
|
+
if (fabricRef.current) {
|
|
87
|
+
return NativeAirMapsModule.getAddressFromCoordinates(
|
|
88
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
89
|
+
coordinate,
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
throw new Error(
|
|
93
|
+
'getAddressFromCoordinates is not supported on this platform',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
async takeSnapshot(config: SnapshotOptions) {
|
|
98
|
+
if (fabricRef.current) {
|
|
99
|
+
return NativeAirMapsModule.takeSnapshot(
|
|
100
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
101
|
+
JSON.stringify(config),
|
|
102
|
+
);
|
|
103
|
+
} else {
|
|
104
|
+
throw new Error(
|
|
105
|
+
'takeSnapshot is only supported on iOS with Fabric.',
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
async getCamera() {
|
|
110
|
+
if (fabricRef.current) {
|
|
111
|
+
return NativeAirMapsModule.getCamera(
|
|
112
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
113
|
+
);
|
|
114
|
+
} else {
|
|
115
|
+
throw new Error('getCamera is only supported on iOS with Fabric.');
|
|
192
116
|
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
117
|
+
},
|
|
118
|
+
async getMapBoundaries() {
|
|
119
|
+
if (fabricRef.current) {
|
|
120
|
+
return NativeAirMapsModule.getMapBoundaries(
|
|
121
|
+
findNodeHandle(fabricRef.current) ?? -1,
|
|
122
|
+
);
|
|
123
|
+
} else {
|
|
124
|
+
throw new Error(
|
|
125
|
+
'getMapBoundaries is only supported on iOS with Fabric.',
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
animateToRegion(region: Region, duration: number) {
|
|
130
|
+
if (fabricRef.current) {
|
|
131
|
+
try {
|
|
132
|
+
Commands.animateToRegion(
|
|
133
|
+
fabricRef.current,
|
|
134
|
+
JSON.stringify(region),
|
|
135
|
+
duration,
|
|
136
|
+
);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
throw new Error('Failed to animateToRegion');
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
throw new Error(
|
|
142
|
+
'animateToRegion is only supported on iOS with Fabric.',
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
fitToElements(edgePadding: EdgePadding, animated: boolean) {
|
|
147
|
+
if (fabricRef.current) {
|
|
148
|
+
try {
|
|
149
|
+
Commands.fitToElements(
|
|
150
|
+
fabricRef.current,
|
|
151
|
+
JSON.stringify(edgePadding),
|
|
152
|
+
animated,
|
|
153
|
+
);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
throw new Error('Failed to fitToElements');
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
throw new Error(
|
|
159
|
+
'fitToElements is only supported on iOS with Fabric.',
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
fitToSuppliedMarkers(
|
|
164
|
+
markers: string[],
|
|
165
|
+
edgePadding: EdgePadding,
|
|
166
|
+
animated: boolean,
|
|
167
|
+
) {
|
|
168
|
+
if (fabricRef.current) {
|
|
169
|
+
try {
|
|
170
|
+
Commands.fitToSuppliedMarkers(
|
|
171
|
+
fabricRef.current,
|
|
172
|
+
JSON.stringify(markers),
|
|
173
|
+
JSON.stringify(edgePadding),
|
|
174
|
+
animated,
|
|
175
|
+
);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
throw new Error('Failed to fitToSuppliedMarkers');
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
throw new Error(
|
|
181
|
+
'fitToSuppliedMarkers is only supported on iOS with Fabric.',
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
animateCamera(camera: Partial<Camera>, duration: number) {
|
|
186
|
+
if (fabricRef.current) {
|
|
187
|
+
try {
|
|
188
|
+
Commands.animateCamera(
|
|
189
|
+
fabricRef.current,
|
|
190
|
+
JSON.stringify(camera),
|
|
191
|
+
duration,
|
|
192
|
+
);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
throw new Error('Failed to animateCamera');
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
throw new Error(
|
|
198
|
+
'animateCamera is only supported on iOS with Fabric.',
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
fitToCoordinates(
|
|
203
|
+
coordinates: LatLng[],
|
|
204
|
+
edgePadding: EdgePadding,
|
|
205
|
+
animated: boolean,
|
|
206
|
+
) {
|
|
207
|
+
if (fabricRef.current) {
|
|
208
|
+
try {
|
|
209
|
+
Commands.fitToCoordinates(
|
|
210
|
+
fabricRef.current,
|
|
211
|
+
JSON.stringify(coordinates),
|
|
212
|
+
JSON.stringify(edgePadding),
|
|
213
|
+
animated,
|
|
214
|
+
);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
throw new Error('Failed to fitToCoordinates');
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
throw new Error(
|
|
220
|
+
'fitToCoordinates is only supported on iOS with Fabric.',
|
|
221
|
+
);
|
|
214
222
|
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
);
|
|
228
|
-
} catch (error) {
|
|
229
|
-
console.error('Failed to set camera:', error);
|
|
223
|
+
},
|
|
224
|
+
setIndoorActiveLevelIndex(activeLevelIndex: number) {
|
|
225
|
+
if (fabricRef.current) {
|
|
226
|
+
try {
|
|
227
|
+
Commands.setIndoorActiveLevelIndex(
|
|
228
|
+
fabricRef.current,
|
|
229
|
+
activeLevelIndex,
|
|
230
|
+
);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error('Failed to set camera:', error);
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
console.warn('setIndoorActiveLevelIndex is not supported.');
|
|
230
236
|
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
console.
|
|
237
|
+
},
|
|
238
|
+
setCamera(camera: Partial<Camera>) {
|
|
239
|
+
if (fabricRef.current) {
|
|
240
|
+
try {
|
|
241
|
+
Commands.setCamera(fabricRef.current, JSON.stringify(camera));
|
|
242
|
+
} catch (error) {
|
|
243
|
+
console.error('Failed to set camera:', error);
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
console.warn('setCamera is not supported');
|
|
241
247
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
}));
|
|
248
|
+
},
|
|
249
|
+
}));
|
|
247
250
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
return <ViewComponent {...props} ref={fabricRef} />;
|
|
253
|
+
},
|
|
254
|
+
);
|
|
251
255
|
};
|
|
252
256
|
|
|
253
257
|
export default createFabricMap;
|
|
@@ -126,8 +126,12 @@ export default function decorateMapComponent<Type extends Component>(
|
|
|
126
126
|
return components[key];
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
if (!provider) {
|
|
130
|
+
throw new Error('react-native-maps: provider is not set');
|
|
131
|
+
}
|
|
132
|
+
|
|
130
133
|
const providerInfo = providers[provider];
|
|
134
|
+
|
|
131
135
|
// quick fix. Previous code assumed android | ios
|
|
132
136
|
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
|
|
133
137
|
throw new Error(`react-native-maps doesn't support ${Platform.OS}`);
|