@rnmapbox/maps 10.2.6 → 10.2.8
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/android/build.gradle +9 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +8 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +180 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +4 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/CustomHttpHeaders.kt +31 -9
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +15 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXOfflineModuleLegacy.kt +10 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/layers/generated/RasterParticleLayer.kt +58 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/sources/generated/RasterArraySource.kt +20 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +22 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +16 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +45 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +38 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +85 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +41 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +76 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerDelegate.java +54 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerInterface.java +23 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerDelegate.java +66 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerInterface.java +27 -0
- package/ios/RNMBX/CustomHttpHeaders.swift +36 -7
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +2 -0
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.swift +5 -0
- package/ios/RNMBX/RNMBXCamera.swift +88 -17
- package/ios/RNMBX/RNMBXCameraModule.h +3 -2
- package/ios/RNMBX/RNMBXCameraModule.mm +8 -16
- package/ios/RNMBX/RNMBXCustomLocationProvider.swift +18 -24
- package/ios/RNMBX/RNMBXImageModule.h +3 -2
- package/ios/RNMBX/RNMBXImageModule.mm +8 -16
- package/ios/RNMBX/RNMBXImages.swift +1 -4
- package/ios/RNMBX/RNMBXInteractiveElement.swift +22 -15
- package/ios/RNMBX/RNMBXMapView.swift +68 -6
- package/ios/RNMBX/RNMBXModule.m +1 -0
- package/ios/RNMBX/RNMBXModule.swift +16 -2
- package/ios/RNMBX/RNMBXNativeUserLocation.swift +6 -6
- package/ios/RNMBX/RNMBXPointAnnotation.swift +6 -8
- package/ios/RNMBX/RNMBXPointAnnotationModule.h +3 -2
- package/ios/RNMBX/RNMBXPointAnnotationModule.mm +8 -16
- package/ios/RNMBX/RNMBXRasterArraySource.swift +47 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.mm +168 -0
- package/ios/RNMBX/RNMBXRasterArraySourceViewManager.swift +16 -0
- package/ios/RNMBX/RNMBXRasterParticleLayer.swift +100 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.mm +121 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerViewManager.swift +17 -0
- package/ios/RNMBX/RNMBXShapeSource.swift +5 -4
- package/ios/RNMBX/RNMBXShapeSourceModule.h +3 -2
- package/ios/RNMBX/RNMBXShapeSourceModule.mm +8 -16
- package/ios/RNMBX/RNMBXSource.swift +51 -21
- package/ios/RNMBX/RNMBXStyle.swift +152 -27
- package/ios/RNMBX/RNMBXStyleValue.swift +27 -0
- package/ios/RNMBX/RNMBXViewport.swift +13 -13
- package/ios/RNMBX/RNMBXViewportModule.h +3 -2
- package/ios/RNMBX/RNMBXViewportModule.mm +8 -16
- package/ios/RNMBX/Utils/RNMBXViewResolver.mm +15 -2
- package/lib/commonjs/plugin/build/withMapbox.js +8 -8
- package/lib/commonjs/plugin/src/withMapbox.ts +18 -8
- package/lib/module/Mapbox.native.js +2 -0
- package/lib/module/Mapbox.native.js.map +1 -1
- package/lib/module/RNMBXModule.js +15 -1
- package/lib/module/RNMBXModule.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterArraySource.js +67 -0
- package/lib/module/components/RasterArraySource.js.map +1 -0
- package/lib/module/components/RasterParticleLayer.js +40 -0
- package/lib/module/components/RasterParticleLayer.js.map +1 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js +14 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js.map +1 -1
- package/lib/module/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/lib/module/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/lib/module/utils/MapboxStyles.js.map +1 -1
- package/lib/module/utils/styleMap.js +9 -0
- package/lib/module/utils/styleMap.js.map +1 -1
- package/lib/typescript/plugin/build/withMapbox.d.ts +1 -6
- package/lib/typescript/plugin/build/withMapbox.d.ts.map +1 -1
- package/lib/typescript/plugin/src/withMapbox.d.ts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts.map +1 -1
- package/lib/typescript/src/Mapbox.native.d.ts +3 -1
- package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts +11 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/src/components/RasterArraySource.d.ts +72 -0
- package/lib/typescript/src/components/RasterArraySource.d.ts.map +1 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts +80 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts.map +1 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts +11 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts +16 -0
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts +25 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/utils/MapboxStyles.d.ts +44 -2
- package/lib/typescript/src/utils/MapboxStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/styleMap.d.ts.map +1 -1
- package/package.json +13 -1
- package/plugin/build/withMapbox.js +8 -8
- package/plugin/src/withMapbox.ts +18 -8
- package/rnmapbox-maps.podspec +1 -1
- package/src/Mapbox.native.ts +3 -0
- package/src/RNMBXModule.ts +25 -2
- package/src/components/PointAnnotation.tsx +2 -2
- package/src/components/RasterArraySource.tsx +134 -0
- package/src/components/RasterParticleLayer.tsx +117 -0
- package/src/modules/offline/offlineManagerLegacy.ts +14 -0
- package/src/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/src/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/src/utils/MapboxStyles.ts +47 -1
- package/src/utils/styleMap.ts +10 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@objc
|
|
4
4
|
public class RNMBXSource : RNMBXInteractiveElement {
|
|
5
5
|
var layers: [RNMBXSourceConsumer] = []
|
|
6
|
-
var components: [
|
|
6
|
+
var components: [RNMBXMapComponentProtocol] = [] // Use base protocol to store both types
|
|
7
7
|
|
|
8
8
|
var source : Source? = nil
|
|
9
9
|
|
|
@@ -38,34 +38,50 @@ public class RNMBXSource : RNMBXInteractiveElement {
|
|
|
38
38
|
|
|
39
39
|
@objc public func insertReactSubviewInternal(_ subview: UIView!, at atIndex: Int) {
|
|
40
40
|
if let layer = subview as? RNMBXSourceConsumer {
|
|
41
|
-
if let map = map {
|
|
42
|
-
layer.addToMap(map, style:
|
|
41
|
+
if let map = map, let mapView = mapView {
|
|
42
|
+
layer.addToMap(map, style: mapView.mapboxMap.style)
|
|
43
43
|
}
|
|
44
44
|
layers.append(layer)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
}
|
|
46
|
+
// Check for more specific protocol first (RNMBXMapAndMapViewComponent is a subtype of RNMBXMapComponent)
|
|
47
|
+
else if let mapAndMapViewComponent = subview as? RNMBXMapAndMapViewComponent {
|
|
48
|
+
if let map = map, let mapView = mapView {
|
|
49
|
+
mapAndMapViewComponent.addToMap(map, mapView: mapView, style: mapView.mapboxMap.style)
|
|
50
|
+
}
|
|
51
|
+
components.append(mapAndMapViewComponent)
|
|
52
|
+
}
|
|
53
|
+
else if let component = subview as? RNMBXMapComponent {
|
|
54
|
+
if let map = map, let mapView = mapView {
|
|
55
|
+
component.addToMap(map, style: mapView.mapboxMap.style)
|
|
48
56
|
}
|
|
49
57
|
components.append(component)
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
|
-
|
|
60
|
+
|
|
53
61
|
@objc public override func removeReactSubview(_ subview: UIView!) {
|
|
54
62
|
removeReactSubviewInternal(subview)
|
|
55
63
|
super.removeReactSubview(subview)
|
|
56
64
|
}
|
|
57
|
-
|
|
65
|
+
|
|
58
66
|
@objc public func removeReactSubviewInternal(_ subview: UIView!) {
|
|
59
67
|
if let layer : RNMBXSourceConsumer = subview as? RNMBXSourceConsumer {
|
|
60
|
-
if let map = map {
|
|
61
|
-
layer.removeFromMap(map, style:
|
|
68
|
+
if let map = map, let mapView = mapView {
|
|
69
|
+
layer.removeFromMap(map, style: mapView.mapboxMap.style)
|
|
62
70
|
}
|
|
63
71
|
layers.removeAll { $0 as AnyObject === layer }
|
|
64
|
-
}
|
|
72
|
+
}
|
|
73
|
+
// Check for more specific protocol first (RNMBXMapAndMapViewComponent is a subtype of RNMBXMapComponent)
|
|
74
|
+
else if let mapAndMapViewComponent = subview as? RNMBXMapAndMapViewComponent {
|
|
75
|
+
if let map = map, let mapView = mapView {
|
|
76
|
+
mapAndMapViewComponent.removeFromMap(map, mapView: mapView, reason: .ViewRemoval)
|
|
77
|
+
}
|
|
78
|
+
components.removeAll { $0 as AnyObject === mapAndMapViewComponent }
|
|
79
|
+
}
|
|
80
|
+
else if let component = subview as? RNMBXMapComponent {
|
|
65
81
|
if let map = map {
|
|
66
82
|
component.removeFromMap(map, reason: .ViewRemoval)
|
|
67
83
|
}
|
|
68
|
-
|
|
84
|
+
components.removeAll { $0 as AnyObject === component }
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
87
|
|
|
@@ -75,9 +91,9 @@ public class RNMBXSource : RNMBXInteractiveElement {
|
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
// MARK: - RNMBXInteractiveElement
|
|
78
|
-
|
|
79
|
-
public override func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
80
|
-
|
|
94
|
+
|
|
95
|
+
public override func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
96
|
+
super.addToMap(map, mapView: mapView, style: style)
|
|
81
97
|
|
|
82
98
|
if style.sourceExists(withId: self.id) {
|
|
83
99
|
if (!existing) {
|
|
@@ -101,22 +117,36 @@ public class RNMBXSource : RNMBXInteractiveElement {
|
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
for layer in self.layers {
|
|
104
|
-
layer.addToMap(map, style:
|
|
120
|
+
layer.addToMap(map, style: style)
|
|
105
121
|
}
|
|
106
122
|
for component in self.components {
|
|
107
|
-
|
|
123
|
+
// Check for more specific protocol first
|
|
124
|
+
if let mapAndMapViewComponent = component as? RNMBXMapAndMapViewComponent {
|
|
125
|
+
mapAndMapViewComponent.addToMap(map, mapView: mapView, style: style)
|
|
126
|
+
} else if let mapComponent = component as? RNMBXMapComponent {
|
|
127
|
+
mapComponent.addToMap(map, style: style)
|
|
128
|
+
}
|
|
108
129
|
}
|
|
109
130
|
}
|
|
110
131
|
|
|
111
|
-
public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
112
|
-
|
|
132
|
+
public override func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
133
|
+
super.removeFromMap(map, mapView: mapView, reason: reason)
|
|
113
134
|
|
|
114
135
|
for layer in self.layers {
|
|
115
|
-
layer.removeFromMap(map, style:
|
|
136
|
+
layer.removeFromMap(map, style: mapView.mapboxMap.style)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for component in self.components {
|
|
140
|
+
// Check for more specific protocol first
|
|
141
|
+
if let mapAndMapViewComponent = component as? RNMBXMapAndMapViewComponent {
|
|
142
|
+
mapAndMapViewComponent.removeFromMap(map, mapView: mapView, reason: reason)
|
|
143
|
+
} else if let mapComponent = component as? RNMBXMapComponent {
|
|
144
|
+
mapComponent.removeFromMap(map, reason: reason)
|
|
145
|
+
}
|
|
116
146
|
}
|
|
117
147
|
|
|
118
148
|
if self.ownsSource {
|
|
119
|
-
let style =
|
|
149
|
+
let style = mapView.mapboxMap.style
|
|
120
150
|
logged("StyleSource.removeFromMap", info: { "id: \(optional: self.id)"}) {
|
|
121
151
|
try style.removeSource(withId: id)
|
|
122
152
|
}
|
|
@@ -27,7 +27,7 @@ func fillLayer(layer: inout FillLayer, reactStyle:Dictionary<String, Any>, oldRe
|
|
|
27
27
|
|
|
28
28
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
if (prop == "fillSortKey") {
|
|
31
31
|
self.setFillSortKey(&layer, styleValue:styleValue);
|
|
32
32
|
} else if (prop == "visibility") {
|
|
33
33
|
self.setFillStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
@@ -78,7 +78,7 @@ func fillLayer(layer: inout FillLayer, reactStyle:Dictionary<String, Any>, oldRe
|
|
|
78
78
|
} else {
|
|
79
79
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: fill")
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout LineLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -96,7 +96,7 @@ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, oldRe
|
|
|
96
96
|
|
|
97
97
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
if (prop == "lineCap") {
|
|
100
100
|
self.setLineCap(&layer, styleValue:styleValue);
|
|
101
101
|
} else if (prop == "lineJoin") {
|
|
102
102
|
self.setLineJoin(&layer, styleValue:styleValue);
|
|
@@ -187,7 +187,7 @@ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, oldRe
|
|
|
187
187
|
} else {
|
|
188
188
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: line")
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout SymbolLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -205,7 +205,7 @@ func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
205
205
|
|
|
206
206
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
if (prop == "symbolPlacement") {
|
|
209
209
|
self.setSymbolPlacement(&layer, styleValue:styleValue);
|
|
210
210
|
} else if (prop == "symbolSpacing") {
|
|
211
211
|
self.setSymbolSpacing(&layer, styleValue:styleValue);
|
|
@@ -388,7 +388,7 @@ func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
388
388
|
} else {
|
|
389
389
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: symbol")
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
}
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout CircleLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -406,7 +406,7 @@ func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
406
406
|
|
|
407
407
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
if (prop == "circleSortKey") {
|
|
410
410
|
self.setCircleSortKey(&layer, styleValue:styleValue);
|
|
411
411
|
} else if (prop == "visibility") {
|
|
412
412
|
self.setCircleStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
@@ -457,7 +457,7 @@ func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
457
457
|
} else {
|
|
458
458
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: circle")
|
|
459
459
|
}
|
|
460
|
-
|
|
460
|
+
}
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout HeatmapLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -475,7 +475,7 @@ func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>,
|
|
|
475
475
|
|
|
476
476
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
if (prop == "visibility") {
|
|
479
479
|
self.setHeatmapStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
480
480
|
} else if (prop == "heatmapRadius") {
|
|
481
481
|
self.setHeatmapRadius(&layer, styleValue:styleValue);
|
|
@@ -496,7 +496,7 @@ func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>,
|
|
|
496
496
|
} else {
|
|
497
497
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: heatmap")
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
}
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout FillExtrusionLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -514,7 +514,7 @@ func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<S
|
|
|
514
514
|
|
|
515
515
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
516
516
|
|
|
517
|
-
|
|
517
|
+
if (prop == "visibility") {
|
|
518
518
|
self.setFillExtrusionStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
519
519
|
} else if (prop == "fillExtrusionEdgeRadius") {
|
|
520
520
|
self.setFillExtrusionEdgeRadius(&layer, styleValue:styleValue);
|
|
@@ -625,7 +625,7 @@ func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<S
|
|
|
625
625
|
} else {
|
|
626
626
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: fill-extrusion")
|
|
627
627
|
}
|
|
628
|
-
|
|
628
|
+
}
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout RasterLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -643,7 +643,7 @@ func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
643
643
|
|
|
644
644
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
645
645
|
|
|
646
|
-
|
|
646
|
+
if (prop == "visibility") {
|
|
647
647
|
self.setRasterStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
648
648
|
} else if (prop == "rasterOpacity") {
|
|
649
649
|
self.setRasterOpacity(&layer, styleValue:styleValue);
|
|
@@ -696,8 +696,51 @@ func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, o
|
|
|
696
696
|
} else {
|
|
697
697
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: raster")
|
|
698
698
|
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
#if RNMBX_11
|
|
703
|
+
func rasterParticleLayer(layer: inout RasterParticleLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout RasterParticleLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
704
|
+
{
|
|
705
|
+
guard self._hasReactStyle(reactStyle) else {
|
|
706
|
+
Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
|
|
707
|
+
return
|
|
699
708
|
}
|
|
709
|
+
|
|
710
|
+
let styleProps = reactStyle.keys
|
|
711
|
+
for prop in styleProps {
|
|
712
|
+
if (prop == "__MAPBOX_STYLESHEET__") {
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
717
|
+
|
|
718
|
+
if (prop == "visibility") {
|
|
719
|
+
self.setRasterParticleStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
720
|
+
} else if (prop == "rasterParticleArrayBand") {
|
|
721
|
+
self.setRasterParticleArrayBand(&layer, styleValue:styleValue);
|
|
722
|
+
} else if (prop == "rasterParticleCount") {
|
|
723
|
+
self.setRasterParticleCount(&layer, styleValue:styleValue);
|
|
724
|
+
} else if (prop == "rasterParticleColor") {
|
|
725
|
+
self.setRasterParticleColor(&layer, styleValue:styleValue);
|
|
726
|
+
} else if (prop == "rasterParticleMaxSpeed") {
|
|
727
|
+
self.setRasterParticleMaxSpeed(&layer, styleValue:styleValue);
|
|
728
|
+
} else if (prop == "rasterParticleSpeedFactor") {
|
|
729
|
+
self.setRasterParticleSpeedFactor(&layer, styleValue:styleValue);
|
|
730
|
+
} else if (prop == "rasterParticleSpeedFactorTransition") {
|
|
731
|
+
self.setRasterParticleSpeedFactorTransition(&layer, styleValue:styleValue);
|
|
732
|
+
} else if (prop == "rasterParticleFadeOpacityFactor") {
|
|
733
|
+
self.setRasterParticleFadeOpacityFactor(&layer, styleValue:styleValue);
|
|
734
|
+
} else if (prop == "rasterParticleFadeOpacityFactorTransition") {
|
|
735
|
+
self.setRasterParticleFadeOpacityFactorTransition(&layer, styleValue:styleValue);
|
|
736
|
+
} else if (prop == "rasterParticleResetRateFactor") {
|
|
737
|
+
self.setRasterParticleResetRateFactor(&layer, styleValue:styleValue);
|
|
738
|
+
} else {
|
|
739
|
+
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: raster-particle")
|
|
740
|
+
}
|
|
741
|
+
}
|
|
700
742
|
}
|
|
743
|
+
#endif
|
|
701
744
|
|
|
702
745
|
func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout HillshadeLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
703
746
|
{
|
|
@@ -714,7 +757,7 @@ func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, A
|
|
|
714
757
|
|
|
715
758
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
716
759
|
|
|
717
|
-
|
|
760
|
+
if (prop == "visibility") {
|
|
718
761
|
self.setHillshadeStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
719
762
|
} else if (prop == "hillshadeIlluminationDirection") {
|
|
720
763
|
self.setHillshadeIlluminationDirection(&layer, styleValue:styleValue);
|
|
@@ -739,7 +782,7 @@ func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, A
|
|
|
739
782
|
} else {
|
|
740
783
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: hillshade")
|
|
741
784
|
}
|
|
742
|
-
|
|
785
|
+
}
|
|
743
786
|
}
|
|
744
787
|
|
|
745
788
|
func modelLayer(layer: inout ModelLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout ModelLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -757,7 +800,7 @@ func modelLayer(layer: inout ModelLayer, reactStyle:Dictionary<String, Any>, old
|
|
|
757
800
|
|
|
758
801
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
759
802
|
|
|
760
|
-
|
|
803
|
+
if (prop == "visibility") {
|
|
761
804
|
self.setModelStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
762
805
|
} else if (prop == "modelId") {
|
|
763
806
|
self.setModelId(&layer, styleValue:styleValue);
|
|
@@ -812,7 +855,7 @@ func modelLayer(layer: inout ModelLayer, reactStyle:Dictionary<String, Any>, old
|
|
|
812
855
|
} else {
|
|
813
856
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: model")
|
|
814
857
|
}
|
|
815
|
-
|
|
858
|
+
}
|
|
816
859
|
}
|
|
817
860
|
|
|
818
861
|
func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout BackgroundLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -830,7 +873,7 @@ func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String,
|
|
|
830
873
|
|
|
831
874
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
832
875
|
|
|
833
|
-
|
|
876
|
+
if (prop == "visibility") {
|
|
834
877
|
self.setBackgroundStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
835
878
|
} else if (prop == "backgroundColor") {
|
|
836
879
|
self.setBackgroundColor(&layer, styleValue:styleValue);
|
|
@@ -859,7 +902,7 @@ func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String,
|
|
|
859
902
|
} else {
|
|
860
903
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: background")
|
|
861
904
|
}
|
|
862
|
-
|
|
905
|
+
}
|
|
863
906
|
}
|
|
864
907
|
|
|
865
908
|
func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout SkyLayer)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -877,7 +920,7 @@ func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, oldReac
|
|
|
877
920
|
|
|
878
921
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
879
922
|
|
|
880
|
-
|
|
923
|
+
if (prop == "visibility") {
|
|
881
924
|
self.setSkyStyleLayerVisibility(&layer, styleValue:styleValue);
|
|
882
925
|
} else if (prop == "skyType") {
|
|
883
926
|
self.setSkyType(&layer, styleValue:styleValue);
|
|
@@ -902,7 +945,7 @@ func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, oldReac
|
|
|
902
945
|
} else {
|
|
903
946
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: sky")
|
|
904
947
|
}
|
|
905
|
-
|
|
948
|
+
}
|
|
906
949
|
}
|
|
907
950
|
|
|
908
951
|
func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Light)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -920,7 +963,7 @@ func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, oldReact
|
|
|
920
963
|
|
|
921
964
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
922
965
|
|
|
923
|
-
|
|
966
|
+
if (prop == "anchor") {
|
|
924
967
|
self.setAnchor(&layer, styleValue:styleValue);
|
|
925
968
|
} else if (prop == "position") {
|
|
926
969
|
self.setPosition(&layer, styleValue:styleValue);
|
|
@@ -937,7 +980,7 @@ func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, oldReact
|
|
|
937
980
|
} else {
|
|
938
981
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: light")
|
|
939
982
|
}
|
|
940
|
-
|
|
983
|
+
}
|
|
941
984
|
}
|
|
942
985
|
|
|
943
986
|
func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Atmosphere)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -955,7 +998,7 @@ func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>
|
|
|
955
998
|
|
|
956
999
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
957
1000
|
|
|
958
|
-
|
|
1001
|
+
if (prop == "range") {
|
|
959
1002
|
self.setRange(&layer, styleValue:styleValue);
|
|
960
1003
|
} else if (prop == "rangeTransition") {
|
|
961
1004
|
self.setRangeTransition(&layer, styleValue:styleValue);
|
|
@@ -986,7 +1029,7 @@ func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>
|
|
|
986
1029
|
} else {
|
|
987
1030
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: atmosphere")
|
|
988
1031
|
}
|
|
989
|
-
|
|
1032
|
+
}
|
|
990
1033
|
}
|
|
991
1034
|
|
|
992
1035
|
func terrainLayer(layer: inout Terrain, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Terrain)->Void)->Void, isValid: @escaping () -> Bool)
|
|
@@ -1004,12 +1047,12 @@ func terrainLayer(layer: inout Terrain, reactStyle:Dictionary<String, Any>, oldR
|
|
|
1004
1047
|
|
|
1005
1048
|
let styleValue = RNMBXStyleValue.make(reactStyle[prop])
|
|
1006
1049
|
|
|
1007
|
-
|
|
1050
|
+
if (prop == "exaggeration") {
|
|
1008
1051
|
self.setExaggeration(&layer, styleValue:styleValue);
|
|
1009
1052
|
} else {
|
|
1010
1053
|
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: terrain")
|
|
1011
1054
|
}
|
|
1012
|
-
|
|
1055
|
+
}
|
|
1013
1056
|
}
|
|
1014
1057
|
|
|
1015
1058
|
|
|
@@ -2992,6 +3035,88 @@ func setRasterElevationTransition(_ layer: inout RasterLayer, styleValue: RNMBXS
|
|
|
2992
3035
|
}
|
|
2993
3036
|
|
|
2994
3037
|
|
|
3038
|
+
#if RNMBX_11
|
|
3039
|
+
|
|
3040
|
+
func setRasterParticleStyleLayerVisibility(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3041
|
+
{
|
|
3042
|
+
layer.visibility = styleValue.isVisible();
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
func setRasterParticleArrayBand(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3046
|
+
{
|
|
3047
|
+
|
|
3048
|
+
|
|
3049
|
+
layer.rasterParticleArrayBand = styleValue.mglStyleValueString();
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
func setRasterParticleCount(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3055
|
+
{
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
layer.rasterParticleCount = styleValue.mglStyleValueNumber();
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
func setRasterParticleColor(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3064
|
+
{
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
layer.rasterParticleColor = styleValue.mglStyleValueColor();
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
func setRasterParticleMaxSpeed(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3073
|
+
{
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
layer.rasterParticleMaxSpeed = styleValue.mglStyleValueNumber();
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
func setRasterParticleSpeedFactor(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3082
|
+
{
|
|
3083
|
+
|
|
3084
|
+
|
|
3085
|
+
layer.rasterParticleSpeedFactor = styleValue.mglStyleValueNumber();
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
func setRasterParticleSpeedFactorTransition(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3091
|
+
{
|
|
3092
|
+
layer.rasterParticleSpeedFactorTransition = styleValue.getTransition();
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
func setRasterParticleFadeOpacityFactor(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3096
|
+
{
|
|
3097
|
+
|
|
3098
|
+
|
|
3099
|
+
layer.rasterParticleFadeOpacityFactor = styleValue.mglStyleValueNumber();
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
func setRasterParticleFadeOpacityFactorTransition(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3105
|
+
{
|
|
3106
|
+
layer.rasterParticleFadeOpacityFactorTransition = styleValue.getTransition();
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
func setRasterParticleResetRateFactor(_ layer: inout RasterParticleLayer, styleValue: RNMBXStyleValue)
|
|
3110
|
+
{
|
|
3111
|
+
|
|
3112
|
+
|
|
3113
|
+
layer.rasterParticleResetRateFactor = styleValue.mglStyleValueNumber();
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
#endif
|
|
3119
|
+
|
|
2995
3120
|
|
|
2996
3121
|
func setHillshadeStyleLayerVisibility(_ layer: inout HillshadeLayer, styleValue: RNMBXStyleValue)
|
|
2997
3122
|
{
|
|
@@ -580,6 +580,33 @@ class RNMBXStyleValue {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
#if RNMBX_11
|
|
584
|
+
func mglStyleValueArrayClipLayerTypes() -> Value<[ClipLayerTypes]> {
|
|
585
|
+
guard let value = value as? Dictionary<String,Any> else {
|
|
586
|
+
Logger.log(level: .error, message: "Invalid value for array of ClipLayerTypes: \(value)")
|
|
587
|
+
return .constant([])
|
|
588
|
+
}
|
|
589
|
+
let valueObj = RNMBXStyleValue.convert(value["stylevalue"] as! [String:Any])
|
|
590
|
+
|
|
591
|
+
if let valueObj = valueObj as? [String] {
|
|
592
|
+
let convertedVal = valueObj.compactMap(ClipLayerTypes.init(rawValue:))
|
|
593
|
+
return .constant(convertedVal)
|
|
594
|
+
} else {
|
|
595
|
+
do {
|
|
596
|
+
if valueObj is String {
|
|
597
|
+
throw StyleConversionError.unexpectedType(message: "should be array constant or expression")
|
|
598
|
+
}
|
|
599
|
+
let data = try JSONSerialization.data(withJSONObject: valueObj, options: .prettyPrinted)
|
|
600
|
+
let decodedExpression = try JSONDecoder().decode(Expression.self, from: data)
|
|
601
|
+
return .expression(decodedExpression)
|
|
602
|
+
} catch {
|
|
603
|
+
Logger.log(level: .error, message: "Invalid value for array => value: \(value) error: \(error) setting dummy value")
|
|
604
|
+
return .constant([])
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
#endif
|
|
609
|
+
|
|
583
610
|
#if RNMBX_11
|
|
584
611
|
func getSphericalPosition() -> Value<[Double]> {
|
|
585
612
|
if let array = styleObject as? [NSNumber] {
|
|
@@ -6,13 +6,13 @@ typealias ViewportManager = Viewport
|
|
|
6
6
|
#endif
|
|
7
7
|
|
|
8
8
|
@objc(RNMBXViewport)
|
|
9
|
-
open class RNMBXViewport : UIView,
|
|
9
|
+
open class RNMBXViewport : UIView, RNMBXMapAndMapViewComponent, ViewportStatusObserver {
|
|
10
10
|
var mapView: MapView? = nil
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
// MARK: React properties
|
|
13
13
|
@objc
|
|
14
14
|
public var onStatusChanged: RCTBubblingEventBlock? = nil
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
@objc
|
|
17
17
|
public var hasStatusChanged: Bool = false {
|
|
18
18
|
didSet {
|
|
@@ -21,7 +21,7 @@ open class RNMBXViewport : UIView, RNMBXMapComponent, ViewportStatusObserver {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
func applyHasStatusChanged(mapView: MapView) {
|
|
26
26
|
if (hasStatusChanged) {
|
|
27
27
|
mapView.viewport.addStatusObserver(self)
|
|
@@ -29,7 +29,7 @@ open class RNMBXViewport : UIView, RNMBXMapComponent, ViewportStatusObserver {
|
|
|
29
29
|
mapView.viewport.removeStatusObserver(self)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
public func viewportStatusDidChange(from fromStatus: ViewportStatus,
|
|
34
34
|
to toStatus: ViewportStatus,
|
|
35
35
|
reason: ViewportStatusChangeReason)
|
|
@@ -42,7 +42,7 @@ open class RNMBXViewport : UIView, RNMBXMapComponent, ViewportStatusObserver {
|
|
|
42
42
|
"reason": reasonToString(reason)
|
|
43
43
|
]])
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
@objc
|
|
47
47
|
public var transitionsToIdleUponUserInteraction: NSNumber? = nil {
|
|
48
48
|
didSet {
|
|
@@ -51,20 +51,20 @@ open class RNMBXViewport : UIView, RNMBXMapComponent, ViewportStatusObserver {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
public func waitForStyleLoad() -> Bool {
|
|
56
56
|
true
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
public func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
60
|
-
mapView =
|
|
61
|
-
applyHasStatusChanged(mapView: mapView
|
|
62
|
-
apply(mapView:
|
|
59
|
+
public func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
60
|
+
self.mapView = mapView
|
|
61
|
+
applyHasStatusChanged(mapView: mapView)
|
|
62
|
+
apply(mapView: mapView)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
65
|
+
public func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
66
66
|
if (hasStatusChanged) {
|
|
67
|
-
|
|
67
|
+
mapView.viewport.removeStatusObserver(self)
|
|
68
68
|
}
|
|
69
69
|
self.mapView = nil
|
|
70
70
|
return true
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
+
#import "RNMBXViewResolver.h"
|
|
3
4
|
|
|
4
5
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
6
|
#import "rnmapbox_maps_specs.h"
|
|
@@ -9,9 +10,9 @@
|
|
|
9
10
|
|
|
10
11
|
@interface RNMBXViewportModule : NSObject
|
|
11
12
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
-
<NativeRNMBXViewportModuleSpec>
|
|
13
|
+
<NativeRNMBXViewportModuleSpec, RNMBXViewResolverDelegate>
|
|
13
14
|
#else
|
|
14
|
-
<RCTBridgeModule>
|
|
15
|
+
<RCTBridgeModule, RNMBXViewResolverDelegate>
|
|
15
16
|
#endif
|
|
16
17
|
|
|
17
18
|
@end
|
|
@@ -36,22 +36,14 @@ RCT_EXPORT_MODULE();
|
|
|
36
36
|
|
|
37
37
|
- (void)withViewport:(nonnull NSNumber*)viewRef block:(void (^)(RNMBXViewport *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
RNMBXViewport *view = [uiManager viewForReactTag:viewRef];
|
|
48
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
49
|
-
if (view != nil) {
|
|
50
|
-
block(view);
|
|
51
|
-
} else {
|
|
52
|
-
reject(methodName, [NSString stringWithFormat:@"Unknown reactTag: %@", viewRef], nil);
|
|
53
|
-
}
|
|
54
|
-
}];
|
|
39
|
+
[RNMBXViewResolver withViewRef:viewRef
|
|
40
|
+
delegate:self
|
|
41
|
+
expectedClass:[RNMBXViewport class]
|
|
42
|
+
block:^(UIView *view) {
|
|
43
|
+
block((RNMBXViewport *)view);
|
|
44
|
+
}
|
|
45
|
+
reject:reject
|
|
46
|
+
methodName:methodName];
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
RCT_EXPORT_METHOD(getState:(nonnull NSNumber *)viewRef
|