react-native-maps 1.15.7 → 1.17.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}}>
@@ -4,7 +4,10 @@ import android.content.Context;
4
4
 
5
5
  import com.facebook.react.bridge.ReadableArray;
6
6
  import com.facebook.react.bridge.ReadableMap;
7
+ import com.google.android.gms.maps.model.Dash;
8
+ import com.google.android.gms.maps.model.Gap;
7
9
  import com.google.android.gms.maps.model.LatLng;
10
+ import com.google.android.gms.maps.model.PatternItem;
8
11
  import com.google.android.gms.maps.model.Polygon;
9
12
  import com.google.android.gms.maps.model.PolygonOptions;
10
13
  import com.google.maps.android.collections.PolygonManager;
@@ -25,6 +28,8 @@ public class MapPolygon extends MapFeature {
25
28
  private boolean geodesic;
26
29
  private boolean tappable;
27
30
  private float zIndex;
31
+ private ReadableArray patternValues;
32
+ private List<PatternItem> pattern;
28
33
 
29
34
  public MapPolygon(Context context) {
30
35
  super(context);
@@ -117,6 +122,32 @@ public class MapPolygon extends MapFeature {
117
122
  }
118
123
  }
119
124
 
125
+ public void setLineDashPattern(ReadableArray patternValues) {
126
+ this.patternValues = patternValues;
127
+ this.applyPattern();
128
+ }
129
+
130
+ private void applyPattern() {
131
+ if(patternValues == null) {
132
+ return;
133
+ }
134
+ this.pattern = new ArrayList<>(patternValues.size());
135
+ for (int i = 0; i < patternValues.size(); i++) {
136
+ float patternValue = (float) patternValues.getDouble(i);
137
+ boolean isGap = i % 2 != 0;
138
+ if(isGap) {
139
+ this.pattern.add(new Gap(patternValue));
140
+ }else {
141
+ PatternItem patternItem;
142
+ patternItem = new Dash(patternValue);
143
+ this.pattern.add(patternItem);
144
+ }
145
+ }
146
+ if(polygon != null) {
147
+ polygon.setStrokePattern(this.pattern);
148
+ }
149
+ }
150
+
120
151
  public PolygonOptions getPolygonOptions() {
121
152
  if (polygonOptions == null) {
122
153
  polygonOptions = createPolygonOptions();
@@ -132,6 +163,7 @@ public class MapPolygon extends MapFeature {
132
163
  options.strokeWidth(strokeWidth);
133
164
  options.geodesic(geodesic);
134
165
  options.zIndex(zIndex);
166
+ options.strokePattern(this.pattern);
135
167
 
136
168
  if (this.holes != null) {
137
169
  for (int i = 0; i < holes.size(); i++) {
@@ -78,6 +78,11 @@ public class MapPolygonManager extends ViewGroupManager<MapPolygon> {
78
78
  view.setZIndex(zIndex);
79
79
  }
80
80
 
81
+ @ReactProp(name = "lineDashPattern")
82
+ public void setLineDashPattern(MapPolygon view, ReadableArray patternValues) {
83
+ view.setLineDashPattern(patternValues);
84
+ }
85
+
81
86
  @Override
82
87
  @Nullable
83
88
  public Map getExportedCustomDirectEventTypeConstants() {
@@ -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.d.ts CHANGED
@@ -55,7 +55,7 @@ export type GeojsonProps = {
55
55
  * @platform iOS: Supported
56
56
  * @platform Android: Supported
57
57
  */
58
- lineDashPattern?: PolylineProps['lineDashPattern'];
58
+ lineDashPattern?: PolygonProps['lineDashPattern'] | PolylineProps['lineDashPattern'];
59
59
  /**
60
60
  * The offset (in points) at which to start drawing the dash pattern.
61
61
  *
@@ -51,7 +51,7 @@ export type MapPolygonProps = ViewProps & {
51
51
  * followed by the first gap length, followed by the second line segment length, and so on.
52
52
  *
53
53
  * @platform iOS: Apple Maps only
54
- * @platform Android: Not supported
54
+ * @platform Android: Supported
55
55
  */
56
56
  lineDashPattern?: number[];
57
57
  /**
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.7",
8
+ "version": "1.17.0",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",