@rnmapbox/maps 10.1.27 → 10.1.28
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/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +0 -8
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt +2 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/ViewTagResolver.kt +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeMapViewModuleSpec.java +13 -13
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXCameraModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXChangeLineOffsetsShapeAnimatorModuleSpec.java +4 -4
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXImageModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXMovePointShapeAnimatorModuleSpec.java +2 -2
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXPointAnnotationModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXShapeSourceModuleSpec.java +3 -3
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXTileStoreModuleSpec.java +1 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXViewportModuleSpec.java +3 -3
- package/ios/RNMBX/Extensions/Array+asExpressions.swift +1 -1
- package/ios/RNMBX/RNMBXFabricPropConvert.h +11 -3
- package/ios/RNMBX/RNMBXFabricPropConvert.mm +21 -1
- package/ios/RNMBX/RNMBXLayer.swift +37 -37
- package/ios/RNMBX/RNMBXMapViewComponentView.mm +1 -4
- package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +18 -53
- package/ios/RNMBX/RNMBXStyleValue.swift +50 -50
- package/lib/commonjs/RNMBXModule.js +2 -3
- package/lib/commonjs/RNMBXModule.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/specs/RNMBXMapViewNativeComponent.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -0
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/module/RNMBXModule.js +2 -3
- package/lib/module/RNMBXModule.js.map +1 -1
- package/lib/module/components/UserLocation.js +2 -2
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/specs/RNMBXMapViewNativeComponent.js.map +1 -1
- package/lib/module/web/index.js +2 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/UserLocation.d.ts +1 -1
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +2 -2
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/Position.d.ts +1 -1
- package/package.json +1 -1
- package/src/RNMBXModule.ts +2 -1
- package/src/components/UserLocation.tsx +3 -3
- package/src/specs/RNMBXMapViewNativeComponent.ts +2 -1
- package/src/types/Position.ts +1 -1
- package/src/web/index.js +3 -1
|
@@ -152,14 +152,6 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
public fun setHandledMapChangedEvents(
|
|
156
|
-
viewRef: Double?,
|
|
157
|
-
events: ReadableArray,
|
|
158
|
-
promise: Promise
|
|
159
|
-
) {
|
|
160
|
-
setHandledMapChangedEvents(viewRef?.toInt(), events, promise)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
155
|
override fun clearData(viewRef: ViewRefTag?, promise: Promise) {
|
|
164
156
|
withMapViewOnUIThread(viewRef, promise) {
|
|
165
157
|
it.clearData(createCommandResponse(promise))
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt
CHANGED
|
@@ -44,8 +44,8 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
44
44
|
override fun getClusterLeaves(
|
|
45
45
|
viewRef: ViewRefTag?,
|
|
46
46
|
featureJSON: String,
|
|
47
|
-
number:
|
|
48
|
-
offset:
|
|
47
|
+
number: Double,
|
|
48
|
+
offset: Double,
|
|
49
49
|
promise: Promise
|
|
50
50
|
) {
|
|
51
51
|
withShapeSourceOnUIThread(viewRef, promise) {
|
|
@@ -16,7 +16,7 @@ data class ViewTagWaiter<V>(
|
|
|
16
16
|
|
|
17
17
|
const val LOG_TAG = "ViewTagResolver"
|
|
18
18
|
|
|
19
|
-
typealias ViewRefTag =
|
|
19
|
+
typealias ViewRefTag = Double
|
|
20
20
|
// see https://github.com/rnmapbox/maps/pull/3074
|
|
21
21
|
open class ViewTagResolver(val context: ReactApplicationContext) {
|
|
22
22
|
private val createdViews: HashSet<Int> = hashSetOf<Int>()
|
|
@@ -37,53 +37,53 @@ public abstract class NativeMapViewModuleSpec extends ReactContextBaseJavaModule
|
|
|
37
37
|
|
|
38
38
|
@ReactMethod
|
|
39
39
|
@DoNotStrip
|
|
40
|
-
public abstract void takeSnap(@Nullable
|
|
40
|
+
public abstract void takeSnap(@Nullable Double viewRef, boolean writeToDisk, Promise promise);
|
|
41
41
|
|
|
42
42
|
@ReactMethod
|
|
43
43
|
@DoNotStrip
|
|
44
|
-
public abstract void queryTerrainElevation(@Nullable
|
|
44
|
+
public abstract void queryTerrainElevation(@Nullable Double viewRef, ReadableArray coordinates, Promise promise);
|
|
45
45
|
|
|
46
46
|
@ReactMethod
|
|
47
47
|
@DoNotStrip
|
|
48
|
-
public abstract void setSourceVisibility(@Nullable
|
|
48
|
+
public abstract void setSourceVisibility(@Nullable Double viewRef, boolean visible, String sourceId, String sourceLayerId, Promise promise);
|
|
49
49
|
|
|
50
50
|
@ReactMethod
|
|
51
51
|
@DoNotStrip
|
|
52
|
-
public abstract void getCenter(@Nullable
|
|
52
|
+
public abstract void getCenter(@Nullable Double viewRef, Promise promise);
|
|
53
53
|
|
|
54
54
|
@ReactMethod
|
|
55
55
|
@DoNotStrip
|
|
56
|
-
public abstract void getCoordinateFromView(@Nullable
|
|
56
|
+
public abstract void getCoordinateFromView(@Nullable Double viewRef, ReadableArray atPoint, Promise promise);
|
|
57
57
|
|
|
58
58
|
@ReactMethod
|
|
59
59
|
@DoNotStrip
|
|
60
|
-
public abstract void getPointInView(@Nullable
|
|
60
|
+
public abstract void getPointInView(@Nullable Double viewRef, ReadableArray atCoordinate, Promise promise);
|
|
61
61
|
|
|
62
62
|
@ReactMethod
|
|
63
63
|
@DoNotStrip
|
|
64
|
-
public abstract void getZoom(@Nullable
|
|
64
|
+
public abstract void getZoom(@Nullable Double viewRef, Promise promise);
|
|
65
65
|
|
|
66
66
|
@ReactMethod
|
|
67
67
|
@DoNotStrip
|
|
68
|
-
public abstract void getVisibleBounds(@Nullable
|
|
68
|
+
public abstract void getVisibleBounds(@Nullable Double viewRef, Promise promise);
|
|
69
69
|
|
|
70
70
|
@ReactMethod
|
|
71
71
|
@DoNotStrip
|
|
72
|
-
public abstract void queryRenderedFeaturesAtPoint(@Nullable
|
|
72
|
+
public abstract void queryRenderedFeaturesAtPoint(@Nullable Double viewRef, ReadableArray atPoint, ReadableArray withFilter, ReadableArray withLayerIDs, Promise promise);
|
|
73
73
|
|
|
74
74
|
@ReactMethod
|
|
75
75
|
@DoNotStrip
|
|
76
|
-
public abstract void queryRenderedFeaturesInRect(@Nullable
|
|
76
|
+
public abstract void queryRenderedFeaturesInRect(@Nullable Double viewRef, ReadableArray withBBox, ReadableArray withFilter, ReadableArray withLayerIDs, Promise promise);
|
|
77
77
|
|
|
78
78
|
@ReactMethod
|
|
79
79
|
@DoNotStrip
|
|
80
|
-
public abstract void setHandledMapChangedEvents(@Nullable
|
|
80
|
+
public abstract void setHandledMapChangedEvents(@Nullable Double viewRef, ReadableArray events, Promise promise);
|
|
81
81
|
|
|
82
82
|
@ReactMethod
|
|
83
83
|
@DoNotStrip
|
|
84
|
-
public abstract void clearData(@Nullable
|
|
84
|
+
public abstract void clearData(@Nullable Double viewRef, Promise promise);
|
|
85
85
|
|
|
86
86
|
@ReactMethod
|
|
87
87
|
@DoNotStrip
|
|
88
|
-
public abstract void querySourceFeatures(@Nullable
|
|
88
|
+
public abstract void querySourceFeatures(@Nullable Double viewRef, String sourceId, ReadableArray withFilter, ReadableArray withSourceLayerIDs, Promise promise);
|
|
89
89
|
}
|
|
@@ -37,5 +37,5 @@ public abstract class NativeRNMBXCameraModuleSpec extends ReactContextBaseJavaMo
|
|
|
37
37
|
|
|
38
38
|
@ReactMethod
|
|
39
39
|
@DoNotStrip
|
|
40
|
-
public abstract void updateCameraStop(@Nullable
|
|
40
|
+
public abstract void updateCameraStop(@Nullable Double viewRef, ReadableMap stop, Promise promise);
|
|
41
41
|
}
|
|
@@ -36,17 +36,17 @@ public abstract class NativeRNMBXChangeLineOffsetsShapeAnimatorModuleSpec extend
|
|
|
36
36
|
|
|
37
37
|
@ReactMethod
|
|
38
38
|
@DoNotStrip
|
|
39
|
-
public abstract void create(
|
|
39
|
+
public abstract void create(double tag, ReadableArray coordinates, double startOffset, double endOffset, Promise promise);
|
|
40
40
|
|
|
41
41
|
@ReactMethod
|
|
42
42
|
@DoNotStrip
|
|
43
|
-
public abstract void setLineString(
|
|
43
|
+
public abstract void setLineString(double tag, ReadableArray coordinates, double startOffset, double endOffset, Promise promise);
|
|
44
44
|
|
|
45
45
|
@ReactMethod
|
|
46
46
|
@DoNotStrip
|
|
47
|
-
public abstract void setStartOffset(
|
|
47
|
+
public abstract void setStartOffset(double tag, double offset, double duration, Promise promise);
|
|
48
48
|
|
|
49
49
|
@ReactMethod
|
|
50
50
|
@DoNotStrip
|
|
51
|
-
public abstract void setEndOffset(
|
|
51
|
+
public abstract void setEndOffset(double tag, double offset, double duration, Promise promise);
|
|
52
52
|
}
|
|
@@ -36,5 +36,5 @@ public abstract class NativeRNMBXImageModuleSpec extends ReactContextBaseJavaMod
|
|
|
36
36
|
|
|
37
37
|
@ReactMethod
|
|
38
38
|
@DoNotStrip
|
|
39
|
-
public abstract void refresh(@Nullable
|
|
39
|
+
public abstract void refresh(@Nullable Double viewRef, Promise promise);
|
|
40
40
|
}
|
|
@@ -36,9 +36,9 @@ public abstract class NativeRNMBXMovePointShapeAnimatorModuleSpec extends ReactC
|
|
|
36
36
|
|
|
37
37
|
@ReactMethod
|
|
38
38
|
@DoNotStrip
|
|
39
|
-
public abstract void create(
|
|
39
|
+
public abstract void create(double tag, ReadableArray coordinate, Promise promise);
|
|
40
40
|
|
|
41
41
|
@ReactMethod
|
|
42
42
|
@DoNotStrip
|
|
43
|
-
public abstract void moveTo(
|
|
43
|
+
public abstract void moveTo(double tag, ReadableArray coordinate, double duration, Promise promise);
|
|
44
44
|
}
|
package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXPointAnnotationModuleSpec.java
CHANGED
|
@@ -36,5 +36,5 @@ public abstract class NativeRNMBXPointAnnotationModuleSpec extends ReactContextB
|
|
|
36
36
|
|
|
37
37
|
@ReactMethod
|
|
38
38
|
@DoNotStrip
|
|
39
|
-
public abstract void refresh(@Nullable
|
|
39
|
+
public abstract void refresh(@Nullable Double viewRef, Promise promise);
|
|
40
40
|
}
|
|
@@ -36,13 +36,13 @@ public abstract class NativeRNMBXShapeSourceModuleSpec extends ReactContextBaseJ
|
|
|
36
36
|
|
|
37
37
|
@ReactMethod
|
|
38
38
|
@DoNotStrip
|
|
39
|
-
public abstract void getClusterExpansionZoom(@Nullable
|
|
39
|
+
public abstract void getClusterExpansionZoom(@Nullable Double viewRef, String featureJSON, Promise promise);
|
|
40
40
|
|
|
41
41
|
@ReactMethod
|
|
42
42
|
@DoNotStrip
|
|
43
|
-
public abstract void getClusterLeaves(@Nullable
|
|
43
|
+
public abstract void getClusterLeaves(@Nullable Double viewRef, String featureJSON, double number, double offset, Promise promise);
|
|
44
44
|
|
|
45
45
|
@ReactMethod
|
|
46
46
|
@DoNotStrip
|
|
47
|
-
public abstract void getClusterChildren(@Nullable
|
|
47
|
+
public abstract void getClusterChildren(@Nullable Double viewRef, String featureJSON, Promise promise);
|
|
48
48
|
}
|
|
@@ -41,5 +41,5 @@ public abstract class NativeRNMBXTileStoreModuleSpec extends ReactContextBaseJav
|
|
|
41
41
|
|
|
42
42
|
@ReactMethod
|
|
43
43
|
@DoNotStrip
|
|
44
|
-
public abstract void setOption(
|
|
44
|
+
public abstract void setOption(double tag, String key, String domain, ReadableMap value, Promise promise);
|
|
45
45
|
}
|
|
@@ -37,13 +37,13 @@ public abstract class NativeRNMBXViewportModuleSpec extends ReactContextBaseJava
|
|
|
37
37
|
|
|
38
38
|
@ReactMethod
|
|
39
39
|
@DoNotStrip
|
|
40
|
-
public abstract void getState(@Nullable
|
|
40
|
+
public abstract void getState(@Nullable Double viewRef, Promise promise);
|
|
41
41
|
|
|
42
42
|
@ReactMethod
|
|
43
43
|
@DoNotStrip
|
|
44
|
-
public abstract void transitionTo(@Nullable
|
|
44
|
+
public abstract void transitionTo(@Nullable Double viewRef, ReadableMap state, ReadableMap transition, Promise promise);
|
|
45
45
|
|
|
46
46
|
@ReactMethod
|
|
47
47
|
@DoNotStrip
|
|
48
|
-
public abstract void idle(@Nullable
|
|
48
|
+
public abstract void idle(@Nullable Double viewRef, Promise promise);
|
|
49
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MapboxMaps
|
|
2
2
|
|
|
3
3
|
internal extension Array where Element == Any {
|
|
4
|
-
func asExpression() throws -> Expression? {
|
|
4
|
+
func asExpression() throws -> MapboxMaps.Expression? {
|
|
5
5
|
let filter = self
|
|
6
6
|
if filter.count > 0 {
|
|
7
7
|
let data = try JSONSerialization.data(withJSONObject: filter, options: .prettyPrinted)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* 1.
|
|
5
|
+
* 1. Requires the following prelude
|
|
6
6
|
* const auto &oldViewProps = static_cast<const RNMBXNativeUserLocationProps &>(*oldProps);
|
|
7
7
|
* const auto &newViewProps = static_cast<const RNMBXNativeUserLocationProps &>(*props);
|
|
8
8
|
*
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
NSNumber* RNMBXPropConvert_Optional_BOOL_NSNumber(const folly::dynamic &dyn, NSString* propertyName);
|
|
13
13
|
BOOL RNMBXPropConvert_Optional_BOOL(const folly::dynamic &dyn, NSString* propertyName);
|
|
14
14
|
NSString* RNMBXPropConvert_Optional_NSString(const folly::dynamic &dyn, NSString* propertyName);
|
|
15
|
+
NSNumber* RNMBXPropConvert_Optional_NSNumber(const folly::dynamic &dyn, NSString* propertyName);
|
|
15
16
|
id RNMBXPropConvert_Optional_ExpressionDouble(const folly::dynamic &dyn, NSString* propertyName);
|
|
16
17
|
BOOL RNMBXPropConvert_BOOL(const folly::dynamic &dyn, NSString* propertyName);
|
|
17
18
|
NSDictionary* RNMBXPropConvert_Optional_NSDictionary(const folly::dynamic &dyn, NSString* propertyName);
|
|
@@ -21,16 +22,23 @@ NSDictionary* RNMBXPropConvert_Optional_NSDictionary(const folly::dynamic &dyn,
|
|
|
21
22
|
_view.name = RNMBXPropConvert_Optional_BOOL_NSNumber(newViewProps.name, @#name); \
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
#define
|
|
25
|
+
#define RNMBX_REMAP_OPTIONAL_PROP_BOOL(name, viewName) \
|
|
25
26
|
if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \
|
|
26
|
-
_view.
|
|
27
|
+
_view.viewName = RNMBXPropConvert_Optional_BOOL(newViewProps.name, @#name); \
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
#define RNMBX_OPTIONAL_PROP_BOOL(name) RNMBX_REMAP_OPTIONAL_PROP_BOOL(name, name)
|
|
31
|
+
|
|
29
32
|
#define RNMBX_OPTIONAL_PROP_NSString(name) \
|
|
30
33
|
if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \
|
|
31
34
|
_view.name = RNMBXPropConvert_Optional_NSString(newViewProps.name, @#name); \
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
#define RNMBX_OPTIONAL_PROP_NSNumber(name) \
|
|
38
|
+
if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \
|
|
39
|
+
_view.name = RNMBXPropConvert_Optional_NSNumber(newViewProps.name, @#name); \
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
#define RNMBX_OPTIONAL_PROP_ExpressionDouble(name) \
|
|
35
43
|
if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \
|
|
36
44
|
_view.name = RNMBXPropConvert_Optional_ExpressionDouble(newViewProps.name, @#name); \
|
|
@@ -55,7 +55,7 @@ BOOL RNMBXPropConvert_Optional_BOOL(const folly::dynamic &dyn, NSString* propert
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
NSString* RNMBXPropConvert_Optional_NSString(const folly::dynamic &dyn, NSString* propertyName) {
|
|
58
|
-
|
|
58
|
+
switch (dyn.type()) {
|
|
59
59
|
case folly::dynamic::STRING:
|
|
60
60
|
return [NSString stringWithCString:dyn.getString().c_str() encoding:NSUTF8StringEncoding];
|
|
61
61
|
case folly::dynamic::NULLT:
|
|
@@ -71,6 +71,26 @@ NSString* RNMBXPropConvert_Optional_NSString(const folly::dynamic &dyn, NSString
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
NSNumber* RNMBXPropConvert_Optional_NSNumber(const folly::dynamic &dyn, NSString* propertyName) {
|
|
75
|
+
switch (dyn.type()) {
|
|
76
|
+
case folly::dynamic::INT64:
|
|
77
|
+
return @(dyn.getInt());
|
|
78
|
+
case folly::dynamic::DOUBLE:
|
|
79
|
+
return @(dyn.getDouble());
|
|
80
|
+
case folly::dynamic::NULLT:
|
|
81
|
+
return nil;
|
|
82
|
+
default:
|
|
83
|
+
std::stringstream ss;
|
|
84
|
+
ss << dyn;
|
|
85
|
+
[RNMBXLogger error:[NSString stringWithFormat:@"Property %@ expected to be a number or nil but was: %s",
|
|
86
|
+
propertyName,
|
|
87
|
+
ss.str().c_str()
|
|
88
|
+
]];
|
|
89
|
+
return nil;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
74
94
|
|
|
75
95
|
id RNMBXPropConvert_ID(const folly::dynamic &dyn)
|
|
76
96
|
{
|
|
@@ -34,13 +34,13 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
var style: Style? = nil
|
|
39
39
|
|
|
40
40
|
@objc public var filter : Array<Any>? = nil {
|
|
41
41
|
didSet { optionsChanged() }
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
@objc public var id: String! = nil {
|
|
45
45
|
willSet {
|
|
46
46
|
if id != nil && newValue != id {
|
|
@@ -58,7 +58,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
58
58
|
@objc public var sourceID: String? = nil {
|
|
59
59
|
didSet { optionsChanged() }
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
@objc public var minZoomLevel : NSNumber? = nil {
|
|
63
63
|
didSet { optionsChanged() }
|
|
64
64
|
}
|
|
@@ -85,7 +85,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
@objc public var layerIndex : NSNumber? = nil {
|
|
90
90
|
didSet {
|
|
91
91
|
if let layerIndex = layerIndex {
|
|
@@ -95,13 +95,13 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
@objc public var slot: String? = nil {
|
|
100
100
|
didSet {
|
|
101
101
|
optionsChanged()
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
@objc weak var map: RNMBXMapView? = nil
|
|
106
106
|
|
|
107
107
|
deinit {
|
|
@@ -110,9 +110,9 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
110
110
|
self.waitingForID = nil
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
var styleLayer: Layer? = nil
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
/// wearther we inserted the layer or we're referring to an existing layer
|
|
117
117
|
var existingLayer = false
|
|
118
118
|
|
|
@@ -120,21 +120,21 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
120
120
|
public func waitForStyleLoad() -> Bool {
|
|
121
121
|
return true
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
func removeAndReaddLayer() {
|
|
125
125
|
if let map = map, let style = style {
|
|
126
126
|
self.removeFromMap(style)
|
|
127
127
|
self.addToMap(map, style:style)
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
/**
|
|
132
132
|
addStyles - adds the styles defined by reactStyle to the current layer, but does not apply to the style to the map style
|
|
133
133
|
*/
|
|
134
134
|
func addStyles() {
|
|
135
135
|
fatalError("Subclasses need to implement the `addStyles()` method.")
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
func addStylesAndUpdate() {
|
|
139
139
|
guard styleLayer != nil else {
|
|
140
140
|
return
|
|
@@ -148,15 +148,15 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
func makeLayer(style: Style) throws -> Layer {
|
|
153
153
|
fatalError("Subclasses need to implement the `makeLayer(style:)` method.")
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
func findLayer(style: Style, id: String) throws -> Layer {
|
|
157
157
|
return try style.layer(withId: id)
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
func layerType() -> Layer.Type {
|
|
161
161
|
fatalError("Subclasses need to implement the `layerType` method. \(self)")
|
|
162
162
|
}
|
|
@@ -188,7 +188,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
188
188
|
return .default
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
func inserLayer(_ map: RNMBXMapView) {
|
|
193
193
|
if self.style == nil {
|
|
194
194
|
print("inserLayer but style is nil")
|
|
@@ -205,7 +205,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
205
205
|
loggedApply(style: style)
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
func layerWithSourceID<T : Source>(in style: Style) throws -> T {
|
|
210
210
|
let result = try style.source(withId: self.sourceID!, type: T.self)
|
|
211
211
|
return result
|
|
@@ -217,9 +217,9 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
func addedToMap() {
|
|
220
|
-
|
|
220
|
+
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
|
|
223
223
|
public func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
224
224
|
self.map = map
|
|
225
225
|
self.style = style
|
|
@@ -239,7 +239,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
239
239
|
} catch {
|
|
240
240
|
Logger.log(level: .error, message: "find/makeLayer failed for layer id=\(id)", error: error)
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
guard self.styleLayer != nil else {
|
|
244
244
|
Logger.log(level: .error, message: "find/makeLayer retuned nil for layer id=\(id)")
|
|
245
245
|
return
|
|
@@ -253,11 +253,11 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
253
253
|
}
|
|
254
254
|
addedToMap()
|
|
255
255
|
}
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
func removeFromMap(_ map: RNMBXMapView, style: Style) {
|
|
258
258
|
removeFromMap(style)
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
|
|
261
261
|
#if RNMBX_11
|
|
262
262
|
func _toSlot(_ slot: String) -> Slot? {
|
|
263
263
|
switch slot {
|
|
@@ -272,36 +272,36 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
#endif
|
|
275
|
-
|
|
275
|
+
|
|
276
276
|
func setBaseOptions<T: Layer>(_ layer: inout T) {
|
|
277
277
|
if let minZoom = minZoomLevel {
|
|
278
278
|
layer.minZoom = minZoom.doubleValue
|
|
279
279
|
}
|
|
280
|
-
|
|
280
|
+
|
|
281
281
|
if let maxZoom = maxZoomLevel {
|
|
282
282
|
layer.maxZoom = maxZoom.doubleValue
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
|
|
285
285
|
#if RNMBX_11
|
|
286
286
|
if let slot = slot {
|
|
287
287
|
layer.slot = _toSlot(slot)
|
|
288
288
|
}
|
|
289
289
|
#endif
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
|
|
292
292
|
func setOptions(_ layer: inout Layer) {
|
|
293
293
|
setBaseOptions(&layer)
|
|
294
294
|
#if !RNMBX_11
|
|
295
295
|
if let sourceLayerID = sourceLayerID {
|
|
296
296
|
layer.sourceLayer = sourceLayerID
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
|
|
299
299
|
if let sourceID = sourceID {
|
|
300
300
|
if !(existingLayer && sourceID == DEFAULT_SOURCE_ID) && hasSource() {
|
|
301
301
|
layer.source = sourceID
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
if let filter = filter, filter.count > 0 {
|
|
306
306
|
do {
|
|
307
307
|
let data = try JSONSerialization.data(withJSONObject: filter, options: .prettyPrinted)
|
|
@@ -313,7 +313,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
313
313
|
}
|
|
314
314
|
#endif
|
|
315
315
|
}
|
|
316
|
-
|
|
316
|
+
|
|
317
317
|
private func optionsChanged() {
|
|
318
318
|
if let style = self.style, self.styleLayer != nil {
|
|
319
319
|
self.setOptions(&self.styleLayer!)
|
|
@@ -325,7 +325,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
325
325
|
removeFromMap(map.mapboxMap.style)
|
|
326
326
|
return true
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
|
|
329
329
|
private func removeFromMap(_ style: Style) {
|
|
330
330
|
if let waitingForID = waitingForID {
|
|
331
331
|
Logger.log(level:.warn, message: "RNMBXLayer.removeFromMap - unmetPositionDependency: layer: \(optional: id) was waiting for layer: \(optional: waitingForID) but it hasn't added to map")
|
|
@@ -337,7 +337,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
337
337
|
Logger.log(level: .error, message: "RNMBXLayer.removeFromMap: removing layer failed for layer \(optional: id): \(error.localizedDescription)")
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
|
|
341
341
|
func insert(_ style: Style, layerPosition: LayerPosition, onInsert: (() -> Void)? = nil) {
|
|
342
342
|
var idToWaitFor: String?
|
|
343
343
|
switch layerPosition {
|
|
@@ -350,8 +350,8 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
350
350
|
default:
|
|
351
351
|
idToWaitFor = nil
|
|
352
352
|
}
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
|
|
354
|
+
|
|
355
355
|
if let idToWaitFor = idToWaitFor {
|
|
356
356
|
self.waitingForID = idToWaitFor
|
|
357
357
|
map!.waitForLayerWithID(idToWaitFor) { _ in
|
|
@@ -362,12 +362,12 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
362
362
|
self.attemptInsert(style, layerPosition: layerPosition, onInsert: onInsert)
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
|
|
365
|
+
|
|
366
366
|
private func attemptInsert(_ style: Style, layerPosition: LayerPosition, onInsert: (() -> Void)? = nil) {
|
|
367
367
|
guard let styleLayer = self.styleLayer else {
|
|
368
368
|
return
|
|
369
369
|
}
|
|
370
|
-
|
|
370
|
+
|
|
371
371
|
do {
|
|
372
372
|
try style.addLayer(styleLayer, layerPosition: layerPosition)
|
|
373
373
|
onInsert?()
|
|
@@ -375,7 +375,7 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
375
375
|
Logger.log(level: .error, message: "inserting layer failed at position \(layerPosition): \(error.localizedDescription)")
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
|
|
378
|
+
|
|
379
379
|
internal func hasSource() -> Bool {
|
|
380
380
|
return true
|
|
381
381
|
}
|
|
@@ -385,10 +385,10 @@ public class RNMBXLayer : UIView, RNMBXMapComponent, RNMBXSourceConsumer {
|
|
|
385
385
|
protocol LayerWithSource : Layer {
|
|
386
386
|
var source: String? { get set }
|
|
387
387
|
var sourceLayer: String? { get set }
|
|
388
|
-
var filter: Expression? { get set}
|
|
388
|
+
var filter: MapboxMaps.Expression? { get set}
|
|
389
389
|
}
|
|
390
390
|
#else
|
|
391
391
|
protocol LayerWithSource : Layer {
|
|
392
|
-
|
|
392
|
+
|
|
393
393
|
}
|
|
394
394
|
#endif
|
|
@@ -181,10 +181,7 @@ using namespace facebook::react;
|
|
|
181
181
|
_view.reactCompassImage = compassImage;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
if (scaleBarEnabled != nil) {
|
|
186
|
-
_view.reactScaleBarEnabled = scaleBarEnabled;
|
|
187
|
-
}
|
|
184
|
+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(scaleBarEnabled, reactScaleBarEnabled)
|
|
188
185
|
|
|
189
186
|
id scaleBarPosition = RNMBXConvertFollyDynamicToId(newViewProps.scaleBarPosition);
|
|
190
187
|
if (scaleBarPosition != nil) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#import "RNMBXShapeSourceComponentView.h"
|
|
4
4
|
#import "RNMBXFabricHelpers.h"
|
|
5
|
+
#import "RNMBXFabricPropConvert.h"
|
|
5
6
|
|
|
6
7
|
#import <React/RCTConversions.h>
|
|
7
8
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
@@ -85,59 +86,23 @@ using namespace facebook::react;
|
|
|
85
86
|
|
|
86
87
|
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
87
88
|
{
|
|
88
|
-
const auto &
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
id clusterRadius = RNMBXConvertFollyDynamicToId(newProps.clusterRadius);
|
|
106
|
-
if (clusterRadius != nil) {
|
|
107
|
-
_view.clusterRadius = clusterRadius;
|
|
108
|
-
}
|
|
109
|
-
id clusterMaxZoomLevel = RNMBXConvertFollyDynamicToId(newProps.clusterMaxZoomLevel);
|
|
110
|
-
if (clusterMaxZoomLevel != nil) {
|
|
111
|
-
_view.clusterMaxZoomLevel = clusterMaxZoomLevel;
|
|
112
|
-
}
|
|
113
|
-
id clusterProperties = RNMBXConvertFollyDynamicToId(newProps.clusterProperties);
|
|
114
|
-
if (clusterProperties != nil) {
|
|
115
|
-
_view.clusterProperties = clusterProperties;
|
|
116
|
-
}
|
|
117
|
-
id maxZoomLevel = RNMBXConvertFollyDynamicToId(newProps.maxZoomLevel);
|
|
118
|
-
if (maxZoomLevel != nil) {
|
|
119
|
-
_view.maxZoomLevel = maxZoomLevel;
|
|
120
|
-
}
|
|
121
|
-
id buffer = RNMBXConvertFollyDynamicToId(newProps.buffer);
|
|
122
|
-
if (buffer != nil) {
|
|
123
|
-
_view.buffer = buffer;
|
|
124
|
-
}
|
|
125
|
-
id tolerance = RNMBXConvertFollyDynamicToId(newProps.tolerance);
|
|
126
|
-
if (tolerance != nil) {
|
|
127
|
-
_view.tolerance = tolerance;
|
|
128
|
-
}
|
|
129
|
-
id lineMetrics = RNMBXConvertFollyDynamicToId(newProps.lineMetrics);
|
|
130
|
-
if (lineMetrics != nil) {
|
|
131
|
-
_view.lineMetrics = lineMetrics;
|
|
132
|
-
}
|
|
133
|
-
id hasPressListener = RNMBXConvertFollyDynamicToId(newProps.hasPressListener);
|
|
134
|
-
if (hasPressListener != nil) {
|
|
135
|
-
_view.hasPressListener = hasPressListener;
|
|
136
|
-
}
|
|
137
|
-
id hitbox = RNMBXConvertFollyDynamicToId(newProps.hitbox);
|
|
138
|
-
if (hitbox != nil) {
|
|
139
|
-
_view.hitbox = hitbox;
|
|
140
|
-
}
|
|
89
|
+
const auto &oldViewProps = static_cast<const RNMBXShapeSourceProps &>(*_props);
|
|
90
|
+
const auto &newViewProps = static_cast<const RNMBXShapeSourceProps &>(*props);
|
|
91
|
+
|
|
92
|
+
RNMBX_OPTIONAL_PROP_NSString(id)
|
|
93
|
+
RNMBX_OPTIONAL_PROP_BOOL(existing)
|
|
94
|
+
RNMBX_OPTIONAL_PROP_NSString(shape)
|
|
95
|
+
RNMBX_OPTIONAL_PROP_NSNumber(cluster)
|
|
96
|
+
RNMBX_OPTIONAL_PROP_NSNumber(clusterRadius)
|
|
97
|
+
RNMBX_OPTIONAL_PROP_NSNumber(clusterMaxZoomLevel)
|
|
98
|
+
RNMBX_OPTIONAL_PROP_NSDictionary(clusterProperties)
|
|
99
|
+
RNMBX_OPTIONAL_PROP_NSNumber(maxZoomLevel)
|
|
100
|
+
RNMBX_OPTIONAL_PROP_NSNumber(buffer)
|
|
101
|
+
RNMBX_OPTIONAL_PROP_NSNumber(tolerance)
|
|
102
|
+
RNMBX_OPTIONAL_PROP_NSNumber(lineMetrics)
|
|
103
|
+
RNMBX_OPTIONAL_PROP_BOOL(hasPressListener)
|
|
104
|
+
RNMBX_OPTIONAL_PROP_NSDictionary(hitbox)
|
|
105
|
+
|
|
141
106
|
[super updateProps:props oldProps:oldProps];
|
|
142
107
|
}
|
|
143
108
|
|