@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
@@ -70,7 +70,7 @@ public class RNMBXMarkerView: UIView, RNMBXMapComponent {
70
70
  // MARK: - Derived variables
71
71
 
72
72
  var annotationManager: ViewAnnotationManager? {
73
- self.map?.viewAnnotations
73
+ self.map?.mapView?.viewAnnotations
74
74
  }
75
75
 
76
76
  var point: Point? {
@@ -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 RNMBXMarkerViewProps>(props);
73
+ const auto &newProps = static_cast<const RNMBXMarkerViewProps &>(*props);
74
74
 
75
75
  id coordinate = RNMBXConvertFollyDynamicToId(newProps.coordinate);
76
76
  if (coordinate != nil) {
@@ -16,16 +16,17 @@ public class RNMBXNativeUserLocation : UIView, RNMBXMapComponent {
16
16
  }
17
17
 
18
18
  func _applySettings(_ map: RNMBXMapView) {
19
- map.location.options.puckType = .puck2D(.makeDefault(showBearing: iosShowsUserHeadingIndicator))
19
+ let location = map.mapView.location!
20
+ location.options.puckType = .puck2D(.makeDefault(showBearing: iosShowsUserHeadingIndicator))
20
21
  if (iosShowsUserHeadingIndicator) {
21
22
  #if RNMBX_11
22
- map.location.options.puckBearing = .heading
23
+ location.options.puckBearing = .heading
23
24
  #else
24
- map.location.options.puckBearingSource = .heading
25
+ location.options.puckBearingSource = .heading
25
26
  #endif
26
- map.location.options.puckBearingEnabled = true
27
+ location.options.puckBearingEnabled = true
27
28
  } else {
28
- map.location.options.puckBearingEnabled = false
29
+ location.options.puckBearingEnabled = false
29
30
  }
30
31
  }
31
32
 
@@ -35,12 +36,13 @@ public class RNMBXNativeUserLocation : UIView, RNMBXMapComponent {
35
36
  }
36
37
 
37
38
  func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
38
- map.location.options.puckType = nil
39
+ let location = map.mapView.location!
40
+ location.options.puckType = nil
39
41
  guard let mapboxMap = map.mapboxMap else {
40
42
  return true
41
43
  }
42
44
  let style = mapboxMap.style
43
- map.location.options.puckType = .none
45
+ location.options.puckType = .none
44
46
  self.map = nil
45
47
 
46
48
  return true
@@ -53,7 +53,7 @@ using namespace facebook::react;
53
53
 
54
54
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
55
55
  {
56
- const auto &newProps = *std::static_pointer_cast<const RNMBXNativeUserLocationProps>(props);
56
+ const auto &newProps = static_cast<const RNMBXNativeUserLocationProps &>(*props);
57
57
  id iosShowsUserHeadingIndicator = RNMBXConvertFollyDynamicToId(newProps.iosShowsUserHeadingIndicator);
58
58
  if (iosShowsUserHeadingIndicator != nil) {
59
59
  _view.iosShowsUserHeadingIndicator = iosShowsUserHeadingIndicator;
@@ -116,7 +116,7 @@ using namespace facebook::react;
116
116
 
117
117
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
118
118
  {
119
- const auto &newProps = *std::static_pointer_cast<const RNMBXPointAnnotationProps>(props);
119
+ const auto &newProps = static_cast<const RNMBXPointAnnotationProps &>(*props);
120
120
  id coordinate = RNMBXConvertFollyDynamicToId(newProps.coordinate);
121
121
  if (coordinate != nil) {
122
122
  _view.coordinate = coordinate;
@@ -71,7 +71,7 @@ using namespace facebook::react;
71
71
 
72
72
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
73
73
  {
74
- const auto &newProps = *std::static_pointer_cast<const RNMBXRasterDemSourceProps>(props);
74
+ const auto &newProps = static_cast<const RNMBXRasterDemSourceProps &>(*props);
75
75
  id idx = RNMBXConvertFollyDynamicToId(newProps.id);
76
76
  if (idx != nil) {
77
77
  _view.id = idx;
@@ -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 RNMBXRasterLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXRasterLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
  [super updateProps:props oldProps:oldProps];
@@ -71,7 +71,7 @@ using namespace facebook::react;
71
71
 
72
72
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
73
73
  {
74
- const auto &newProps = *std::static_pointer_cast<const RNMBXRasterSourceProps>(props);
74
+ const auto &newProps = static_cast<const RNMBXRasterSourceProps &>(*props);
75
75
  id idx = RNMBXConvertFollyDynamicToId(newProps.id);
76
76
  if (idx != nil) {
77
77
  _view.id = idx;
@@ -85,7 +85,7 @@ using namespace facebook::react;
85
85
 
86
86
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
87
87
  {
88
- const auto &newProps = *std::static_pointer_cast<const RNMBXShapeSourceProps>(props);
88
+ const auto &newProps = static_cast<const RNMBXShapeSourceProps &>(*props);
89
89
  id idx = RNMBXConvertFollyDynamicToId(newProps.id);
90
90
  if (idx != nil) {
91
91
  _view.id = idx;
@@ -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 RNMBXSkyLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXSkyLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerPropsWithoutSourceID(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 RNMBXSymbolLayerProps>(props);
51
+ const auto &newProps = static_cast<const RNMBXSymbolLayerProps &>(*props);
52
52
  RNMBXSetCommonLayerProps(newProps, _view);
53
53
 
54
54
  [super updateProps:props oldProps:oldProps];
@@ -54,7 +54,7 @@ using namespace facebook::react;
54
54
 
55
55
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
56
56
  {
57
- const auto &newProps = *std::static_pointer_cast<const RNMBXTerrainProps>(props);
57
+ const auto &newProps = static_cast<const RNMBXTerrainProps &>(*props);
58
58
 
59
59
  id sourceID = RNMBXConvertFollyDynamicToId(newProps.sourceID);
60
60
  if (sourceID != nil) {
@@ -84,7 +84,7 @@ using namespace facebook::react;
84
84
 
85
85
  - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
86
86
  {
87
- const auto &newProps = *std::static_pointer_cast<const RNMBXVectorSourceProps>(props);
87
+ const auto &newProps = static_cast<const RNMBXVectorSourceProps &>(*props);
88
88
  id idx = RNMBXConvertFollyDynamicToId(newProps.id);
89
89
  if (idx != nil) {
90
90
  _view.id = idx;
@@ -0,0 +1,58 @@
1
+
2
+ /**
3
+ * This mechanism allows to separate property updates from application of property updates. Usefull for delaying the propery updates
4
+ * because the object is not yet created for example. Or to apply multiple propery changes at once, as properties are not atomic.
5
+ *
6
+ * @sample
7
+ *
8
+ * class MapView {
9
+ * enum Property: String {
10
+ * case logo
11
+ * case compass
12
+ *
13
+ * var name string { return rawValue }
14
+ * fun apply(mapView: MapView) {
15
+ * switch self {
16
+ * case .logo: mapView.applyLogo()
17
+ * case .compass: mapView.applyCompass()
18
+ * }
19
+ * }
20
+ * val changes = PropertyChanges()
21
+ *
22
+ * var logoPosition: LogoPosition;
23
+ *
24
+ * . func changed(_ property: Property) {
25
+ * changes.add(property)
26
+ * . }
27
+ *
28
+ * func changed(name: String, apply: @escaping (MapView) -> Void) {
29
+ * changes.add(name: name, apply: apply)
30
+ * . }
31
+ *
32
+ * @objc override public func didSetProps(_ props: [String]) {
33
+ * changes.apply(self)
34
+ * }
35
+ * }
36
+ */
37
+
38
+ class PropertyChanges<T> {
39
+ var changes: [String: (T)->Void] = [:]
40
+ var uniqKey: Int = 0
41
+
42
+ func add(name: String, update: @escaping (T) -> Void) {
43
+ changes[name] = update
44
+ }
45
+
46
+ func add(update: @escaping (T) -> Void) {
47
+ let name = "#\(uniqKey)"
48
+ uniqKey += 1
49
+ changes[name] = update
50
+ }
51
+
52
+ func apply(_ target: T) {
53
+ changes.forEach { name, updater in
54
+ updater(target)
55
+ }
56
+ changes.removeAll()
57
+ }
58
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.1.0-beta.15",
4
+ "version": "10.1.0-beta.18",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -50,6 +50,7 @@
50
50
  "type:check": "yarn tsc --noEmit",
51
51
  "test:plugin": "yarn expo-module test plugin",
52
52
  "build:plugin": "yarn tsc --build plugin",
53
+ "build:examples.json": "cd example; jest __tests__/dumpExamplesJson.ts",
53
54
  "lint:plugin": "yarn eslint plugin/src/*",
54
55
  "build": "yarn bob build",
55
56
  "prepare": "yarn bob build && yarn husky install"