react-native-maps 1.0.0-beta.4 → 1.0.0-beta.7
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/README.md
CHANGED
|
@@ -114,7 +114,7 @@ import { Marker } from 'react-native-maps';
|
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
### Rendering a Marker with a custom image
|
|
117
|
-
1. You need to generate an `png` image with various resolution (lets call them `custom_pin`) - for more information go to [Android](https://developer.android.com/studio/write/image-asset-studio#access), [iOS](https://developer.apple.com/
|
|
117
|
+
1. You need to generate an `png` image with various resolution (lets call them `custom_pin`) - for more information go to [Android](https://developer.android.com/studio/write/image-asset-studio#access), [iOS](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project)
|
|
118
118
|
2. put all images in Android drawables and iOS assets dir
|
|
119
119
|
3. Now you can use the following code:
|
|
120
120
|
```jsx
|
|
@@ -64,6 +64,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
64
64
|
MKCoordinateRegion _region;
|
|
65
65
|
BOOL _initialRegionSet;
|
|
66
66
|
BOOL _initialCameraSet;
|
|
67
|
+
BOOL _didLayoutSubviews;
|
|
67
68
|
BOOL _didPrepareMap;
|
|
68
69
|
BOOL _didCallOnMapReady;
|
|
69
70
|
BOOL _zoomTapEnabled;
|
|
@@ -86,6 +87,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
86
87
|
_region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.0, 0.0));
|
|
87
88
|
_initialRegionSet = false;
|
|
88
89
|
_initialCameraSet = false;
|
|
90
|
+
_didLayoutSubviews = false;
|
|
89
91
|
_didPrepareMap = false;
|
|
90
92
|
_didCallOnMapReady = false;
|
|
91
93
|
_zoomTapEnabled = YES;
|
|
@@ -247,9 +249,28 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
247
249
|
];
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
- (void)layoutSubviews {
|
|
253
|
+
[super layoutSubviews];
|
|
254
|
+
if(_didLayoutSubviews) return;
|
|
255
|
+
_didLayoutSubviews = true;
|
|
256
|
+
|
|
257
|
+
if (_initialCamera != nil) {
|
|
258
|
+
self.camera = _initialCamera;
|
|
259
|
+
_initialCameraSet = true;
|
|
260
|
+
}
|
|
261
|
+
else if (_initialRegion.span.latitudeDelta != 0.0 &&
|
|
262
|
+
_initialRegion.span.longitudeDelta != 0.0) {
|
|
263
|
+
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_initialRegion];
|
|
264
|
+
_initialRegionSet = true;
|
|
265
|
+
} else if (_region.span.latitudeDelta != 0.0 &&
|
|
266
|
+
_region.span.longitudeDelta != 0.0) {
|
|
267
|
+
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_region];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
250
271
|
- (void)setInitialRegion:(MKCoordinateRegion)initialRegion {
|
|
251
272
|
_initialRegion = initialRegion;
|
|
252
|
-
if(!_initialRegionSet &&
|
|
273
|
+
if(!_initialRegionSet && _didLayoutSubviews){
|
|
253
274
|
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:initialRegion];
|
|
254
275
|
_initialRegionSet = true;
|
|
255
276
|
}
|
|
@@ -257,7 +278,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
257
278
|
|
|
258
279
|
- (void)setInitialCamera:(GMSCameraPosition*)initialCamera {
|
|
259
280
|
_initialCamera = initialCamera;
|
|
260
|
-
if(!_initialCameraSet &&
|
|
281
|
+
if(!_initialCameraSet && _didLayoutSubviews){
|
|
261
282
|
self.camera = initialCamera;
|
|
262
283
|
_initialCameraSet = true;
|
|
263
284
|
}
|
|
@@ -266,7 +287,9 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
266
287
|
- (void)setRegion:(MKCoordinateRegion)region {
|
|
267
288
|
// TODO: The JS component is repeatedly setting region unnecessarily. We might want to deal with that in here.
|
|
268
289
|
_region = region;
|
|
269
|
-
|
|
290
|
+
if(_didLayoutSubviews) {
|
|
291
|
+
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:region];
|
|
292
|
+
}
|
|
270
293
|
}
|
|
271
294
|
|
|
272
295
|
- (void)setCameraProp:(GMSCameraPosition*)camera {
|
|
@@ -286,17 +309,6 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
286
309
|
UIView* mapView = [self valueForKey:@"mapView"]; //GMSVectorMapView
|
|
287
310
|
[self overrideGestureRecognizersForView:mapView];
|
|
288
311
|
|
|
289
|
-
if(!_didPrepareMap && !_initialRegionSet && !_initialCameraSet){
|
|
290
|
-
if(_initialRegion.span.latitudeDelta != 0.0 && _initialRegion.span.longitudeDelta != 0.0){
|
|
291
|
-
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_initialRegion];
|
|
292
|
-
_initialRegionSet = true;
|
|
293
|
-
} else if(_initialCamera != nil) {
|
|
294
|
-
self.camera = _initialCamera;
|
|
295
|
-
_initialCameraSet = true;
|
|
296
|
-
} else if(_region.span.latitudeDelta != 0.0 && _region.span.longitudeDelta != 0.0) {
|
|
297
|
-
self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_region];
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
312
|
if (!_didCallOnMapReady && self.onMapReady) {
|
|
301
313
|
self.onMapReady(@{});
|
|
302
314
|
_didCallOnMapReady = true;
|
|
@@ -326,6 +326,12 @@ CGRect unionRect(CGRect a, CGRect b) {
|
|
|
326
326
|
_reloadImageCancellationBlock = nil;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
if (!_realMarker.icon) {
|
|
330
|
+
// prevent glitch with marker (cf. https://github.com/react-native-maps/react-native-maps/issues/3657)
|
|
331
|
+
UIImage *emptyImage = [[UIImage alloc] init];
|
|
332
|
+
_realMarker.icon = emptyImage;
|
|
333
|
+
}
|
|
334
|
+
|
|
329
335
|
_reloadImageCancellationBlock =
|
|
330
336
|
[[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[RCTConvert NSURLRequest:_iconSrc]
|
|
331
337
|
size:self.bounds.size
|
package/lib/MapView.d.ts
CHANGED
|
@@ -386,7 +386,7 @@ export declare type MapViewProps = ViewProps & {
|
|
|
386
386
|
* @platform iOS: Not supported
|
|
387
387
|
* @platform Android: Supported
|
|
388
388
|
*/
|
|
389
|
-
|
|
389
|
+
showsBuildings?: boolean;
|
|
390
390
|
/**
|
|
391
391
|
* If `false` compass won't be displayed on the map.
|
|
392
392
|
*
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React Native Mapview component for iOS + Android",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
6
|
-
"version": "1.0.0-beta.
|
|
6
|
+
"version": "1.0.0-beta.7",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"lint": "eslint . --max-warnings 0",
|