react-native-maps 1.18.1 → 1.18.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.
- package/README.md +3 -36
- package/ios/AirGoogleMaps/AIRGoogleMap.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMap.m +23 -13
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +14 -5
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +1 -9
- package/ios/AirMaps/AIRMap.m +71 -72
- package/ios/AirMaps/AIRMapMarker.m +1 -1
- package/lib/MapView.d.ts +1 -1
- package/package.json +1 -1
- package/react-native-google-maps.podspec +3 -3
package/README.md
CHANGED
|
@@ -302,43 +302,10 @@ render() {
|
|
|
302
302
|
}
|
|
303
303
|
```
|
|
304
304
|
|
|
305
|
-
### Customizing the map style
|
|
305
|
+
### Customizing the map style (Google Maps Only)
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```jsx
|
|
310
|
-
// The generated json object
|
|
311
|
-
mapStyle = [ ... ]
|
|
312
|
-
|
|
313
|
-
render() {
|
|
314
|
-
return (
|
|
315
|
-
<MapView
|
|
316
|
-
region={this.state.region}
|
|
317
|
-
onRegionChange={this.onRegionChange}
|
|
318
|
-
customMapStyle={mapStyle}
|
|
319
|
-
/>
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
For iOS, in addition to providing the `mapStyle` you will need to do the following
|
|
325
|
-
|
|
326
|
-
```jsx
|
|
327
|
-
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps'
|
|
328
|
-
|
|
329
|
-
// ...
|
|
330
|
-
|
|
331
|
-
<MapView
|
|
332
|
-
provider={PROVIDER_GOOGLE}
|
|
333
|
-
customMapStyle={MapStyle}
|
|
334
|
-
>
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Then add the AirGoogleMaps directory:
|
|
338
|
-
|
|
339
|
-
https://github.com/react-native-maps/react-native-maps/blob/1e71a21f39e7b88554852951f773c731c94680c9/docs/installation.md#ios
|
|
340
|
-
|
|
341
|
-
An unofficial step-by-step guide is also available at https://gist.github.com/heron2014/e60fa003e9b117ce80d56bb1d5bfe9e0
|
|
307
|
+
The `<MapView provider="google" googleMapId="yourStyledMapId" />` Google Maps on iOS and Android supports styling via google cloud platform, the styled maps are published under a googleMapId, by simply setting the property googleMapId to the MapView you can use that styled map
|
|
308
|
+
more info here: [google map id](https://developers.google.com/maps/documentation/get-map-id)
|
|
342
309
|
|
|
343
310
|
### MapView Events
|
|
344
311
|
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
+ (GMSCameraPosition*)makeGMSCameraPositionFromMap:(GMSMapView *)map andMKCoordinateRegion:(MKCoordinateRegion)region;
|
|
82
82
|
|
|
83
83
|
- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
|
|
84
|
-
- (instancetype)
|
|
84
|
+
- (instancetype)initWithMapId:(NSString *)mapId initialCamera:(GMSCameraPosition*) camera backgroundColor:(UIColor *) backgroundColor andZoomTapEnabled:(BOOL)zoomTapEnabled;
|
|
85
85
|
@end
|
|
86
86
|
|
|
87
87
|
#endif
|
|
@@ -71,17 +71,22 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
71
71
|
NSString* _googleMapId;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
- (instancetype)initWithMapId:(NSString *)mapId andZoomTapEnabled:(BOOL)zoomTapEnabled
|
|
74
|
+
- (instancetype)initWithMapId:(NSString *)mapId initialCamera:(GMSCameraPosition*) camera backgroundColor:(UIColor *) backgroundColor andZoomTapEnabled:(BOOL)zoomTapEnabled
|
|
75
75
|
{
|
|
76
|
+
GMSMapViewOptions* options = [[GMSMapViewOptions alloc] init];
|
|
77
|
+
|
|
76
78
|
if (mapId){
|
|
77
79
|
GMSMapID *mapID = [GMSMapID mapIDWithIdentifier:mapId];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
80
|
+
[options setMapID:mapID];
|
|
81
|
+
}
|
|
82
|
+
if (backgroundColor){
|
|
83
|
+
[options setBackgroundColor:backgroundColor];
|
|
84
|
+
}
|
|
85
|
+
if (camera){
|
|
86
|
+
[options setCamera:camera];
|
|
84
87
|
}
|
|
88
|
+
self = [super initWithOptions:options];
|
|
89
|
+
|
|
85
90
|
if (self) {
|
|
86
91
|
_reactSubviews = [NSMutableArray new];
|
|
87
92
|
_markers = [NSMutableArray array];
|
|
@@ -116,7 +121,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
- (instancetype) init {
|
|
119
|
-
return [self initWithMapId:nil andZoomTapEnabled:YES];
|
|
124
|
+
return [self initWithMapId:nil initialCamera:nil backgroundColor:nil andZoomTapEnabled:YES];
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
- (void)dealloc {
|
|
@@ -324,8 +329,9 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
324
329
|
}
|
|
325
330
|
|
|
326
331
|
- (void)didPrepareMap {
|
|
327
|
-
|
|
328
|
-
|
|
332
|
+
if (!_didPrepareMap){
|
|
333
|
+
[self overrideGestureRecognizersForView];
|
|
334
|
+
}
|
|
329
335
|
|
|
330
336
|
if (!_didCallOnMapReady && self.onMapReady) {
|
|
331
337
|
self.onMapReady(@{});
|
|
@@ -716,8 +722,8 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
716
722
|
|
|
717
723
|
#pragma mark - Overrides for Callout behavior
|
|
718
724
|
|
|
719
|
-
-(void)overrideGestureRecognizersForView
|
|
720
|
-
NSArray* grs =
|
|
725
|
+
-(void)overrideGestureRecognizersForView {
|
|
726
|
+
NSArray* grs = self.gestureRecognizers;
|
|
721
727
|
for (UIGestureRecognizer* gestureRecognizer in grs) {
|
|
722
728
|
NSNumber* grHash = [NSNumber numberWithUnsignedInteger:gestureRecognizer.hash];
|
|
723
729
|
if([self.origGestureRecognizersMeta objectForKey:grHash] != nil)
|
|
@@ -737,7 +743,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
737
743
|
}];
|
|
738
744
|
}
|
|
739
745
|
if (isZoomTapGesture && self.zoomTapEnabled == NO) {
|
|
740
|
-
[
|
|
746
|
+
[self removeGestureRecognizer:gestureRecognizer];
|
|
741
747
|
continue;
|
|
742
748
|
}
|
|
743
749
|
|
|
@@ -1012,6 +1018,10 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1012
1018
|
}
|
|
1013
1019
|
});
|
|
1014
1020
|
}
|
|
1021
|
+
// do nothing, passed as options on initialization
|
|
1022
|
+
- (void)setLoadingBackgroundColor:(UIColor *)loadingBackgroundColor {
|
|
1023
|
+
|
|
1024
|
+
}
|
|
1015
1025
|
|
|
1016
1026
|
|
|
1017
1027
|
@end
|
|
@@ -45,9 +45,11 @@ RCT_EXPORT_MODULE()
|
|
|
45
45
|
|
|
46
46
|
- (UIView *)view
|
|
47
47
|
{
|
|
48
|
-
[GMSServices setMetalRendererEnabled:YES];
|
|
49
48
|
NSString* googleMapId = nil;
|
|
50
49
|
BOOL zoomTapEnabled = YES;
|
|
50
|
+
UIColor* backgroundColor = nil;
|
|
51
|
+
GMSCameraPosition* camera = nil;
|
|
52
|
+
|
|
51
53
|
if (self.initialProps){
|
|
52
54
|
if (self.initialProps[@"googleMapId"]){
|
|
53
55
|
googleMapId = self.initialProps[@"googleMapId"];
|
|
@@ -55,8 +57,14 @@ RCT_EXPORT_MODULE()
|
|
|
55
57
|
if (self.initialProps[@"zoomTapEnabled"]){
|
|
56
58
|
zoomTapEnabled = self.initialProps[@"zoomTapEnabled"];
|
|
57
59
|
}
|
|
60
|
+
if (self.initialProps[@"loadingBackgroundColor"]){
|
|
61
|
+
backgroundColor = [RCTConvert UIColor:self.initialProps[@"loadingBackgroundColor"]];
|
|
62
|
+
}
|
|
63
|
+
if (self.initialProps[@"initialCamera"]){
|
|
64
|
+
camera = [RCTConvert GMSCameraPositionWithDefaults:self.initialProps[@"initialCamera"] existingCamera:nil];
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
|
-
AIRGoogleMap *map = [[AIRGoogleMap alloc] initWithMapId:googleMapId andZoomTapEnabled:zoomTapEnabled];
|
|
67
|
+
AIRGoogleMap *map = [[AIRGoogleMap alloc] initWithMapId:googleMapId initialCamera:camera backgroundColor:backgroundColor andZoomTapEnabled:zoomTapEnabled];
|
|
60
68
|
map.bridge = self.bridge;
|
|
61
69
|
map.delegate = self;
|
|
62
70
|
map.isAccessibilityElement = NO;
|
|
@@ -118,6 +126,7 @@ RCT_EXPORT_VIEW_PROPERTY(mapType, GMSMapViewType)
|
|
|
118
126
|
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
|
|
119
127
|
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
|
|
120
128
|
RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
|
|
129
|
+
RCT_EXPORT_VIEW_PROPERTY(loadingBackgroundColor, UIColor)
|
|
121
130
|
|
|
122
131
|
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
123
132
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
@@ -214,16 +223,16 @@ RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)reactTag
|
|
|
214
223
|
|
|
215
224
|
for (AIRGoogleMapMarker *marker in mapView.markers)
|
|
216
225
|
bounds = [bounds includingCoordinate:marker.realMarker.position];
|
|
217
|
-
|
|
226
|
+
|
|
218
227
|
GMSCameraUpdate* cameraUpdate;
|
|
219
|
-
|
|
228
|
+
|
|
220
229
|
if ([edgePadding count] != 0) {
|
|
221
230
|
// Set Map viewport
|
|
222
231
|
CGFloat top = [RCTConvert CGFloat:edgePadding[@"top"]];
|
|
223
232
|
CGFloat right = [RCTConvert CGFloat:edgePadding[@"right"]];
|
|
224
233
|
CGFloat bottom = [RCTConvert CGFloat:edgePadding[@"bottom"]];
|
|
225
234
|
CGFloat left = [RCTConvert CGFloat:edgePadding[@"left"]];
|
|
226
|
-
|
|
235
|
+
|
|
227
236
|
cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)];
|
|
228
237
|
} else {
|
|
229
238
|
cameraUpdate = [GMSCameraUpdate fitBounds:bounds withPadding:55.0f];
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
if (!coordinates || coordinates.count == 0)
|
|
34
34
|
{
|
|
35
|
-
|
|
35
|
+
[path removeAllCoordinates];
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -40,14 +40,6 @@
|
|
|
40
40
|
[path addCoordinate:coordinates[i].coordinate];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (!_originalMap) {
|
|
44
|
-
_originalMap = _polyline.map; // Store the original map
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!_polyline.map) {
|
|
48
|
-
_polyline.map = _originalMap;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
_polyline.path = path;
|
|
52
44
|
|
|
53
45
|
[self configureStyleSpansIfNeeded];
|
package/ios/AirMaps/AIRMap.m
CHANGED
|
@@ -51,7 +51,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
51
51
|
UIView *_legalLabel;
|
|
52
52
|
BOOL _initialRegionSet;
|
|
53
53
|
BOOL _initialCameraSet;
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
// Array to manually track RN subviews
|
|
56
56
|
//
|
|
57
57
|
// AIRMap implicitly creates subviews that aren't regular RN children
|
|
@@ -69,7 +69,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
69
69
|
if ((self = [super init])) {
|
|
70
70
|
_hasStartedRendering = NO;
|
|
71
71
|
_reactSubviews = [NSMutableArray new];
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
// Find Apple link label
|
|
74
74
|
for (UIView *subview in self.subviews) {
|
|
75
75
|
if ([NSStringFromClass(subview.class) isEqualToString:@"MKAttributionLabel"]) {
|
|
@@ -79,12 +79,12 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
// 3rd-party callout view for MapKit that has more options than the built-in. It's painstakingly built to
|
|
84
84
|
// be identical to the built-in callout view (which has a private API)
|
|
85
85
|
self.calloutView = [SMCalloutView platformCalloutView];
|
|
86
86
|
self.calloutView.delegate = self;
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
self.minZoomLevel = 0;
|
|
89
89
|
self.maxZoomLevel = AIRMapMaxZoomLevel;
|
|
90
90
|
self.compassOffset = CGPointMake(0, 0);
|
|
@@ -132,7 +132,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
132
132
|
} else {
|
|
133
133
|
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
134
134
|
for (int i = 0; i < childSubviews.count; i++) {
|
|
135
|
-
|
|
135
|
+
[self insertReactSubview:(UIView *)childSubviews[i] atIndex:atIndex];
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
[_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
|
|
@@ -163,7 +163,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
163
163
|
} else {
|
|
164
164
|
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
165
165
|
for (int i = 0; i < childSubviews.count; i++) {
|
|
166
|
-
|
|
166
|
+
[self removeReactSubview:(UIView *)childSubviews[i]];
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
[_reactSubviews removeObject:(UIView *)subview];
|
|
@@ -173,7 +173,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
173
173
|
#pragma clang diagnostic push
|
|
174
174
|
#pragma clang diagnostic ignored "-Wobjc-missing-super-calls"
|
|
175
175
|
- (NSArray<id<RCTComponent>> *)reactSubviews {
|
|
176
|
-
|
|
176
|
+
return _reactSubviews;
|
|
177
177
|
}
|
|
178
178
|
#pragma clang diagnostic pop
|
|
179
179
|
|
|
@@ -212,15 +212,15 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
212
212
|
CGRect frame = [self frameForMarker:mrkAnn];
|
|
213
213
|
CGPoint point = [self convertCoordinate:mrkAnn.coordinate toPointToView:self];
|
|
214
214
|
NSDictionary* frameDict = @{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
@"x": @(frame.origin.x),
|
|
216
|
+
@"y": @(frame.origin.y),
|
|
217
|
+
@"width": @(frame.size.width),
|
|
218
|
+
@"height": @(frame.size.height)
|
|
219
|
+
};
|
|
220
220
|
NSDictionary* pointDict = @{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
@"x": @(point.x),
|
|
222
|
+
@"y": @(point.y)
|
|
223
|
+
};
|
|
224
224
|
NSString* k = mrkAnn.identifier;
|
|
225
225
|
BOOL isVisible = CGRectIntersectsRect(self.bounds, frame);
|
|
226
226
|
if (k != nil && (!onlyVisible || isVisible)) {
|
|
@@ -257,7 +257,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
257
257
|
// Allow touches to be sent to our calloutview.
|
|
258
258
|
// See this for some discussion of why we need to override this: https://github.com/nfarina/calloutview/pull/9
|
|
259
259
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
|
260
|
-
|
|
260
|
+
|
|
261
261
|
CGPoint touchPoint = [self.calloutView convertPoint:point fromView:self];
|
|
262
262
|
UIView *touchedView = [self.calloutView hitTest:touchPoint withEvent:event];
|
|
263
263
|
|
|
@@ -291,33 +291,33 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
291
291
|
|
|
292
292
|
return calloutSubview ? calloutSubview : touchedView;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
return [super hitTest:point withEvent:event];
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
#pragma mark SMCalloutViewDelegate
|
|
299
299
|
|
|
300
300
|
- (NSTimeInterval)calloutView:(SMCalloutView *)calloutView delayForRepositionWithSize:(CGSize)offset {
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
// When the callout is being asked to present in a way where it or its target will be partially offscreen, it asks us
|
|
303
303
|
// if we'd like to reposition our surface first so the callout is completely visible. Here we scroll the map into view,
|
|
304
304
|
// but it takes some math because we have to deal in lon/lat instead of the given offset in pixels.
|
|
305
|
-
|
|
305
|
+
|
|
306
306
|
CLLocationCoordinate2D coordinate = self.region.center;
|
|
307
|
-
|
|
307
|
+
|
|
308
308
|
// where's the center coordinate in terms of our view?
|
|
309
309
|
CGPoint center = [self convertCoordinate:coordinate toPointToView:self];
|
|
310
|
-
|
|
310
|
+
|
|
311
311
|
// move it by the requested offset
|
|
312
312
|
center.x -= offset.width;
|
|
313
313
|
center.y -= offset.height;
|
|
314
|
-
|
|
314
|
+
|
|
315
315
|
// and translate it back into map coordinates
|
|
316
316
|
coordinate = [self convertPoint:center toCoordinateFromView:self];
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
// move the map!
|
|
319
319
|
[self setCenterCoordinate:coordinate animated:YES];
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
// tell the callout to wait for a while while we scroll (we assume the scroll delay for MKMapView matches UIScrollView)
|
|
322
322
|
return kSMCalloutViewRepositionDelayForUIScrollView;
|
|
323
323
|
}
|
|
@@ -330,7 +330,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
330
330
|
|
|
331
331
|
CLLocationCoordinate2D northEast = MKCoordinateForMapPoint(MKMapPointMake(MKMapRectGetMaxX(mapRect), mapRect.origin.y));
|
|
332
332
|
CLLocationCoordinate2D southWest = MKCoordinateForMapPoint(MKMapPointMake(mapRect.origin.x, MKMapRectGetMaxY(mapRect)));
|
|
333
|
-
|
|
333
|
+
|
|
334
334
|
return @[
|
|
335
335
|
@[
|
|
336
336
|
[NSNumber numberWithDouble:northEast.longitude],
|
|
@@ -395,7 +395,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
395
395
|
if (!CLLocationCoordinate2DIsValid(region.center)) {
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
|
|
399
399
|
// If new span values are nil, use old values instead
|
|
400
400
|
if (!region.span.latitudeDelta) {
|
|
401
401
|
region.span.latitudeDelta = self.region.span.latitudeDelta;
|
|
@@ -403,7 +403,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
403
403
|
if (!region.span.longitudeDelta) {
|
|
404
404
|
region.span.longitudeDelta = self.region.span.longitudeDelta;
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
|
|
407
407
|
// Animate/move to new position
|
|
408
408
|
[super setRegion:region animated:animated];
|
|
409
409
|
}
|
|
@@ -470,40 +470,39 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
- (void)setCameraZoomRange:(NSDictionary *)cameraZoomRange {
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
473
|
+
if (@available(iOS 13.0, *)) {
|
|
474
|
+
|
|
475
|
+
if (cameraZoomRange == nil) {
|
|
476
|
+
cameraZoomRange = @{};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
NSNumber *minValue = cameraZoomRange[@"minCenterCoordinateDistance"];
|
|
480
|
+
NSNumber *maxValue = cameraZoomRange[@"maxCenterCoordinateDistance"];
|
|
481
|
+
|
|
482
|
+
if (minValue == nil && maxValue == nil) {
|
|
483
|
+
self.legacyZoomConstraintsEnabled = YES;
|
|
484
|
+
|
|
485
|
+
MKMapCameraZoomRange *defaultZoomRange = [[MKMapCameraZoomRange alloc] initWithMinCenterCoordinateDistance:MKMapCameraZoomDefault maxCenterCoordinateDistance:MKMapCameraZoomDefault];
|
|
486
|
+
[super setCameraZoomRange:defaultZoomRange animated:NO];
|
|
487
|
+
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
MKMapCameraZoomRange *zoomRange = nil;
|
|
492
|
+
|
|
493
|
+
if (minValue != nil && maxValue != nil) {
|
|
494
|
+
zoomRange = [[MKMapCameraZoomRange alloc] initWithMinCenterCoordinateDistance:[minValue doubleValue] maxCenterCoordinateDistance:[maxValue doubleValue]];
|
|
495
|
+
} else if (minValue != nil) {
|
|
496
|
+
zoomRange = [[MKMapCameraZoomRange alloc] initWithMinCenterCoordinateDistance:[minValue doubleValue]];
|
|
497
|
+
} else if (maxValue != nil) {
|
|
498
|
+
zoomRange = [[MKMapCameraZoomRange alloc] initWithMaxCenterCoordinateDistance:[maxValue doubleValue]];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
BOOL animated = [cameraZoomRange[@"animated"] boolValue];
|
|
502
|
+
|
|
503
|
+
self.legacyZoomConstraintsEnabled = NO;
|
|
504
|
+
[super setCameraZoomRange:zoomRange animated:animated];
|
|
501
505
|
}
|
|
502
|
-
|
|
503
|
-
BOOL animated = [cameraZoomRange[@"animated"] boolValue];
|
|
504
|
-
|
|
505
|
-
self.legacyZoomConstraintsEnabled = NO;
|
|
506
|
-
[super setCameraZoomRange:zoomRange animated:animated];
|
|
507
506
|
}
|
|
508
507
|
|
|
509
508
|
// Include properties of MKMapView which are only available on iOS 9+
|
|
@@ -598,7 +597,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
598
597
|
else {
|
|
599
598
|
self.cacheImageView.image = nil;
|
|
600
599
|
self.cacheImageView.hidden = YES;
|
|
601
|
-
|
|
600
|
+
|
|
602
601
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
603
602
|
self.cacheImageView.image = nil;
|
|
604
603
|
self.cacheImageView.hidden = YES;
|
|
@@ -606,12 +605,12 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
606
605
|
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
|
|
607
606
|
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
608
607
|
UIGraphicsEndImageContext();
|
|
609
|
-
|
|
608
|
+
|
|
610
609
|
self.cacheImageView.image = image;
|
|
611
610
|
self.cacheImageView.hidden = NO;
|
|
612
611
|
});
|
|
613
612
|
}
|
|
614
|
-
|
|
613
|
+
|
|
615
614
|
[self updateScrollEnabled];
|
|
616
615
|
[self updateZoomEnabled];
|
|
617
616
|
[self updateLegalLabelInsets];
|
|
@@ -639,16 +638,16 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
639
638
|
|
|
640
639
|
|
|
641
640
|
- (void)setLegalLabelInsets:(UIEdgeInsets)legalLabelInsets {
|
|
642
|
-
|
|
643
|
-
|
|
641
|
+
_legalLabelInsets = legalLabelInsets;
|
|
642
|
+
[self updateLegalLabelInsets];
|
|
644
643
|
}
|
|
645
644
|
|
|
646
645
|
- (void)setMapPadding:(UIEdgeInsets)mapPadding {
|
|
647
|
-
|
|
646
|
+
self.layoutMargins = mapPadding;
|
|
648
647
|
}
|
|
649
648
|
|
|
650
649
|
- (UIEdgeInsets)mapPadding {
|
|
651
|
-
|
|
650
|
+
return self.layoutMargins;
|
|
652
651
|
}
|
|
653
652
|
|
|
654
653
|
- (void)beginLoading {
|
|
@@ -707,7 +706,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
707
706
|
- (void)layoutSubviews {
|
|
708
707
|
[super layoutSubviews];
|
|
709
708
|
[self cacheViewIfNeeded];
|
|
710
|
-
|
|
709
|
+
|
|
711
710
|
if (self.overlayCompassButton == nil) {
|
|
712
711
|
for (UIView *subview in self.subviews) {
|
|
713
712
|
if (![NSStringFromClass(subview.class) isEqualToString:@"MKPassThroughStackView"]) continue;
|
|
@@ -735,22 +734,22 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
735
734
|
// based on https://medium.com/@dmytrobabych/getting-actual-rotation-and-zoom-level-for-mapkit-mkmapview-e7f03f430aa9
|
|
736
735
|
- (CGFloat)getZoomLevel {
|
|
737
736
|
CGFloat cameraAngle = self.camera.heading;
|
|
738
|
-
|
|
737
|
+
|
|
739
738
|
if (cameraAngle > 270) {
|
|
740
739
|
cameraAngle = 360 - cameraAngle;
|
|
741
740
|
} else if (cameraAngle > 90) {
|
|
742
741
|
cameraAngle = fabs(cameraAngle - 180);
|
|
743
742
|
}
|
|
744
|
-
|
|
743
|
+
|
|
745
744
|
CGFloat angleRad = M_PI * cameraAngle / 180; // map rotation in radians
|
|
746
745
|
CGFloat width = self.frame.size.width;
|
|
747
746
|
CGFloat height = self.frame.size.height;
|
|
748
747
|
CGFloat heightOffset = 20; // the offset (status bar height) which is taken by MapKit into consideration to calculate visible area height
|
|
749
|
-
|
|
748
|
+
|
|
750
749
|
// calculating Longitude span corresponding to normal (non-rotated) width
|
|
751
750
|
CGFloat spanStraight = width * self.region.span.longitudeDelta / (width * cos(angleRad) + (height - heightOffset) * sin(angleRad));
|
|
752
751
|
int normalizingFactor = 512;
|
|
753
|
-
|
|
752
|
+
|
|
754
753
|
return log2(360 * ((width / normalizingFactor) / spanStraight));
|
|
755
754
|
}
|
|
756
755
|
|
|
@@ -272,7 +272,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
272
272
|
@"latitude": @(marker.coordinate.latitude),
|
|
273
273
|
@"longitude": @(marker.coordinate.longitude)
|
|
274
274
|
},
|
|
275
|
-
@"
|
|
275
|
+
@"position": @{
|
|
276
276
|
@"x": @(touchPointReal.x),
|
|
277
277
|
@"y": @(touchPointReal.y),
|
|
278
278
|
}
|
package/lib/MapView.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export type MapViewProps = ViewProps & {
|
|
|
113
113
|
* Sets loading background color.
|
|
114
114
|
*
|
|
115
115
|
* @default `#FFFFFF`
|
|
116
|
-
* @platform iOS:
|
|
116
|
+
* @platform iOS: Supported
|
|
117
117
|
* @platform Android: Supported
|
|
118
118
|
*/
|
|
119
119
|
loadingBackgroundColor?: string;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
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.18.
|
|
8
|
+
"version": "1.18.3",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|
|
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
|
|
|
9
9
|
s.authors = package["author"]
|
|
10
10
|
s.homepage = package["homepage"]
|
|
11
11
|
s.license = package["license"]
|
|
12
|
-
s.platform = :ios, "
|
|
12
|
+
s.platform = :ios, "14"
|
|
13
13
|
|
|
14
14
|
s.source = { :git => "https://github.com/react-native-maps/react-native-maps.git", :tag=> "v#{s.version}" }
|
|
15
15
|
s.source_files = "ios/AirGoogleMaps/**/*.{h,m}"
|
|
@@ -20,6 +20,6 @@ Pod::Spec.new do |s|
|
|
|
20
20
|
s.pod_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-maps"' }
|
|
21
21
|
|
|
22
22
|
s.dependency 'React-Core'
|
|
23
|
-
s.dependency 'GoogleMaps', '
|
|
24
|
-
s.dependency 'Google-Maps-iOS-Utils', '
|
|
23
|
+
s.dependency 'GoogleMaps', '8.4.0'
|
|
24
|
+
s.dependency 'Google-Maps-iOS-Utils', '5.0.0'
|
|
25
25
|
end
|