react-native-maps 1.23.2 → 1.23.4

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/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.2",
8
+ "version": "1.23.4",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
@@ -25,8 +25,6 @@
25
25
  "ios",
26
26
  "app.plugin.js",
27
27
  "plugin/build",
28
- "react-native-maps-generated.podspec",
29
- "react-native-google-maps.podspec",
30
28
  "react-native-maps.podspec",
31
29
  "react-native.config.js",
32
30
  "!android/build",
@@ -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
  };
@@ -111,14 +111,14 @@ function removeGoogleMapsAppDelegateInit(src) {
111
111
  exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
112
112
  /**
113
113
  * @param src The contents of the Podfile.
114
+ * @param useGoogleMaps if GoogleMaps for iOS is used
114
115
  * @returns Podfile with react-native-maps integration configured.
115
116
  */
116
117
  function addMapsCocoapods(src, useGoogleMaps) {
117
118
  var newSrc = ' rn_maps_path = File.dirname(`node --print "require.resolve(\'react-native-maps/package.json\')"`) \n';
118
119
  if (useGoogleMaps) {
119
- newSrc += " pod 'react-native-google-maps', :path => rn_maps_path \n";
120
+ newSrc += " pod 'react-native-maps/Google', :path => rn_maps_path \n";
120
121
  }
121
- newSrc += " pod 'react-native-maps-generated', :path => rn_maps_path \n";
122
122
  return (0, generateCode_1.mergeContents)({
123
123
  tag: 'react-native-maps',
124
124
  src: src,
@@ -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>((props, ref) => {
45
- const fabricRef = useRef<React.ElementRef<typeof ViewComponent>>(null);
44
+ return forwardRef<FabricMapHandle | null, FabricMapViewProps>(
45
+ (props, ref) => {
46
+ const fabricRef = useRef<React.ElementRef<typeof ViewComponent>>(null);
46
47
 
47
- useImperativeHandle(ref, () => ({
48
- async getMarkersFrames(onlyVisible: boolean) {
49
- if (fabricRef.current) {
50
- return NativeAirMapsModule.getMarkersFrames(
51
- findNodeHandle(fabricRef.current) ?? -1,
52
- onlyVisible,
53
- );
54
- } else {
55
- throw new Error(
56
- 'getMarkersFrames is only supported on iOS with Fabric.',
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
- } else {
138
- throw new Error(
139
- 'animateToRegion is only supported on iOS with Fabric.',
140
- );
141
- }
142
- },
143
- fitToElements(edgePadding: EdgePadding, animated: boolean) {
144
- if (fabricRef.current) {
145
- try {
146
- Commands.fitToElements(
147
- fabricRef.current,
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
- } else {
155
- throw new Error(
156
- 'fitToElements is only supported on iOS with Fabric.',
157
- );
158
- }
159
- },
160
- fitToSuppliedMarkers(
161
- markers: string[],
162
- edgePadding: EdgePadding,
163
- animated: boolean,
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
- } else {
177
- throw new Error(
178
- 'fitToSuppliedMarkers is only supported on iOS with Fabric.',
179
- );
180
- }
181
- },
182
- animateCamera(camera: Partial<Camera>, duration: number) {
183
- if (fabricRef.current) {
184
- try {
185
- Commands.animateCamera(
186
- fabricRef.current,
187
- JSON.stringify(camera),
188
- duration,
189
- );
190
- } catch (error) {
191
- throw new Error('Failed to animateCamera');
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
- } else {
194
- throw new Error(
195
- 'animateCamera is only supported on iOS with Fabric.',
196
- );
197
- }
198
- },
199
- fitToCoordinates(
200
- coordinates: LatLng[],
201
- edgePadding: EdgePadding,
202
- animated: boolean,
203
- ) {
204
- if (fabricRef.current) {
205
- try {
206
- Commands.fitToCoordinates(
207
- fabricRef.current,
208
- JSON.stringify(coordinates),
209
- JSON.stringify(edgePadding),
210
- animated,
211
- );
212
- } catch (error) {
213
- throw new Error('Failed to fitToCoordinates');
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
- } else {
216
- throw new Error(
217
- 'fitToCoordinates is only supported on iOS with Fabric.',
218
- );
219
- }
220
- },
221
- setIndoorActiveLevelIndex(activeLevelIndex: number) {
222
- if (fabricRef.current) {
223
- try {
224
- Commands.setIndoorActiveLevelIndex(
225
- fabricRef.current,
226
- activeLevelIndex,
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
- } else {
232
- console.warn('setIndoorActiveLevelIndex is not supported.');
233
- }
234
- },
235
- setCamera(camera: Partial<Camera>) {
236
- if (fabricRef.current) {
237
- try {
238
- Commands.setCamera(fabricRef.current, JSON.stringify(camera));
239
- } catch (error) {
240
- console.error('Failed to set camera:', error);
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
- } else {
243
- console.warn('setCamera is not supported');
244
- }
245
- },
246
- }));
248
+ },
249
+ }));
247
250
 
248
- // @ts-ignore
249
- return <ViewComponent {...props} ref={fabricRef} />;
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
- // @ts-ignore
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}`);