@rnmapbox/maps 10.0.0-beta.61 → 10.0.0-beta.64

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.
Files changed (44) hide show
  1. package/android/install.md +1 -1
  2. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +0 -55
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +11 -7
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +0 -55
  5. package/ios/RCTMGL/RCTMGLStyle.h +0 -5
  6. package/ios/RCTMGL/RCTMGLStyle.m +0 -35
  7. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +25 -17
  8. package/ios/RCTMGL-v10/RCTMGLMapView.swift +26 -23
  9. package/ios/RCTMGL-v10/RCTMGLMapViewManager.swift +2 -2
  10. package/ios/RCTMGL-v10/RCTMGLOfflineModule.swift +9 -5
  11. package/ios/RCTMGL-v10/RCTMGLPointAnnotation.swift +65 -43
  12. package/ios/RCTMGL-v10/RCTMGLPointAnnotationManager.m +1 -0
  13. package/ios/RCTMGL-v10/RCTMGLStyle.swift +0 -35
  14. package/ios/RCTMGL.xcodeproj/project.pbxproj +1 -0
  15. package/javascript/components/MapView.js +1 -1
  16. package/javascript/components/UserLocation.js +2 -2
  17. package/javascript/modules/location/locationManager.js +13 -1
  18. package/javascript/utils/MapboxStyles.d.ts +27 -31
  19. package/javascript/utils/styleMap.ts +0 -45
  20. package/javascript/web/install.md +25 -0
  21. package/lib/commonjs/components/MapView.js +1 -1
  22. package/lib/commonjs/components/MapView.js.map +1 -1
  23. package/lib/commonjs/components/UserLocation.js +1 -1
  24. package/lib/commonjs/components/UserLocation.js.map +1 -1
  25. package/lib/commonjs/modules/location/locationManager.js +8 -1
  26. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  27. package/lib/commonjs/utils/styleMap.js +1 -41
  28. package/lib/commonjs/utils/styleMap.js.map +1 -1
  29. package/lib/commonjs/web/UnimplementedComponent.js.map +1 -1
  30. package/lib/commonjs/web/install.md +25 -0
  31. package/lib/module/components/MapView.js +1 -1
  32. package/lib/module/components/MapView.js.map +1 -1
  33. package/lib/module/components/UserLocation.js +1 -1
  34. package/lib/module/components/UserLocation.js.map +1 -1
  35. package/lib/module/modules/location/locationManager.js +8 -1
  36. package/lib/module/modules/location/locationManager.js.map +1 -1
  37. package/lib/module/utils/styleMap.js +1 -41
  38. package/lib/module/utils/styleMap.js.map +1 -1
  39. package/lib/module/web/UnimplementedComponent.js.map +1 -1
  40. package/lib/module/web/install.md +25 -0
  41. package/lib/typescript/utils/styleMap.d.ts +0 -40
  42. package/lib/typescript/utils/styleMap.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/react-native.config.js +0 -3
@@ -4,7 +4,7 @@
4
4
 
5
5
  - mapbox: v10 latest mapbox implementation - *recommended*, not opensource requires access for download
6
6
  - maplibre: *DEFAULT* open source fork of older open source mapbox libraries with many improvements, will be removed in next version
7
- - mapbox-gl: classic mapbox libraries - should work but will be dropped, recent versions are not open source and requires acess for download, will be removed in next version
7
+ - mapbox-gl: classic mapbox libraries - should work but will be dropped, recent versions are not open source and requires access for download, will be removed in next version
8
8
 
9
9
  ## Mapbox Maps SDK v10
10
10
 
@@ -80,9 +80,6 @@ public class RCTMGLStyleFactory {
80
80
  }
81
81
  });
82
82
  break;
83
- case "fillPatternTransition":
84
- RCTMGLStyleFactory.setFillPatternTransition(layer, styleValue);
85
- break;
86
83
  }
87
84
  }
88
85
  }
@@ -163,9 +160,6 @@ public class RCTMGLStyleFactory {
163
160
  case "lineDasharray":
164
161
  RCTMGLStyleFactory.setLineDasharray(layer, styleValue);
165
162
  break;
166
- case "lineDasharrayTransition":
167
- RCTMGLStyleFactory.setLineDasharrayTransition(layer, styleValue);
168
- break;
169
163
  case "linePattern":
170
164
  style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
171
165
  @Override
@@ -174,9 +168,6 @@ public class RCTMGLStyleFactory {
174
168
  }
175
169
  });
176
170
  break;
177
- case "linePatternTransition":
178
- RCTMGLStyleFactory.setLinePatternTransition(layer, styleValue);
179
- break;
180
171
  case "lineGradient":
181
172
  RCTMGLStyleFactory.setLineGradient(layer, styleValue);
182
173
  break;
@@ -564,9 +555,6 @@ public class RCTMGLStyleFactory {
564
555
  }
565
556
  });
566
557
  break;
567
- case "fillExtrusionPatternTransition":
568
- RCTMGLStyleFactory.setFillExtrusionPatternTransition(layer, styleValue);
569
- break;
570
558
  case "fillExtrusionHeight":
571
559
  RCTMGLStyleFactory.setFillExtrusionHeight(layer, styleValue);
572
560
  break;
@@ -719,9 +707,6 @@ public class RCTMGLStyleFactory {
719
707
  }
720
708
  });
721
709
  break;
722
- case "backgroundPatternTransition":
723
- RCTMGLStyleFactory.setBackgroundPatternTransition(layer, styleValue);
724
- break;
725
710
  case "backgroundOpacity":
726
711
  RCTMGLStyleFactory.setBackgroundOpacity(layer, styleValue);
727
712
  break;
@@ -871,14 +856,6 @@ public class RCTMGLStyleFactory {
871
856
  }
872
857
  }
873
858
 
874
-
875
- public static void setFillPatternTransition(FillLayer layer, RCTMGLStyleValue styleValue) {
876
- TransitionOptions transition = styleValue.getTransition();
877
- if (transition != null) {
878
- layer.setFillPatternTransition(transition);
879
- }
880
- }
881
-
882
859
  public static void setLineCap(LineLayer layer, RCTMGLStyleValue styleValue) {
883
860
  if (styleValue.isExpression()) {
884
861
  layer.setProperties(PropertyFactory.lineCap(styleValue.getExpression()));
@@ -1051,14 +1028,6 @@ public class RCTMGLStyleFactory {
1051
1028
  }
1052
1029
  }
1053
1030
 
1054
-
1055
- public static void setLineDasharrayTransition(LineLayer layer, RCTMGLStyleValue styleValue) {
1056
- TransitionOptions transition = styleValue.getTransition();
1057
- if (transition != null) {
1058
- layer.setLineDasharrayTransition(transition);
1059
- }
1060
- }
1061
-
1062
1031
  public static void setLinePattern(LineLayer layer, RCTMGLStyleValue styleValue) {
1063
1032
  if (styleValue.isExpression()) {
1064
1033
  if (styleValue.isImageStringValue()) {
@@ -1071,14 +1040,6 @@ public class RCTMGLStyleFactory {
1071
1040
  }
1072
1041
  }
1073
1042
 
1074
-
1075
- public static void setLinePatternTransition(LineLayer layer, RCTMGLStyleValue styleValue) {
1076
- TransitionOptions transition = styleValue.getTransition();
1077
- if (transition != null) {
1078
- layer.setLinePatternTransition(transition);
1079
- }
1080
- }
1081
-
1082
1043
  public static void setLineGradient(LineLayer layer, RCTMGLStyleValue styleValue) {
1083
1044
  if (styleValue.isExpression()) {
1084
1045
  layer.setProperties(PropertyFactory.lineGradient(styleValue.getExpression()));
@@ -1927,14 +1888,6 @@ public class RCTMGLStyleFactory {
1927
1888
  }
1928
1889
  }
1929
1890
 
1930
-
1931
- public static void setFillExtrusionPatternTransition(FillExtrusionLayer layer, RCTMGLStyleValue styleValue) {
1932
- TransitionOptions transition = styleValue.getTransition();
1933
- if (transition != null) {
1934
- layer.setFillExtrusionPatternTransition(transition);
1935
- }
1936
- }
1937
-
1938
1891
  public static void setFillExtrusionHeight(FillExtrusionLayer layer, RCTMGLStyleValue styleValue) {
1939
1892
  if (styleValue.isExpression()) {
1940
1893
  layer.setProperties(PropertyFactory.fillExtrusionHeight(styleValue.getExpression()));
@@ -2207,14 +2160,6 @@ public class RCTMGLStyleFactory {
2207
2160
  }
2208
2161
  }
2209
2162
 
2210
-
2211
- public static void setBackgroundPatternTransition(BackgroundLayer layer, RCTMGLStyleValue styleValue) {
2212
- TransitionOptions transition = styleValue.getTransition();
2213
- if (transition != null) {
2214
- layer.setBackgroundPatternTransition(transition);
2215
- }
2216
- }
2217
-
2218
2163
  public static void setBackgroundOpacity(BackgroundLayer layer, RCTMGLStyleValue styleValue) {
2219
2164
  if (styleValue.isExpression()) {
2220
2165
  layer.setProperties(PropertyFactory.backgroundOpacity(styleValue.getExpression()));
@@ -733,19 +733,23 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
733
733
  }
734
734
 
735
735
  fun queryRenderedFeaturesAtPoint(callbackID: String?, point: PointF, filter: Expression?, layerIDs: List<String>?) {
736
- mMap?.queryRenderedFeatures(
737
- ScreenCoordinate(point.x.toDouble(), point.y.toDouble()),
738
- RenderedQueryOptions(layerIDs, filter)
739
- ) { features ->
736
+ if (mMap == null) {
737
+ Logger.e("queryRenderedFeaturesAtPoint", "mapbox map is null")
738
+ return
739
+ }
740
+ val screenCoordinate = ScreenCoordinate(point.x.toDouble(), point.y.toDouble())
741
+ val queryGeometry = RenderedQueryGeometry(screenCoordinate)
742
+ val layers = layerIDs?.takeUnless { it.isEmpty() } ?: null;
743
+ val queryOptions = RenderedQueryOptions(layers, filter)
744
+ mMap.queryRenderedFeatures(queryGeometry, queryOptions) { features ->
740
745
  if (features.isValue) {
741
746
  val featuresList = ArrayList<Feature?>()
742
747
  for (i in features.value!!) {
743
748
  featuresList.add(i.feature)
744
749
  }
745
-
746
- sendResponse(callbackID, {
750
+ sendResponse(callbackID) {
747
751
  it.putString("data", FeatureCollection.fromFeatures(featuresList).toJson())
748
- })
752
+ }
749
753
  } else {
750
754
  Logger.e("queryRenderedFeaturesAtPoint", features.error ?: "n/a")
751
755
  }
@@ -91,9 +91,6 @@ public class RCTMGLStyleFactory {
91
91
  }
92
92
  });
93
93
  break;
94
- case "fillPatternTransition":
95
- RCTMGLStyleFactory.setFillPatternTransition(layer, styleValue);
96
- break;
97
94
  }
98
95
  }
99
96
  }
@@ -174,9 +171,6 @@ public class RCTMGLStyleFactory {
174
171
  case "lineDasharray":
175
172
  RCTMGLStyleFactory.setLineDasharray(layer, styleValue);
176
173
  break;
177
- case "lineDasharrayTransition":
178
- RCTMGLStyleFactory.setLineDasharrayTransition(layer, styleValue);
179
- break;
180
174
  case "linePattern":
181
175
  style.addImage(styleValue, new DownloadMapImageTask.OnAllImagesLoaded() {
182
176
  @Override
@@ -189,9 +183,6 @@ public class RCTMGLStyleFactory {
189
183
  }
190
184
  });
191
185
  break;
192
- case "linePatternTransition":
193
- RCTMGLStyleFactory.setLinePatternTransition(layer, styleValue);
194
- break;
195
186
  case "lineGradient":
196
187
  RCTMGLStyleFactory.setLineGradient(layer, styleValue);
197
188
  break;
@@ -593,9 +584,6 @@ public class RCTMGLStyleFactory {
593
584
  }
594
585
  });
595
586
  break;
596
- case "fillExtrusionPatternTransition":
597
- RCTMGLStyleFactory.setFillExtrusionPatternTransition(layer, styleValue);
598
- break;
599
587
  case "fillExtrusionHeight":
600
588
  RCTMGLStyleFactory.setFillExtrusionHeight(layer, styleValue);
601
589
  break;
@@ -752,9 +740,6 @@ public class RCTMGLStyleFactory {
752
740
  }
753
741
  });
754
742
  break;
755
- case "backgroundPatternTransition":
756
- RCTMGLStyleFactory.setBackgroundPatternTransition(layer, styleValue);
757
- break;
758
743
  case "backgroundOpacity":
759
744
  RCTMGLStyleFactory.setBackgroundOpacity(layer, styleValue);
760
745
  break;
@@ -1018,14 +1003,6 @@ public class RCTMGLStyleFactory {
1018
1003
  }
1019
1004
  }
1020
1005
 
1021
-
1022
- public static void setFillPatternTransition(FillLayer layer, RCTMGLStyleValue styleValue) {
1023
- StyleTransition transition = styleValue.getTransition();
1024
- if (transition != null) {
1025
- layer.fillPatternTransition(transition);
1026
- }
1027
- }
1028
-
1029
1006
  public static void setLineCap(LineLayer layer, RCTMGLStyleValue styleValue) {
1030
1007
  if (styleValue.isExpression()) {
1031
1008
  layer.lineCap(styleValue.getExpression());
@@ -1198,14 +1175,6 @@ public class RCTMGLStyleFactory {
1198
1175
  }
1199
1176
  }
1200
1177
 
1201
-
1202
- public static void setLineDasharrayTransition(LineLayer layer, RCTMGLStyleValue styleValue) {
1203
- StyleTransition transition = styleValue.getTransition();
1204
- if (transition != null) {
1205
- layer.lineDasharrayTransition(transition);
1206
- }
1207
- }
1208
-
1209
1178
  public static void setLinePattern(LineLayer layer, RCTMGLStyleValue styleValue) {
1210
1179
  if (styleValue.isExpression()) {
1211
1180
  if (styleValue.isImageStringValue()) {
@@ -1218,14 +1187,6 @@ public class RCTMGLStyleFactory {
1218
1187
  }
1219
1188
  }
1220
1189
 
1221
-
1222
- public static void setLinePatternTransition(LineLayer layer, RCTMGLStyleValue styleValue) {
1223
- StyleTransition transition = styleValue.getTransition();
1224
- if (transition != null) {
1225
- layer.linePatternTransition(transition);
1226
- }
1227
- }
1228
-
1229
1190
  public static void setLineGradient(LineLayer layer, RCTMGLStyleValue styleValue) {
1230
1191
  if (styleValue.isExpression()) {
1231
1192
  layer.lineGradient(styleValue.getExpression());
@@ -2090,14 +2051,6 @@ public class RCTMGLStyleFactory {
2090
2051
  }
2091
2052
  }
2092
2053
 
2093
-
2094
- public static void setFillExtrusionPatternTransition(FillExtrusionLayer layer, RCTMGLStyleValue styleValue) {
2095
- StyleTransition transition = styleValue.getTransition();
2096
- if (transition != null) {
2097
- layer.fillExtrusionPatternTransition(transition);
2098
- }
2099
- }
2100
-
2101
2054
  public static void setFillExtrusionHeight(FillExtrusionLayer layer, RCTMGLStyleValue styleValue) {
2102
2055
  if (styleValue.isExpression()) {
2103
2056
  layer.fillExtrusionHeight(styleValue.getExpression());
@@ -2370,14 +2323,6 @@ public class RCTMGLStyleFactory {
2370
2323
  }
2371
2324
  }
2372
2325
 
2373
-
2374
- public static void setBackgroundPatternTransition(BackgroundLayer layer, RCTMGLStyleValue styleValue) {
2375
- StyleTransition transition = styleValue.getTransition();
2376
- if (transition != null) {
2377
- layer.backgroundPatternTransition(transition);
2378
- }
2379
- }
2380
-
2381
2326
  public static void setBackgroundOpacity(BackgroundLayer layer, RCTMGLStyleValue styleValue) {
2382
2327
  if (styleValue.isExpression()) {
2383
2328
  layer.backgroundOpacity(styleValue.getExpression());
@@ -38,7 +38,6 @@
38
38
  - (void)setFillTranslateTransition:(MGLFillStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
39
39
  - (void)setFillTranslateAnchor:(MGLFillStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
40
40
  - (void)setFillPattern:(MGLFillStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
41
- - (void)setFillPatternTransition:(MGLFillStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
42
41
  - (void)setLineCap:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
43
42
  - (void)setLineJoin:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
44
43
  - (void)setLineMiterLimit:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
@@ -61,9 +60,7 @@
61
60
  - (void)setLineBlur:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
62
61
  - (void)setLineBlurTransition:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
63
62
  - (void)setLineDasharray:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
64
- - (void)setLineDasharrayTransition:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
65
63
  - (void)setLinePattern:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
66
- - (void)setLinePatternTransition:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
67
64
  - (void)setLineGradient:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
68
65
  - (void)setSymbolPlacement:(MGLSymbolStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
69
66
  - (void)setSymbolSpacing:(MGLSymbolStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
@@ -171,7 +168,6 @@
171
168
  - (void)setFillExtrusionTranslateTransition:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
172
169
  - (void)setFillExtrusionTranslateAnchor:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
173
170
  - (void)setFillExtrusionPattern:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
174
- - (void)setFillExtrusionPatternTransition:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
175
171
  - (void)setFillExtrusionHeight:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
176
172
  - (void)setFillExtrusionHeightTransition:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
177
173
  - (void)setFillExtrusionBase:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
@@ -207,7 +203,6 @@
207
203
  - (void)setBackgroundColor:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
208
204
  - (void)setBackgroundColorTransition:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
209
205
  - (void)setBackgroundPattern:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
210
- - (void)setBackgroundPatternTransition:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
211
206
  - (void)setBackgroundOpacity:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
212
207
  - (void)setBackgroundOpacityTransition:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
213
208
  - (void)setAnchor:(MGLLight *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue;
@@ -71,8 +71,6 @@
71
71
  }
72
72
  }];
73
73
  }
74
- } else if ([prop isEqualToString:@"fillPatternTransition"]) {
75
- [self setFillPatternTransition:layer withReactStyleValue:styleValue];
76
74
  } else {
77
75
  // TODO throw exception
78
76
  }
@@ -138,8 +136,6 @@
138
136
  [self setLineBlurTransition:layer withReactStyleValue:styleValue];
139
137
  } else if ([prop isEqualToString:@"lineDasharray"]) {
140
138
  [self setLineDasharray:layer withReactStyleValue:styleValue];
141
- } else if ([prop isEqualToString:@"lineDasharrayTransition"]) {
142
- [self setLineDasharrayTransition:layer withReactStyleValue:styleValue];
143
139
  } else if ([prop isEqualToString:@"linePattern"]) {
144
140
  if (![styleValue shouldAddImage]) {
145
141
  [self setLinePattern:layer withReactStyleValue:styleValue];
@@ -157,8 +153,6 @@
157
153
  }
158
154
  }];
159
155
  }
160
- } else if ([prop isEqualToString:@"linePatternTransition"]) {
161
- [self setLinePatternTransition:layer withReactStyleValue:styleValue];
162
156
  } else if ([prop isEqualToString:@"lineGradient"]) {
163
157
  [self setLineGradient:layer withReactStyleValue:styleValue];
164
158
  } else {
@@ -487,8 +481,6 @@
487
481
  }
488
482
  }];
489
483
  }
490
- } else if ([prop isEqualToString:@"fillExtrusionPatternTransition"]) {
491
- [self setFillExtrusionPatternTransition:layer withReactStyleValue:styleValue];
492
484
  } else if ([prop isEqualToString:@"fillExtrusionHeight"]) {
493
485
  [self setFillExtrusionHeight:layer withReactStyleValue:styleValue];
494
486
  } else if ([prop isEqualToString:@"fillExtrusionHeightTransition"]) {
@@ -637,8 +629,6 @@
637
629
  }
638
630
  }];
639
631
  }
640
- } else if ([prop isEqualToString:@"backgroundPatternTransition"]) {
641
- [self setBackgroundPatternTransition:layer withReactStyleValue:styleValue];
642
632
  } else if ([prop isEqualToString:@"backgroundOpacity"]) {
643
633
  [self setBackgroundOpacity:layer withReactStyleValue:styleValue];
644
634
  } else if ([prop isEqualToString:@"backgroundOpacityTransition"]) {
@@ -752,11 +742,6 @@
752
742
  layer.fillPattern = styleValue.mglStyleValue;
753
743
  }
754
744
 
755
- - (void)setFillPatternTransition:(MGLFillStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
756
- {
757
- layer.fillPatternTransition = [styleValue getTransition];
758
- }
759
-
760
745
 
761
746
 
762
747
  - (void)setLineCap:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
@@ -869,21 +854,11 @@
869
854
  layer.lineDashPattern = styleValue.mglStyleValue;
870
855
  }
871
856
 
872
- - (void)setLineDasharrayTransition:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
873
- {
874
- layer.lineDashPatternTransition = [styleValue getTransition];
875
- }
876
-
877
857
  - (void)setLinePattern:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
878
858
  {
879
859
  layer.linePattern = styleValue.mglStyleValue;
880
860
  }
881
861
 
882
- - (void)setLinePatternTransition:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
883
- {
884
- layer.linePatternTransition = [styleValue getTransition];
885
- }
886
-
887
862
  - (void)setLineGradient:(MGLLineStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
888
863
  {
889
864
  layer.lineGradient = styleValue.mglStyleValue;
@@ -1427,11 +1402,6 @@
1427
1402
  layer.fillExtrusionPattern = styleValue.mglStyleValue;
1428
1403
  }
1429
1404
 
1430
- - (void)setFillExtrusionPatternTransition:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
1431
- {
1432
- layer.fillExtrusionPatternTransition = [styleValue getTransition];
1433
- }
1434
-
1435
1405
  - (void)setFillExtrusionHeight:(MGLFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
1436
1406
  {
1437
1407
  layer.fillExtrusionHeight = styleValue.mglStyleValue;
@@ -1613,11 +1583,6 @@
1613
1583
  layer.backgroundPattern = styleValue.mglStyleValue;
1614
1584
  }
1615
1585
 
1616
- - (void)setBackgroundPatternTransition:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
1617
- {
1618
- layer.backgroundPatternTransition = [styleValue getTransition];
1619
- }
1620
-
1621
1586
  - (void)setBackgroundOpacity:(MGLBackgroundStyleLayer *)layer withReactStyleValue:(RCTMGLStyleValue *)styleValue
1622
1587
  {
1623
1588
  layer.backgroundOpacity = styleValue.mglStyleValue;
@@ -7,6 +7,8 @@ class RCTMGLLocation: NSObject {
7
7
 
8
8
  var heading : CLHeading? = nil
9
9
 
10
+ var timestamp: Date? = nil
11
+
10
12
  func toJSON() -> [String:Any] {
11
13
  return [
12
14
  "coords": [
@@ -18,7 +20,7 @@ class RCTMGLLocation: NSObject {
18
20
  "course": location.course,
19
21
  "speed": location.speed,
20
22
  ],
21
- "timestamp": location.timestamp.timeIntervalSince1970 * 1000
23
+ "timestamp": (timestamp ?? location.timestamp).timeIntervalSince1970 * 1000
22
24
  ]
23
25
  }
24
26
  }
@@ -41,6 +43,11 @@ protocol RCTMGLLocationManagerDelegate : AnyObject {
41
43
  }
42
44
 
43
45
  class RCTMGLLocationManager : LocationProviderDelegate {
46
+ enum LocationUpdateType {
47
+ case heading
48
+ case location
49
+ }
50
+
44
51
  var provider: LocationProvider
45
52
 
46
53
  var lastKnownLocation : CLLocation?
@@ -49,15 +56,15 @@ class RCTMGLLocationManager : LocationProviderDelegate {
49
56
  weak var delegate: RCTMGLLocationManagerDelegate?
50
57
  weak var locationProviderDelage: LocationProviderDelegate?
51
58
 
52
- var listeners: [RCTMGLLocationBlock] = []
53
-
54
59
  init() {
55
60
  provider = AppleLocationProvider()
56
61
  provider.setDelegate(self)
57
62
  }
58
63
 
59
64
  func setDistanceFilter(_ distanceFilter: CLLocationDistance) {
60
- provider.locationProviderOptions.distanceFilter = distanceFilter
65
+ var options = provider.locationProviderOptions
66
+ options.distanceFilter = distanceFilter
67
+ provider.locationProviderOptions = options
61
68
  }
62
69
 
63
70
  func start() {
@@ -74,7 +81,7 @@ class RCTMGLLocationManager : LocationProviderDelegate {
74
81
  provider.setDelegate(EmptyLocationProviderDelegate())
75
82
  }
76
83
 
77
- func _convertToMapboxLocation(_ location: CLLocation?) -> RCTMGLLocation {
84
+ func _convertToMapboxLocation(_ location: CLLocation?, type: LocationUpdateType) -> RCTMGLLocation {
78
85
  guard let location = location else {
79
86
  return RCTMGLLocation()
80
87
  }
@@ -82,19 +89,22 @@ class RCTMGLLocationManager : LocationProviderDelegate {
82
89
  let userLocation = RCTMGLLocation()
83
90
  userLocation.location = location;
84
91
  userLocation.heading = lastKnownHeading
92
+ switch type {
93
+ case .location:
94
+ userLocation.timestamp = location.timestamp
95
+ case .heading:
96
+ userLocation.timestamp = lastKnownHeading!.timestamp
97
+ }
85
98
  return userLocation;
86
99
  }
87
100
 
88
- func _updateDelegate() {
101
+ func _updateDelegate(type: LocationUpdateType) {
89
102
  if delegate == nil {
90
103
  return;
91
104
  }
92
105
 
93
- let userLocation = _convertToMapboxLocation(lastKnownLocation)
106
+ let userLocation = _convertToMapboxLocation(lastKnownLocation, type: type)
94
107
 
95
- for listener in listeners {
96
- listener(userLocation)
97
- }
98
108
  delegate?.locationManager(self, didUpdateLocation: userLocation)
99
109
  }
100
110
 
@@ -102,14 +112,14 @@ class RCTMGLLocationManager : LocationProviderDelegate {
102
112
 
103
113
  func locationProvider(_ provider: LocationProvider, didUpdateLocations locations: [CLLocation]) {
104
114
  lastKnownLocation = locations.last
105
- self._updateDelegate()
115
+ self._updateDelegate(type: .location)
106
116
 
107
117
  locationProviderDelage?.locationProvider(provider, didUpdateLocations: locations)
108
118
  }
109
119
 
110
120
  func locationProvider(_ provider: LocationProvider, didUpdateHeading newHeading: CLHeading) {
111
121
  lastKnownHeading = newHeading
112
- self._updateDelegate()
122
+ self._updateDelegate(type: .heading)
113
123
 
114
124
  locationProviderDelage?.locationProvider(provider, didUpdateHeading: newHeading)
115
125
  }
@@ -231,9 +241,7 @@ class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
231
241
 
232
242
  @objc
233
243
  override func constantsToExport() -> [AnyHashable: Any]! {
234
- return [
235
- "foo": "bar"
236
- ];
244
+ return [:];
237
245
  }
238
246
 
239
247
  @objc override func supportedEvents() -> [String]
@@ -242,8 +250,8 @@ class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
242
250
  }
243
251
 
244
252
  @objc func start(_ minDisplacement: CLLocationDistance) {
253
+ if minDisplacement >= 0.0 { locationManager.setDistanceFilter(minDisplacement) }
245
254
  locationManager.start()
246
- locationManager.setDistanceFilter(minDisplacement)
247
255
  }
248
256
 
249
257
  @objc func stop() {
@@ -279,7 +287,7 @@ class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
279
287
  guard let _ = bridge else {
280
288
  return
281
289
  }
282
-
290
+
283
291
  self.sendEvent(withName: RCT_MAPBOX_USER_LOCATION_UPDATE, body: location.toJSON())
284
292
  }
285
293
 
@@ -33,7 +33,9 @@ open class RCTMGLMapView : MapView {
33
33
  var layerWaiters : [String:[(String) -> Void]] = [:]
34
34
 
35
35
  lazy var pointAnnotationManager : PointAnnotationManager = {
36
- return PointAnnotationManager(annotations: annotations, mapView: mapView)
36
+ let result = PointAnnotationManager(annotations: annotations, mapView: mapView)
37
+ self._removeMapboxLongPressGestureRecognizer()
38
+ return result
37
39
  }()
38
40
 
39
41
  lazy var calloutAnnotationManager : MapboxMaps.PointAnnotationManager = {
@@ -221,8 +223,8 @@ open class RCTMGLMapView : MapView {
221
223
  }
222
224
  }
223
225
 
224
- @objc func setReactCompassViewPosition(_ position: NSNumber) {
225
- mapView.ornaments.options.compass.position = toOrnamentPositon(Int(truncating: position))
226
+ @objc func setReactCompassViewPosition(_ position: NSInteger) {
227
+ mapView.ornaments.options.compass.position = toOrnamentPositon(Int(truncating: NSNumber(value: position)))
226
228
  }
227
229
 
228
230
  @objc func setReactCompassViewMargins(_ margins: CGPoint) {
@@ -329,6 +331,14 @@ open class RCTMGLMapView : MapView {
329
331
 
330
332
  return nil
331
333
  }
334
+
335
+ func _removeMapboxLongPressGestureRecognizer() {
336
+ mapView.gestureRecognizers?.forEach { recognizer in
337
+ if (String(describing: type(of:recognizer)) == "MapboxLongPressGestureRecognizer") {
338
+ mapView.removeGestureRecognizer(recognizer)
339
+ }
340
+ }
341
+ }
332
342
  }
333
343
 
334
344
  // MARK: - event handlers
@@ -992,23 +1002,16 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
992
1002
  }
993
1003
 
994
1004
  case .changed:
995
- guard let annotation = self.draggedAnnotation else {
1005
+ guard var annotation = self.draggedAnnotation else {
996
1006
  return
997
1007
  }
998
1008
 
999
1009
  self.onDragHandler(self.manager, didDetectDraggedAnnotations: [annotation], dragState: .changed, targetPoint: targetPoint)
1000
1010
 
1001
- // For some reason Mapbox doesn't let us update the geometry of an existing annotation
1002
- // so we have to create a whole new one.
1003
- var newAnnotation = PointAnnotation(id: annotation.id, coordinate: targetPoint)
1004
- newAnnotation.image = annotation.image
1005
- newAnnotation.userInfo = annotation.userInfo
1006
-
1007
- var newAnnotations = self.manager.annotations.filter { an in
1008
- return an.id != annotation.id
1011
+ let idx = self.manager.annotations.firstIndex { an in return an.id == annotation.id }
1012
+ if let idx = idx {
1013
+ self.manager.annotations[idx].point = Point(targetPoint)
1009
1014
  }
1010
- newAnnotations.append(newAnnotation)
1011
- manager.annotations = newAnnotations
1012
1015
  case .cancelled, .ended:
1013
1016
  guard let annotation = self.draggedAnnotation else {
1014
1017
  return
@@ -1023,7 +1026,6 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
1023
1026
  }
1024
1027
  }
1025
1028
 
1026
-
1027
1029
  func remove(_ annotation: PointAnnotation) {
1028
1030
  manager.annotations.removeAll(where: {$0.id == annotation.id})
1029
1031
  }
@@ -1032,15 +1034,16 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
1032
1034
  manager.annotations.append(annotation)
1033
1035
  manager.syncSourceAndLayerIfNeeded()
1034
1036
  }
1035
-
1036
- func refresh(_ annotation: PointAnnotation) {
1037
+
1038
+ func update(_ annotation: PointAnnotation) {
1037
1039
  let index = manager.annotations.firstIndex { $0.id == annotation.id }
1038
- if let index = index {
1039
- manager.annotations[index] = annotation
1040
- manager.syncSourceAndLayerIfNeeded()
1041
- } else {
1042
- Logger.log(level: .warn, message: "RCTMGL - PointAnnotation.refresh: expected annotation already there - adding")
1043
- add(annotation)
1040
+
1041
+ guard let index = index else {
1042
+ Logger.log(level: .warn, message: "RCTMGL - PointAnnotation.refresh: annotation not found")
1043
+ return
1044
1044
  }
1045
+
1046
+ manager.annotations[index] = annotation
1047
+ manager.syncSourceAndLayerIfNeeded()
1045
1048
  }
1046
1049
  }
@@ -29,7 +29,7 @@ extension RCTMGLMapViewManager {
29
29
  self.bridge.uiManager.addUIBlock { (manager, viewRegistry) in
30
30
  let view = viewRegistry![reactTag]
31
31
 
32
- guard let view = view! as? RCTMGLMapView else {
32
+ guard let view = view, let view = view as? RCTMGLMapView else {
33
33
  RCTMGLLogError("Invalid react tag, could not find RCTMGLMapView");
34
34
  rejecter(name, "Unknown find reactTag: \(reactTag)", nil)
35
35
  return;
@@ -188,7 +188,7 @@ extension RCTMGLMapViewManager {
188
188
  let point = CGPoint(x: CGFloat(point[0].floatValue), y: CGFloat(point[1].floatValue))
189
189
 
190
190
  logged("queryRenderedFeaturesAtPoint.option", rejecter: rejecter) {
191
- let options = try RenderedQueryOptions(layerIds: layerIDs, filter: filter?.asExpression())
191
+ let options = try RenderedQueryOptions(layerIds: (layerIDs ?? []).isEmpty ? nil : layerIDs, filter: filter?.asExpression())
192
192
 
193
193
  mapboxMap.queryRenderedFeatures(with: point, options: options) { result in
194
194
  switch result {