@rnmapbox/maps 10.1.0-beta.15 → 10.1.0-beta.18

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 (42) hide show
  1. package/android/build.gradle +1 -0
  2. package/android/src/main/AndroidManifest.xml +1 -1
  3. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +3 -3
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotation.kt +5 -0
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.kt +14 -1
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImage.kt +5 -0
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImageManager.kt +14 -1
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSource.kt +5 -0
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +13 -1
  10. package/android/src/main/java/com/rnmapbox/rnmbx/utils/PropertyChanges.kt +1 -1
  11. package/ios/RNMBX/RNMBXAtmosphereComponentView.mm +1 -1
  12. package/ios/RNMBX/RNMBXBackgroundLayerComponentView.mm +1 -1
  13. package/ios/RNMBX/RNMBXCalloutComponentView.mm +1 -1
  14. package/ios/RNMBX/RNMBXCamera.swift +4 -4
  15. package/ios/RNMBX/RNMBXCameraComponentView.mm +1 -1
  16. package/ios/RNMBX/RNMBXCircleLayerComponentView.mm +1 -1
  17. package/ios/RNMBX/RNMBXFillExtrusionLayerComponentView.mm +1 -1
  18. package/ios/RNMBX/RNMBXFillLayerComponentView.mm +1 -1
  19. package/ios/RNMBX/RNMBXHeatmapLayerComponentView.mm +1 -1
  20. package/ios/RNMBX/RNMBXImageComponentView.mm +1 -1
  21. package/ios/RNMBX/RNMBXImageSourceComponentView.mm +1 -1
  22. package/ios/RNMBX/RNMBXImages.swift +2 -2
  23. package/ios/RNMBX/RNMBXImagesComponentView.mm +1 -1
  24. package/ios/RNMBX/RNMBXLightComponentView.mm +1 -1
  25. package/ios/RNMBX/RNMBXLineLayerComponentView.mm +1 -1
  26. package/ios/RNMBX/RNMBXMapView.swift +326 -136
  27. package/ios/RNMBX/RNMBXMapViewComponentView.mm +1 -1
  28. package/ios/RNMBX/RNMBXMarkerView.swift +1 -1
  29. package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +1 -1
  30. package/ios/RNMBX/RNMBXNativeUserLocation.swift +9 -7
  31. package/ios/RNMBX/RNMBXNativeUserLocationComponentView.mm +1 -1
  32. package/ios/RNMBX/RNMBXPointAnnotationComponentView.mm +1 -1
  33. package/ios/RNMBX/RNMBXRasterDemSourceComponentView.mm +1 -1
  34. package/ios/RNMBX/RNMBXRasterLayerComponentView.mm +1 -1
  35. package/ios/RNMBX/RNMBXRasterSourceComponentView.mm +1 -1
  36. package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +1 -1
  37. package/ios/RNMBX/RNMBXSkyLayerComponentView.mm +1 -1
  38. package/ios/RNMBX/RNMBXSymbolLayerComponentView.mm +1 -1
  39. package/ios/RNMBX/RNMBXTerrainComponentView.mm +1 -1
  40. package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +1 -1
  41. package/ios/RNMBX/Uitls/PropertyChanges.swift +58 -0
  42. package/package.json +2 -1
@@ -43,6 +43,7 @@ if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
43
43
  }
44
44
 
45
45
  android {
46
+ namespace = "com.rnmapbox.rnmbx"
46
47
  if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "maplibre") {
47
48
  msg = '@rnmapbox/maps: Maplibre implementation has been removed, set RNMapboxMapsImpl to mapbox- see https://github.com/rnmapbox/maps/wiki/Deprecated-RNMapboxImpl-Maplibre#android'
48
49
  logger.error(msg)
@@ -1,4 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.rnmapbox.rnmbx">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
2
  <uses-permission android:name="android.permission.INTERNET" />
3
3
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
4
4
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
@@ -90,20 +90,20 @@ class RNMBXPackage : TurboReactPackage() {
90
90
 
91
91
  // annotations
92
92
  managers.add(RNMBXMarkerViewManager(reactApplicationContext))
93
- managers.add(RNMBXPointAnnotationManager(reactApplicationContext))
93
+ managers.add(RNMBXPointAnnotationManager(reactApplicationContext, getViewTagResolver(reactApplicationContext)))
94
94
  managers.add(RNMBXCalloutManager())
95
95
  managers.add(RNMBXNativeUserLocationManager())
96
96
 
97
97
  // sources
98
98
  managers.add(RNMBXVectorSourceManager(reactApplicationContext))
99
- managers.add(RNMBXShapeSourceManager(reactApplicationContext))
99
+ managers.add(RNMBXShapeSourceManager(reactApplicationContext, getViewTagResolver(reactApplicationContext)))
100
100
  managers.add(RNMBXRasterDemSourceManager(reactApplicationContext))
101
101
  managers.add(RNMBXRasterSourceManager(reactApplicationContext))
102
102
  managers.add(RNMBXImageSourceManager())
103
103
 
104
104
  // images
105
105
  managers.add(RNMBXImagesManager(reactApplicationContext))
106
- managers.add(RNMBXImageManager(reactApplicationContext))
106
+ managers.add(RNMBXImageManager(reactApplicationContext, getViewTagResolver(reactApplicationContext)))
107
107
 
108
108
  // layers
109
109
  managers.add(RNMBXFillLayerManager())
@@ -74,6 +74,11 @@ class RNMBXPointAnnotation(private val mContext: Context, private val mManager:
74
74
  mMapView?.offscreenAnnotationViewContainer?.removeView(childView)
75
75
  }
76
76
 
77
+ override fun setId(id: Int) {
78
+ super.setId(id)
79
+ mManager.tagAssigned(id)
80
+ }
81
+
77
82
  override fun addToMap(mapView: RNMBXMapView) {
78
83
  super.addToMap(mapView)
79
84
  mMap = mapView.getMapboxMap()
@@ -9,10 +9,12 @@ import com.facebook.react.uimanager.annotations.ReactProp
9
9
  import com.facebook.react.viewmanagers.RNMBXPointAnnotationManagerDelegate
10
10
  import com.facebook.react.viewmanagers.RNMBXPointAnnotationManagerInterface
11
11
  import com.rnmapbox.rnmbx.components.AbstractEventEmitter
12
+ import com.rnmapbox.rnmbx.components.styles.sources.RNMBXShapeSource
12
13
  import com.rnmapbox.rnmbx.events.constants.EventKeys
13
14
  import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toPointGeometry
15
+ import com.rnmapbox.rnmbx.utils.ViewTagResolver
14
16
 
15
- class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationContext) : AbstractEventEmitter<RNMBXPointAnnotation>(reactApplicationContext),
17
+ class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : AbstractEventEmitter<RNMBXPointAnnotation>(reactApplicationContext),
16
18
  RNMBXPointAnnotationManagerInterface<RNMBXPointAnnotation> {
17
19
 
18
20
  private val mDelegate: ViewManagerDelegate<RNMBXPointAnnotation>
@@ -44,6 +46,17 @@ class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationConte
44
46
  return RNMBXPointAnnotation(reactContext!!, this)
45
47
  }
46
48
 
49
+ override fun onDropViewInstance(view: RNMBXPointAnnotation) {
50
+ val reactTag = view.id
51
+
52
+ viewTagResolver.viewRemoved(reactTag)
53
+ super.onDropViewInstance(view)
54
+ }
55
+
56
+ fun tagAssigned(reactTag: Int) {
57
+ return viewTagResolver.tagAssigned(reactTag)
58
+ }
59
+
47
60
  @ReactProp(name = "id")
48
61
  override fun setId(annotation: RNMBXPointAnnotation, id: Dynamic) {
49
62
  annotation.iD = id.asString()
@@ -28,6 +28,11 @@ class RNMBXImage(private val mContext: ReactApplicationContext, private val mMan
28
28
 
29
29
  var mBitmap : Bitmap? = null
30
30
 
31
+ override fun setId(id: Int) {
32
+ super.setId(id)
33
+ mManager.tagAssigned(id)
34
+ }
35
+
31
36
  override fun onLayoutChange(v: View, left: Int, top: Int, right: Int, bottom: Int, oldLeft: Int, oldTop: Int,
32
37
  oldRight: Int, oldBottom: Int) {
33
38
  if (left == 0 && top == 0 && right == 0 && bottom == 0) {
@@ -7,8 +7,10 @@ import com.facebook.react.uimanager.ThemedReactContext
7
7
  import com.facebook.react.uimanager.annotations.ReactProp
8
8
  import com.facebook.react.viewmanagers.RNMBXImageManagerInterface
9
9
  import com.rnmapbox.rnmbx.components.AbstractEventEmitter
10
+ import com.rnmapbox.rnmbx.components.styles.sources.RNMBXShapeSource
11
+ import com.rnmapbox.rnmbx.utils.ViewTagResolver
10
12
 
11
- class RNMBXImageManager(private val mContext: ReactApplicationContext) : AbstractEventEmitter<RNMBXImage>(
13
+ class RNMBXImageManager(private val mContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : AbstractEventEmitter<RNMBXImage>(
12
14
  mContext
13
15
  ), RNMBXImageManagerInterface<RNMBXImage> {
14
16
  override fun getName(): String {
@@ -23,6 +25,17 @@ mContext
23
25
  return mutableMapOf();
24
26
  }
25
27
 
28
+ override fun onDropViewInstance(view: RNMBXImage) {
29
+ val reactTag = view.id
30
+
31
+ viewTagResolver.viewRemoved(reactTag)
32
+ super.onDropViewInstance(view)
33
+ }
34
+
35
+ fun tagAssigned(reactTag: Int) {
36
+ return viewTagResolver.tagAssigned(reactTag)
37
+ }
38
+
26
39
  // region React properties
27
40
  @ReactProp(name="name")
28
41
  override fun setName(image: RNMBXImage, value: Dynamic) {
@@ -48,6 +48,11 @@ class RNMBXShapeSource(context: Context, private val mManager: RNMBXShapeSourceM
48
48
  }
49
49
  }
50
50
 
51
+ override fun setId(id: Int) {
52
+ super.setId(id)
53
+ mManager.tagAssigned(id)
54
+ }
55
+
51
56
  override fun makeSource(): GeoJsonSource {
52
57
  val builder = GeoJsonSource.Builder(iD.toString())
53
58
  getOptions(builder)
@@ -14,13 +14,14 @@ import com.mapbox.maps.extension.style.expressions.generated.Expression
14
14
  import com.rnmapbox.rnmbx.events.constants.EventKeys
15
15
  import com.rnmapbox.rnmbx.utils.ExpressionParser
16
16
  import com.rnmapbox.rnmbx.utils.Logger
17
+ import com.rnmapbox.rnmbx.utils.ViewTagResolver
17
18
  import java.net.MalformedURLException
18
19
  import java.net.URL
19
20
  import java.util.ArrayList
20
21
  import java.util.HashMap
21
22
 
22
23
 
23
- class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext) :
24
+ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) :
24
25
  AbstractEventEmitter<RNMBXShapeSource>(
25
26
  mContext
26
27
  ), RNMBXShapeSourceManagerInterface<RNMBXShapeSource> {
@@ -48,6 +49,17 @@ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext) :
48
49
  source.removeLayer(childPosition)
49
50
  }
50
51
 
52
+ override fun onDropViewInstance(view: RNMBXShapeSource) {
53
+ val reactTag = view.id
54
+
55
+ viewTagResolver.viewRemoved(reactTag)
56
+ super.onDropViewInstance(view)
57
+ }
58
+
59
+ fun tagAssigned(reactTag: Int) {
60
+ return viewTagResolver.tagAssigned(reactTag)
61
+ }
62
+
51
63
  @ReactProp(name = "id")
52
64
  override fun setId(source: RNMBXShapeSource, id: Dynamic) {
53
65
  source.iD = id.asString()
@@ -61,8 +61,8 @@ class PropertyChanges<T : Any> {
61
61
 
62
62
  fun apply(target: T) {
63
63
  for (entry in changes.entries.iterator()) {
64
- print("key => ${entry.key}")
65
64
  entry.value.apply(target)
66
65
  }
66
+ changes.clear()
67
67
  }
68
68
  }
@@ -50,7 +50,7 @@ using namespace facebook::react;
50
50
 
51
51
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
52
52
  {
53
- const auto &newProps = *std::static_pointer_cast<const RNMBXAtmosphereProps>(props);
53
+ const auto &newProps = static_cast<const RNMBXAtmosphereProps &>(*props);
54
54
  id reactStyle = RNMBXConvertFollyDynamicToId(newProps.reactStyle);
55
55
  if (reactStyle != nil) {
56
56
  _view.reactStyle = reactStyle;
@@ -48,7 +48,7 @@ using namespace facebook::react;
48
48
 
49
49
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
50
50
  {
51
- const auto &newProps = *std::static_pointer_cast<const RNMBXBackgroundLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXBackgroundLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerPropsWithoutSourceID(newProps, _view);
53
53
 
54
54
 
@@ -42,7 +42,7 @@ using namespace facebook::react;
42
42
 
43
43
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
44
44
  {
45
- const auto &newProps = *std::static_pointer_cast<const RNMBXCalloutProps>(props);
45
+ const auto &newProps = static_cast<const RNMBXCalloutProps &>(*props);
46
46
 
47
47
  [super updateProps:props oldProps:oldProps];
48
48
  }
@@ -42,11 +42,11 @@ struct CameraUpdateItem {
42
42
  }
43
43
  switch mode {
44
44
  case .flight:
45
- map.camera.fly(to: camera, duration: duration)
45
+ map.mapView.camera.fly(to: camera, duration: duration)
46
46
  case .ease:
47
- map.camera.ease(to: camera, duration: duration ?? 0, curve: .easeInOut, completion: nil)
47
+ map.mapView.camera.ease(to: camera, duration: duration ?? 0, curve: .easeInOut, completion: nil)
48
48
  case .linear:
49
- map.camera.ease(to: camera, duration: duration ?? 0, curve: .linear, completion: nil)
49
+ map.mapView.camera.ease(to: camera, duration: duration ?? 0, curve: .linear, completion: nil)
50
50
  default:
51
51
  map.mapboxMap.setCamera(to: camera)
52
52
  }
@@ -524,7 +524,7 @@ open class RNMBXCamera : RNMBXMapComponentBase {
524
524
  return false
525
525
  }
526
526
 
527
- map.viewport.removeStatusObserver(self)
527
+ map.mapView.viewport.removeStatusObserver(self)
528
528
  return super.removeFromMap(map, reason:reason)
529
529
  }
530
530
  }
@@ -69,7 +69,7 @@ using namespace facebook::react;
69
69
 
70
70
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
71
71
  {
72
- const auto &newProps = *std::static_pointer_cast<const RNMBXCameraProps>(props);
72
+ const auto &newProps = static_cast<const RNMBXCameraProps &>(*props);
73
73
  id maxBounds = RNMBXConvertFollyDynamicToId(newProps.maxBounds);
74
74
  if (maxBounds != nil) {
75
75
  _view.maxBounds = maxBounds;
@@ -48,7 +48,7 @@ using namespace facebook::react;
48
48
 
49
49
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
50
50
  {
51
- const auto &newProps = *std::static_pointer_cast<const RNMBXCircleLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXCircleLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
  [super updateProps:props oldProps:oldProps];
@@ -48,7 +48,7 @@ using namespace facebook::react;
48
48
 
49
49
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
50
50
  {
51
- const auto &newProps = *std::static_pointer_cast<const RNMBXFillExtrusionLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXFillExtrusionLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
 
@@ -48,7 +48,7 @@ using namespace facebook::react;
48
48
 
49
49
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
50
50
  {
51
- const auto &newProps = *std::static_pointer_cast<const RNMBXFillLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXFillLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
  [super updateProps:props oldProps:oldProps];
@@ -47,7 +47,7 @@ using namespace facebook::react;
47
47
 
48
48
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
49
49
  {
50
- const auto &newProps = *std::static_pointer_cast<const RNMBXHeatmapLayerProps>(props);
50
+ const auto &newProps = static_cast<const RNMBXHeatmapLayerProps &>(*props);
51
51
  RNMBXSetCommonLayerProps(newProps, _view);
52
52
 
53
53
 
@@ -65,7 +65,7 @@ using namespace facebook::react;
65
65
 
66
66
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
67
67
  {
68
- const auto &newProps = *std::static_pointer_cast<const RNMBXImageProps>(props);
68
+ const auto &newProps = static_cast<const RNMBXImageProps &>(*props);
69
69
  id stretchX = RNMBXConvertFollyDynamicToId(newProps.stretchX);
70
70
  if (stretchX != nil) {
71
71
  _view.stretchX = stretchX;
@@ -70,7 +70,7 @@ using namespace facebook::react;
70
70
 
71
71
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
72
72
  {
73
- const auto &newProps = *std::static_pointer_cast<const RNMBXImageSourceProps>(props);
73
+ const auto &newProps = static_cast<const RNMBXImageSourceProps &>(*props);
74
74
  id idx = RNMBXConvertFollyDynamicToId(newProps.id);
75
75
  if (idx != nil) {
76
76
  _view.id = idx;
@@ -116,7 +116,7 @@ open class RNMBXImages : UIView, RNMBXMapComponent {
116
116
  if !sameImage(oldValue: oldImages[name], newValue: images[name]) {
117
117
  missingImages[name] = images[name]
118
118
  } else {
119
- if hasImage(style: style, name: name) {
119
+ if !hasImage(style: style, name: name) {
120
120
  logged("RNMBXImages.addImagePlaceholder") {
121
121
  try style.addImage(placeholderImage, id: name, stretchX: [], stretchY: [])
122
122
  missingImages[name] = images[name]
@@ -243,7 +243,7 @@ open class RNMBXImages : UIView, RNMBXMapComponent {
243
243
  func addNativeImages(style: Style, nativeImages: [NativeImageInfo]) {
244
244
  for imageInfo in nativeImages {
245
245
  let imageName = imageInfo.name
246
- if hasImage(style: style, name:imageName) {
246
+ if !hasImage(style: style, name: imageName) {
247
247
  if let image = UIImage(named: imageName) {
248
248
  logged("RNMBXImage.addNativeImage: \(imageName)") {
249
249
  try style.addImage(image, id: imageName, sdf: imageInfo.sdf,
@@ -68,7 +68,7 @@ using namespace facebook::react;
68
68
 
69
69
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
70
70
  {
71
- const auto &newProps = *std::static_pointer_cast<const RNMBXImagesProps>(props);
71
+ const auto &newProps = static_cast<const RNMBXImagesProps &>(*props);
72
72
  id images = RNMBXConvertFollyDynamicToId(newProps.images);
73
73
  if (images != nil) {
74
74
  _view.images = images;
@@ -49,7 +49,7 @@ using namespace facebook::react;
49
49
 
50
50
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
51
51
  {
52
- const auto &newProps = *std::static_pointer_cast<const RNMBXLightProps>(props);
52
+ const auto &newProps = static_cast<const RNMBXLightProps &>(*props);
53
53
  id reactStyle = RNMBXConvertFollyDynamicToId(newProps.reactStyle);
54
54
  if (reactStyle != nil) {
55
55
  _view.reactStyle = reactStyle;
@@ -48,7 +48,7 @@ using namespace facebook::react;
48
48
 
49
49
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
50
50
  {
51
- const auto &newProps = *std::static_pointer_cast<const RNMBXLineLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXLineLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
  [super updateProps:props oldProps:oldProps];