react-native-maps 1.15.6 → 1.16.0

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
@@ -129,7 +129,7 @@ Note: You can also pass the image binary data like `image={require('custom_pin.p
129
129
 
130
130
  ### Rendering a Marker with a custom view
131
131
 
132
- Note: This has performance implications, if you wish for a simpler solution go with a custom image (save your self the head ache)
132
+ Note: This has performance implications, if you wish for a simpler solution go with a custom image (save your self the headache)
133
133
 
134
134
  ```jsx
135
135
  <Marker coordinate={{latitude: latitude, longitude: longitude}}>
@@ -38,6 +38,8 @@ const NSInteger AIRMapMaxZoomLevel = 20;
38
38
  @property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView;
39
39
  @property (nonatomic, assign) NSNumber *shouldZoomEnabled;
40
40
  @property (nonatomic, assign) NSNumber *shouldScrollEnabled;
41
+ @property (nonatomic, strong) MKCompassButton *defaultCompassButton;
42
+ @property (nonatomic, strong) MKCompassButton *overlayCompassButton;
41
43
 
42
44
  - (void)updateScrollEnabled;
43
45
  - (void)updateZoomEnabled;
@@ -508,6 +510,9 @@ const NSInteger AIRMapMaxZoomLevel = 20;
508
510
  // and check if their selector is available before calling super method.
509
511
 
510
512
  - (void)setShowsCompass:(BOOL)showsCompass {
513
+ if (self.overlayCompassButton != nil) {
514
+ self.overlayCompassButton.compassVisibility = showsCompass ? MKFeatureVisibilityAdaptive : MKFeatureVisibilityHidden;
515
+ }
511
516
  if ([MKMapView instancesRespondToSelector:@selector(setShowsCompass:)]) {
512
517
  [super setShowsCompass:showsCompass];
513
518
  }
@@ -702,15 +707,29 @@ const NSInteger AIRMapMaxZoomLevel = 20;
702
707
  - (void)layoutSubviews {
703
708
  [super layoutSubviews];
704
709
  [self cacheViewIfNeeded];
705
- NSUInteger index = [[self subviews] indexOfObjectPassingTest:^BOOL(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
706
- NSString *str = NSStringFromClass([obj class]);
707
- return [str containsString:@"MKCompassView"];
708
- }];
709
- if (index != NSNotFound) {
710
- UIView* compassButton;
711
- compassButton = [self.subviews objectAtIndex:index];
712
- compassButton.frame = CGRectMake(compassButton.frame.origin.x + _compassOffset.x, compassButton.frame.origin.y + _compassOffset.y, compassButton.frame.size.width, compassButton.frame.size.height);
710
+
711
+ if (self.overlayCompassButton == nil) {
712
+ for (UIView *subview in self.subviews) {
713
+ if (![NSStringFromClass(subview.class) isEqualToString:@"MKPassThroughStackView"]) continue;
714
+ self.overlayCompassButton = [MKCompassButton compassButtonWithMapView:self];
715
+ [subview addSubview:self.overlayCompassButton];
716
+ self.overlayCompassButton.frame = CGRectMake(self.overlayCompassButton.frame.origin.x + _compassOffset.x, self.overlayCompassButton.frame.origin.y + _compassOffset.y, self.overlayCompassButton.frame.size.width, self.overlayCompassButton.frame.size.height);
717
+ break;
718
+ }
713
719
  }
720
+
721
+ if (self.defaultCompassButton == nil) {
722
+ for (UIView *subview in self.subviews) {
723
+ if (![NSStringFromClass(subview.class) isEqualToString:@"MKPassThroughStackView"]) continue;
724
+ for (UIView *subview2 in subview.subviews) {
725
+ if (![NSStringFromClass(subview2.class) isEqualToString:@"MKCompassView"]) continue;
726
+ self.defaultCompassButton = subview2;
727
+ self.defaultCompassButton.hidden = YES;
728
+ }
729
+ break;
730
+ }
731
+ }
732
+
714
733
  }
715
734
 
716
735
  // based on https://medium.com/@dmytrobabych/getting-actual-rotation-and-zoom-level-for-mapkit-mkmapview-e7f03f430aa9
package/lib/Geojson.js CHANGED
@@ -52,7 +52,7 @@ const Geojson = (props) => {
52
52
  const polygonFillColor = getColor(fillColor, overlay, 'fill');
53
53
  const lineStrokeColor = getColor(strokeColor, overlay, 'stroke');
54
54
  const lineStrokeWidth = getStrokeWidth(strokeWidth, overlay);
55
- return (<MapPolygon_1.default key={index} coordinates={overlay.coordinates} holes={overlay.holes} strokeColor={lineStrokeColor} fillColor={polygonFillColor} strokeWidth={lineStrokeWidth} tappable={tappable} onPress={() => onPress && onPress(overlay)} zIndex={zIndex}/>);
55
+ return (<MapPolygon_1.default key={index} coordinates={overlay.coordinates} holes={overlay.holes} strokeColor={lineStrokeColor} fillColor={polygonFillColor} strokeWidth={lineStrokeWidth} lineDashPhase={lineDashPhase} lineDashPattern={lineDashPattern} lineCap={lineCap} lineJoin={lineJoin} miterLimit={miterLimit} tappable={tappable} onPress={() => onPress && onPress(overlay)} zIndex={zIndex}/>);
56
56
  })}
57
57
  </React.Fragment>);
58
58
  };
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.15.6",
8
+ "version": "1.16.0",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",