@rnmapbox/maps 10.1.20 → 10.1.22
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 +14 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXViewportModule.kt +5 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImageModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +15 -14
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt +7 -6
- package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXChangeLineOffsetsShapeAnimatorModule.kt +6 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXMovePointShapeAnimatorModule.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/ViewTagResolver.kt +1 -0
- 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/RNMBXFabricHelpers.h +2 -2
- package/ios/RNMBX/RNMBXMapView.swift +24 -10
- package/ios/RNMBX/RNMBXMapViewManager.swift +36 -58
- package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +1 -0
- package/package.json +1 -1
- /package/ios/RNMBX/ShapeAnimators/{RNMBXChangeLineOffsetsShapeAnimatorModule.m → RNMBXChangeLineOffsetsShapeAnimatorModule.mm} +0 -0
- /package/ios/RNMBX/ShapeAnimators/{RNMBXMovePointShapeAnimatorModule.m → RNMBXMovePointShapeAnimatorModule.mm} +0 -0
package/android/build.gradle
CHANGED
|
@@ -13,6 +13,15 @@ def isNewArchitectureEnabled() {
|
|
|
13
13
|
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
def getKotlinVersion() {
|
|
18
|
+
return rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.6.21'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def getCoroutinesVersion(kotlinVersion) {
|
|
22
|
+
return kotlinVersion >= '1.9' ? '1.8.0' : '1.6.4'
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
// expo plugin
|
|
17
26
|
if (rootProject.ext.has('expoRNMapboxMapsImpl')) {
|
|
18
27
|
rootProject.ext.set('RNMapboxMapsImpl', rootProject.ext.get('expoRNMapboxMapsImpl'))
|
|
@@ -21,6 +30,7 @@ if (rootProject.ext.has('expoRNMapboxMapsVersion')) {
|
|
|
21
30
|
rootProject.ext.set('RNMapboxMapsVersion', rootProject.ext.get('expoRNMapboxMapsVersion'))
|
|
22
31
|
}
|
|
23
32
|
|
|
33
|
+
project.ext.set("kotlinVersion", getKotlinVersion())
|
|
24
34
|
|
|
25
35
|
buildscript {
|
|
26
36
|
repositories {
|
|
@@ -28,8 +38,9 @@ buildscript {
|
|
|
28
38
|
mavenCentral()
|
|
29
39
|
}
|
|
30
40
|
|
|
41
|
+
def kotlinVersion = this.kotlinVersion
|
|
31
42
|
dependencies {
|
|
32
|
-
|
|
43
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
|
|
@@ -142,9 +153,8 @@ dependencies {
|
|
|
142
153
|
// React Native
|
|
143
154
|
implementation "com.facebook.react:react-native:+"
|
|
144
155
|
|
|
145
|
-
|
|
146
|
-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-
|
|
147
|
-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', '1.8.0')}"
|
|
156
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${safeExtGet('kotlinxCoroutinesCoreVersion', getCoroutinesVersion(getKotlinVersion()))}"
|
|
157
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('kotlinxCoroutinesAndroidVersion', getCoroutinesVersion(getKotlinVersion()))}"
|
|
148
158
|
|
|
149
159
|
// Mapbox SDK
|
|
150
160
|
customizableDependencies('RNMapboxMapsLibs') {
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt
CHANGED
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactMethod
|
|
6
6
|
import com.facebook.react.module.annotations.ReactModule
|
|
7
7
|
import com.rnmapbox.rnmbx.NativeRNMBXPointAnnotationModuleSpec
|
|
8
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
8
9
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
9
10
|
|
|
10
11
|
@ReactModule(name = RNMBXPointAnnotationModule.NAME)
|
|
@@ -15,7 +16,7 @@ class RNMBXPointAnnotationModule(reactContext: ReactApplicationContext?, private
|
|
|
15
16
|
const val NAME = "RNMBXPointAnnotationModule"
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
private fun withPointAnnotationOnUIThread(viewRef:
|
|
19
|
+
private fun withPointAnnotationOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXPointAnnotation) -> Unit) {
|
|
19
20
|
if (viewRef == null) {
|
|
20
21
|
reject.reject(Exception("viewRef is null for RNMBXPointAnnotation"))
|
|
21
22
|
} else {
|
|
@@ -24,7 +25,7 @@ class RNMBXPointAnnotationModule(reactContext: ReactApplicationContext?, private
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@ReactMethod
|
|
27
|
-
override fun refresh(viewRef:
|
|
28
|
+
override fun refresh(viewRef: ViewRefTag?, promise: Promise) {
|
|
28
29
|
withPointAnnotationOnUIThread(viewRef, promise) {
|
|
29
30
|
it.refresh()
|
|
30
31
|
promise.resolve(null)
|
|
@@ -9,12 +9,13 @@ import com.facebook.react.bridge.WritableMap
|
|
|
9
9
|
import com.facebook.react.bridge.WritableNativeMap
|
|
10
10
|
import com.rnmapbox.rnmbx.NativeRNMBXCameraModuleSpec
|
|
11
11
|
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
|
|
12
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeRNMBXCameraModuleSpec(context) {
|
|
16
17
|
private fun withViewportOnUIThread(
|
|
17
|
-
viewRef:
|
|
18
|
+
viewRef: ViewRefTag?,
|
|
18
19
|
reject: Promise,
|
|
19
20
|
fn: (RNMBXCamera) -> Unit
|
|
20
21
|
) {
|
|
@@ -42,7 +43,7 @@ class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: V
|
|
|
42
43
|
const val NAME = "RNMBXCameraModule"
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
override fun updateCameraStop(viewRef:
|
|
46
|
+
override fun updateCameraStop(viewRef: ViewRefTag?, stop: ReadableMap, promise: Promise) {
|
|
46
47
|
withViewportOnUIThread(viewRef, promise) {
|
|
47
48
|
it.updateCameraStop(stop)
|
|
48
49
|
promise.resolve(null)
|
|
@@ -8,11 +8,12 @@ import com.facebook.react.bridge.WritableMap
|
|
|
8
8
|
import com.facebook.react.bridge.WritableNativeMap
|
|
9
9
|
import com.rnmapbox.rnmbx.NativeRNMBXViewportModuleSpec
|
|
10
10
|
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
|
|
11
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
11
12
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
12
13
|
|
|
13
14
|
class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeRNMBXViewportModuleSpec(context) {
|
|
14
15
|
private fun withViewportOnUIThread(
|
|
15
|
-
viewRef:
|
|
16
|
+
viewRef: ViewRefTag?,
|
|
16
17
|
reject: Promise,
|
|
17
18
|
fn: (RNMBXViewport) -> Unit
|
|
18
19
|
) {
|
|
@@ -36,14 +37,14 @@ class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
override fun getState(viewRef:
|
|
40
|
+
override fun getState(viewRef: ViewRefTag?, promise: Promise) {
|
|
40
41
|
withViewportOnUIThread(viewRef, promise) {
|
|
41
42
|
promise.resolve(it.getState())
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
override fun transitionTo(
|
|
46
|
-
viewRef:
|
|
47
|
+
viewRef: ViewRefTag?,
|
|
47
48
|
state: ReadableMap,
|
|
48
49
|
transition: ReadableMap?,
|
|
49
50
|
promise: Promise
|
|
@@ -53,7 +54,7 @@ class RNMBXViewportModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
override fun idle(viewRef:
|
|
57
|
+
override fun idle(viewRef: ViewRefTag?, promise: Promise) {
|
|
57
58
|
withViewportOnUIThread(viewRef, promise) {
|
|
58
59
|
it.idle()
|
|
59
60
|
promise.resolve(true)
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactMethod
|
|
6
6
|
import com.facebook.react.module.annotations.ReactModule
|
|
7
7
|
import com.rnmapbox.rnmbx.NativeRNMBXImageModuleSpec
|
|
8
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
8
9
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
9
10
|
|
|
10
11
|
@ReactModule(name = RNMBXImageModule.NAME)
|
|
@@ -15,7 +16,7 @@ class RNMBXImageModule(reactContext: ReactApplicationContext?, private val viewT
|
|
|
15
16
|
const val NAME = "RNMBXImageModule"
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
private fun withImageOnUIThread(viewRef:
|
|
19
|
+
private fun withImageOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXImage) -> Unit) {
|
|
19
20
|
if (viewRef == null) {
|
|
20
21
|
reject.reject(Exception("viewRef is null for RNMBXImage"))
|
|
21
22
|
} else {
|
|
@@ -24,7 +25,7 @@ class RNMBXImageModule(reactContext: ReactApplicationContext?, private val viewT
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@ReactMethod
|
|
27
|
-
override fun refresh(viewRef:
|
|
28
|
+
override fun refresh(viewRef: ViewRefTag?, promise: Promise) {
|
|
28
29
|
withImageOnUIThread(viewRef, promise) {
|
|
29
30
|
it.refresh()
|
|
30
31
|
promise.resolve(null)
|
|
@@ -8,13 +8,14 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
8
8
|
import com.rnmapbox.rnmbx.NativeMapViewModuleSpec
|
|
9
9
|
import com.rnmapbox.rnmbx.utils.ConvertUtils
|
|
10
10
|
import com.rnmapbox.rnmbx.utils.ExpressionParser
|
|
11
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
11
12
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.extensions.toCoordinate
|
|
13
14
|
import com.rnmapbox.rnmbx.utils.extensions.toScreenCoordinate
|
|
14
15
|
|
|
15
16
|
class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeMapViewModuleSpec(context) {
|
|
16
17
|
private fun withMapViewOnUIThread(
|
|
17
|
-
viewRef:
|
|
18
|
+
viewRef: ViewRefTag?,
|
|
18
19
|
reject: Promise,
|
|
19
20
|
fn: (RNMBXMapView) -> Unit
|
|
20
21
|
) {
|
|
@@ -38,14 +39,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
override fun takeSnap(viewRef:
|
|
42
|
+
override fun takeSnap(viewRef: ViewRefTag?, writeToDisk: Boolean, promise: Promise) {
|
|
42
43
|
withMapViewOnUIThread(viewRef, promise) {
|
|
43
44
|
it.takeSnap(writeToDisk, createCommandResponse(promise))
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
override fun queryTerrainElevation(
|
|
48
|
-
viewRef:
|
|
49
|
+
viewRef: ViewRefTag?,
|
|
49
50
|
coordinates: ReadableArray,
|
|
50
51
|
promise: Promise
|
|
51
52
|
) {
|
|
@@ -55,7 +56,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
override fun setSourceVisibility(
|
|
58
|
-
viewRef:
|
|
59
|
+
viewRef: ViewRefTag?,
|
|
59
60
|
visible: Boolean,
|
|
60
61
|
sourceId: String,
|
|
61
62
|
sourceLayerId: String?,
|
|
@@ -68,14 +69,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
override fun getCenter(viewRef:
|
|
72
|
+
override fun getCenter(viewRef: ViewRefTag?, promise: Promise) {
|
|
72
73
|
withMapViewOnUIThread(viewRef, promise) {
|
|
73
74
|
it.getCenter(createCommandResponse(promise))
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
override fun getCoordinateFromView(
|
|
78
|
-
viewRef:
|
|
79
|
+
viewRef: ViewRefTag?,
|
|
79
80
|
atPoint: ReadableArray,
|
|
80
81
|
promise: Promise
|
|
81
82
|
) {
|
|
@@ -84,26 +85,26 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
override fun getPointInView(viewRef:
|
|
88
|
+
override fun getPointInView(viewRef: ViewRefTag?, atCoordinate: ReadableArray, promise: Promise) {
|
|
88
89
|
withMapViewOnUIThread(viewRef, promise) {
|
|
89
90
|
it.getPointInView(atCoordinate.toCoordinate(), createCommandResponse(promise))
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
override fun getZoom(viewRef:
|
|
94
|
+
override fun getZoom(viewRef: ViewRefTag?, promise: Promise) {
|
|
94
95
|
withMapViewOnUIThread(viewRef, promise) {
|
|
95
96
|
it.getZoom(createCommandResponse(promise))
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
override fun getVisibleBounds(viewRef:
|
|
100
|
+
override fun getVisibleBounds(viewRef: ViewRefTag?, promise: Promise) {
|
|
100
101
|
withMapViewOnUIThread(viewRef, promise) {
|
|
101
102
|
it.getVisibleBounds(createCommandResponse(promise))
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
override fun queryRenderedFeaturesAtPoint(
|
|
106
|
-
viewRef:
|
|
107
|
+
viewRef: ViewRefTag?,
|
|
107
108
|
atPoint: ReadableArray,
|
|
108
109
|
withFilter: ReadableArray,
|
|
109
110
|
withLayerIDs: ReadableArray,
|
|
@@ -122,7 +123,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
override fun queryRenderedFeaturesInRect(
|
|
125
|
-
viewRef:
|
|
126
|
+
viewRef: ViewRefTag?,
|
|
126
127
|
withBBox: ReadableArray,
|
|
127
128
|
withFilter: ReadableArray,
|
|
128
129
|
withLayerIDs: ReadableArray?,
|
|
@@ -141,7 +142,7 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
override fun setHandledMapChangedEvents(
|
|
144
|
-
viewRef:
|
|
145
|
+
viewRef: ViewRefTag?,
|
|
145
146
|
events: ReadableArray,
|
|
146
147
|
promise: Promise
|
|
147
148
|
) {
|
|
@@ -151,14 +152,14 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
override fun clearData(viewRef:
|
|
155
|
+
override fun clearData(viewRef: ViewRefTag?, promise: Promise) {
|
|
155
156
|
withMapViewOnUIThread(viewRef, promise) {
|
|
156
157
|
it.clearData(createCommandResponse(promise))
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
override fun querySourceFeatures(
|
|
161
|
-
viewRef:
|
|
162
|
+
viewRef: ViewRefTag?,
|
|
162
163
|
sourceId: String,
|
|
163
164
|
withFilter: ReadableArray,
|
|
164
165
|
withSourceLayerIDs: ReadableArray,
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt
CHANGED
|
@@ -9,6 +9,7 @@ import com.facebook.react.uimanager.common.UIManagerType
|
|
|
9
9
|
import com.rnmapbox.rnmbx.BuildConfig
|
|
10
10
|
import com.rnmapbox.rnmbx.NativeRNMBXShapeSourceModuleSpec
|
|
11
11
|
import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
|
|
12
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
12
13
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
13
14
|
|
|
14
15
|
@ReactModule(name = RNMBXShapeSourceModule.NAME)
|
|
@@ -16,7 +17,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
16
17
|
NativeRNMBXShapeSourceModuleSpec(reactContext) {
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
private fun withShapeSourceOnUIThread(viewRef:
|
|
20
|
+
private fun withShapeSourceOnUIThread(viewRef: ViewRefTag?, reject: Promise, fn: (RNMBXShapeSource) -> Unit) {
|
|
20
21
|
if (viewRef == null) {
|
|
21
22
|
reject.reject(Exception("viewRef is null for RNMBXShapeSource"))
|
|
22
23
|
} else {
|
|
@@ -30,7 +31,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
30
31
|
|
|
31
32
|
@ReactMethod
|
|
32
33
|
override fun getClusterExpansionZoom(
|
|
33
|
-
viewRef:
|
|
34
|
+
viewRef: ViewRefTag?,
|
|
34
35
|
featureJSON: String,
|
|
35
36
|
promise: Promise
|
|
36
37
|
) {
|
|
@@ -41,10 +42,10 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
41
42
|
|
|
42
43
|
@ReactMethod
|
|
43
44
|
override fun getClusterLeaves(
|
|
44
|
-
viewRef:
|
|
45
|
+
viewRef: ViewRefTag?,
|
|
45
46
|
featureJSON: String,
|
|
46
|
-
number:
|
|
47
|
-
offset:
|
|
47
|
+
number: Int,
|
|
48
|
+
offset: Int,
|
|
48
49
|
promise: Promise
|
|
49
50
|
) {
|
|
50
51
|
withShapeSourceOnUIThread(viewRef, promise) {
|
|
@@ -53,7 +54,7 @@ class RNMBXShapeSourceModule(reactContext: ReactApplicationContext?, private val
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
@ReactMethod
|
|
56
|
-
override fun getClusterChildren(viewRef:
|
|
57
|
+
override fun getClusterChildren(viewRef: ViewRefTag?, featureJSON: String, promise: Promise) {
|
|
57
58
|
withShapeSourceOnUIThread(viewRef, promise) {
|
|
58
59
|
it.getClusterChildren(featureJSON, promise)
|
|
59
60
|
}
|
|
@@ -11,6 +11,7 @@ import com.mapbox.turf.TurfConstants.UNIT_METERS
|
|
|
11
11
|
import com.mapbox.turf.TurfMeasurement
|
|
12
12
|
import com.mapbox.turf.TurfMisc
|
|
13
13
|
import com.rnmapbox.rnmbx.NativeRNMBXChangeLineOffsetsShapeAnimatorModuleSpec
|
|
14
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
14
15
|
|
|
15
16
|
class ChangeLineOffsetsShapeAnimator(tag: Tag, _lineString: LineString, startOffset: Double, endOffset: Double): ShapeAnimatorCommon(tag) {
|
|
16
17
|
private var lineString = _lineString
|
|
@@ -153,7 +154,7 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
override fun create(
|
|
156
|
-
tag:
|
|
157
|
+
tag: ViewRefTag,
|
|
157
158
|
coordinates: ReadableArray,
|
|
158
159
|
startOffset: Double,
|
|
159
160
|
endOffset: Double,
|
|
@@ -172,11 +173,11 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
172
173
|
promise?.resolve(tag.toInt())
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
private fun getAnimator(tag:
|
|
176
|
+
private fun getAnimator(tag: ViewRefTag): ChangeLineOffsetsShapeAnimator {
|
|
176
177
|
return shapeAnimatorManager.get(tag.toLong()) as ChangeLineOffsetsShapeAnimator
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
override fun setLineString(tag:
|
|
180
|
+
override fun setLineString(tag: ViewRefTag, coordinates: ReadableArray?, startOffset: Double, endOffset: Double, promise: Promise?) {
|
|
180
181
|
val animator = getAnimator(tag)
|
|
181
182
|
|
|
182
183
|
if (coordinates == null) {
|
|
@@ -191,13 +192,13 @@ class RNMBXChangeLineOffsetsShapeAnimatorModule(
|
|
|
191
192
|
promise?.resolve(true)
|
|
192
193
|
}
|
|
193
194
|
|
|
194
|
-
override fun setStartOffset(tag:
|
|
195
|
+
override fun setStartOffset(tag: ViewRefTag, offset: Double, duration: Double, promise: Promise?) {
|
|
195
196
|
val animator = getAnimator(tag)
|
|
196
197
|
animator.setStartOffset(offset, duration / 1000)
|
|
197
198
|
promise?.resolve(true)
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
override fun setEndOffset(tag:
|
|
201
|
+
override fun setEndOffset(tag: ViewRefTag, offset: Double, duration: Double, promise: Promise?) {
|
|
201
202
|
val animator = getAnimator(tag)
|
|
202
203
|
animator.setEndOffset(offset, duration / 1000)
|
|
203
204
|
promise?.resolve(true)
|
package/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXMovePointShapeAnimatorModule.kt
CHANGED
|
@@ -11,6 +11,7 @@ import com.mapbox.geojson.Point
|
|
|
11
11
|
import com.mapbox.turf.TurfConstants.UNIT_METERS
|
|
12
12
|
import com.mapbox.turf.TurfMeasurement
|
|
13
13
|
import com.rnmapbox.rnmbx.NativeRNMBXMovePointShapeAnimatorModuleSpec
|
|
14
|
+
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
14
15
|
|
|
15
16
|
class MovePointShapeAnimator(tag: Tag, coordinate: Point) : ShapeAnimatorCommon(tag) {
|
|
16
17
|
private var point = AnimatableElement<Point>(
|
|
@@ -77,7 +78,7 @@ class RNMBXMovePointShapeAnimatorModule(
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
@ReactMethod
|
|
80
|
-
override fun create(tag:
|
|
81
|
+
override fun create(tag: ViewRefTag, startCoordinate: ReadableArray, promise: Promise) {
|
|
81
82
|
shapeAnimatorManager.add(
|
|
82
83
|
MovePointShapeAnimator(
|
|
83
84
|
tag.toLong(),
|
|
@@ -92,7 +93,7 @@ class RNMBXMovePointShapeAnimatorModule(
|
|
|
92
93
|
|
|
93
94
|
@ReactMethod
|
|
94
95
|
override fun moveTo(
|
|
95
|
-
tag:
|
|
96
|
+
tag: ViewRefTag,
|
|
96
97
|
coordinate: ReadableArray?,
|
|
97
98
|
duration: Double,
|
|
98
99
|
promise: Promise?
|
|
@@ -16,6 +16,7 @@ data class ViewTagWaiter<V>(
|
|
|
16
16
|
|
|
17
17
|
const val LOG_TAG = "ViewTagResolver"
|
|
18
18
|
|
|
19
|
+
typealias ViewRefTag = Int
|
|
19
20
|
// see https://github.com/rnmapbox/maps/pull/3074
|
|
20
21
|
open class ViewTagResolver(val context: ReactApplicationContext) {
|
|
21
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 Integer 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 Integer 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 Integer 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 Integer viewRef, Promise promise);
|
|
53
53
|
|
|
54
54
|
@ReactMethod
|
|
55
55
|
@DoNotStrip
|
|
56
|
-
public abstract void getCoordinateFromView(@Nullable
|
|
56
|
+
public abstract void getCoordinateFromView(@Nullable Integer 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 Integer 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 Integer viewRef, Promise promise);
|
|
65
65
|
|
|
66
66
|
@ReactMethod
|
|
67
67
|
@DoNotStrip
|
|
68
|
-
public abstract void getVisibleBounds(@Nullable
|
|
68
|
+
public abstract void getVisibleBounds(@Nullable Integer viewRef, Promise promise);
|
|
69
69
|
|
|
70
70
|
@ReactMethod
|
|
71
71
|
@DoNotStrip
|
|
72
|
-
public abstract void queryRenderedFeaturesAtPoint(@Nullable
|
|
72
|
+
public abstract void queryRenderedFeaturesAtPoint(@Nullable Integer 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 Integer 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 Integer 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 Integer viewRef, Promise promise);
|
|
85
85
|
|
|
86
86
|
@ReactMethod
|
|
87
87
|
@DoNotStrip
|
|
88
|
-
public abstract void querySourceFeatures(@Nullable
|
|
88
|
+
public abstract void querySourceFeatures(@Nullable Integer 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 Integer 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(int 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(int 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(int 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(int 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 Integer 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(int tag, ReadableArray coordinate, Promise promise);
|
|
40
40
|
|
|
41
41
|
@ReactMethod
|
|
42
42
|
@DoNotStrip
|
|
43
|
-
public abstract void moveTo(
|
|
43
|
+
public abstract void moveTo(int 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 Integer 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 Integer 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 Integer viewRef, String featureJSON, int number, int offset, Promise promise);
|
|
44
44
|
|
|
45
45
|
@ReactMethod
|
|
46
46
|
@DoNotStrip
|
|
47
|
-
public abstract void getClusterChildren(@Nullable
|
|
47
|
+
public abstract void getClusterChildren(@Nullable Integer 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(int 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 Integer viewRef, Promise promise);
|
|
41
41
|
|
|
42
42
|
@ReactMethod
|
|
43
43
|
@DoNotStrip
|
|
44
|
-
public abstract void transitionTo(@Nullable
|
|
44
|
+
public abstract void transitionTo(@Nullable Integer 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 Integer viewRef, Promise promise);
|
|
49
49
|
}
|
|
@@ -67,7 +67,7 @@ static std::tuple<std::string, std::string> RNMBXStringifyEventData(NSDictionary
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
template <typename T>
|
|
70
|
-
void RNMBXSetCommonLayerPropsWithoutSourceID(T newProps, RNMBXLayer *_view)
|
|
70
|
+
void RNMBXSetCommonLayerPropsWithoutSourceID(const T& newProps, RNMBXLayer *_view)
|
|
71
71
|
{
|
|
72
72
|
id idx = RNMBXConvertFollyDynamicToId(newProps.id);
|
|
73
73
|
if (idx != nil) {
|
|
@@ -108,7 +108,7 @@ void RNMBXSetCommonLayerPropsWithoutSourceID(T newProps, RNMBXLayer *_view)
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
template <typename T>
|
|
111
|
-
void RNMBXSetCommonLayerProps(T newProps, RNMBXLayer *_view)
|
|
111
|
+
void RNMBXSetCommonLayerProps(const T& newProps, RNMBXLayer *_view)
|
|
112
112
|
{
|
|
113
113
|
RNMBXSetCommonLayerPropsWithoutSourceID(newProps, _view);
|
|
114
114
|
id sourceLayerID = RNMBXConvertFollyDynamicToId(newProps.sourceLayerID);
|
|
@@ -171,7 +171,7 @@ open class RNMBXMapView: UIView {
|
|
|
171
171
|
}()
|
|
172
172
|
|
|
173
173
|
var _mapView: MapView! = nil
|
|
174
|
-
func createMapView() {
|
|
174
|
+
func createMapView() -> MapView {
|
|
175
175
|
if let mapViewImpl = mapViewImpl, let mapViewInstance = createAndAddMapViewImpl(mapViewImpl, self) {
|
|
176
176
|
_mapView = mapViewInstance
|
|
177
177
|
} else {
|
|
@@ -192,6 +192,7 @@ open class RNMBXMapView: UIView {
|
|
|
192
192
|
_mapView.gestures.delegate = self
|
|
193
193
|
setupEvents()
|
|
194
194
|
afterMapViewAdded()
|
|
195
|
+
return _mapView
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
func createAndAddMapViewImpl(_ impl: String, _ view: RNMBXMapView) -> MapView? {
|
|
@@ -203,17 +204,20 @@ open class RNMBXMapView: UIView {
|
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
@available(*, deprecated, renamed: "withMapView", message: "mapView can be nil if the map initialization has not finished, use withMapView instead")
|
|
206
208
|
public var mapView : MapView! {
|
|
207
209
|
get { return _mapView }
|
|
208
210
|
}
|
|
211
|
+
|
|
212
|
+
@available(*, deprecated, renamed: "withMapboxMap", message: "mapboxMap can be nil if the map initialization has not finished, use withMapboxMap instead")
|
|
209
213
|
var mapboxMap: MapboxMap! {
|
|
210
|
-
get { _mapView
|
|
214
|
+
get { _mapView?.mapboxMap }
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
@objc public func addToMap(_ subview: UIView) {
|
|
214
|
-
withMapView {
|
|
218
|
+
withMapView { mapView in
|
|
215
219
|
if let mapComponent = subview as? RNMBXMapComponent {
|
|
216
|
-
let style =
|
|
220
|
+
let style = mapView.mapboxMap.style
|
|
217
221
|
var addToMap = false
|
|
218
222
|
if mapComponent.waitForStyleLoad() {
|
|
219
223
|
if (self.styleLoaded) {
|
|
@@ -303,7 +307,7 @@ open class RNMBXMapView: UIView {
|
|
|
303
307
|
|
|
304
308
|
// MARK: - React Native properties
|
|
305
309
|
let changes : PropertyChanges<RNMBXMapView> = PropertyChanges()
|
|
306
|
-
var mapViewWaiters : [()->Void] = []
|
|
310
|
+
var mapViewWaiters : [(_: MapView)->Void] = []
|
|
307
311
|
|
|
308
312
|
enum Property : String {
|
|
309
313
|
case projection
|
|
@@ -363,14 +367,24 @@ open class RNMBXMapView: UIView {
|
|
|
363
367
|
changes.add(name: property.rawValue, update: property.apply)
|
|
364
368
|
}
|
|
365
369
|
|
|
366
|
-
func withMapView(callback: @escaping () -> Void) {
|
|
367
|
-
if
|
|
368
|
-
callback()
|
|
370
|
+
func withMapView(callback: @escaping (_: MapView) -> Void) {
|
|
371
|
+
if let mapView = _mapView {
|
|
372
|
+
callback(mapView)
|
|
369
373
|
} else {
|
|
370
374
|
mapViewWaiters.append(callback)
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
377
|
|
|
378
|
+
func withMapboxMap(callback: @escaping (_: MapboxMap) -> Void) {
|
|
379
|
+
if let mapboxMap = _mapView?.mapboxMap {
|
|
380
|
+
callback(mapboxMap)
|
|
381
|
+
} else {
|
|
382
|
+
mapViewWaiters.append { mapView in
|
|
383
|
+
callback(mapView.mapboxMap)
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
374
388
|
var projection: StyleProjection?
|
|
375
389
|
|
|
376
390
|
@objc public func setReactProjection(_ value: String?) {
|
|
@@ -698,9 +712,9 @@ open class RNMBXMapView: UIView {
|
|
|
698
712
|
|
|
699
713
|
@objc override public func didSetProps(_ props: [String]) {
|
|
700
714
|
if (_mapView == nil) {
|
|
701
|
-
createMapView()
|
|
715
|
+
let view = createMapView()
|
|
702
716
|
|
|
703
|
-
mapViewWaiters.forEach { $0() }
|
|
717
|
+
mapViewWaiters.forEach { $0(view) }
|
|
704
718
|
mapViewWaiters.removeAll()
|
|
705
719
|
}
|
|
706
720
|
changes.apply(self)
|
|
@@ -23,25 +23,6 @@ open class RNMBXMapViewManager: RCTViewManager {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// MARK: helpers
|
|
27
|
-
|
|
28
|
-
extension RNMBXMapViewManager {
|
|
29
|
-
static func withMapboxMap(
|
|
30
|
-
_ view: RNMBXMapView,
|
|
31
|
-
name: String,
|
|
32
|
-
rejecter: @escaping RCTPromiseRejectBlock,
|
|
33
|
-
fn: @escaping (_: MapboxMap) -> Void) -> Void
|
|
34
|
-
{
|
|
35
|
-
guard let mapboxMap = view.mapboxMap else {
|
|
36
|
-
RNMBXLogError("MapboxMap is not yet available");
|
|
37
|
-
rejecter(name, "Map not loaded yet", nil)
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
fn(mapboxMap)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
// MARK: - react methods
|
|
46
27
|
|
|
47
28
|
extension RNMBXMapViewManager {
|
|
@@ -76,12 +57,12 @@ extension RNMBXMapViewManager {
|
|
|
76
57
|
}
|
|
77
58
|
|
|
78
59
|
@objc public static func getCenter(_ view: RNMBXMapView, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
60
|
+
view.withMapboxMap { map in
|
|
61
|
+
resolver(["center": [
|
|
62
|
+
map.cameraState.center.longitude,
|
|
63
|
+
map.cameraState.center.latitude
|
|
64
|
+
]])
|
|
65
|
+
}
|
|
85
66
|
}
|
|
86
67
|
|
|
87
68
|
@objc public static func getCoordinateFromView(
|
|
@@ -89,10 +70,10 @@ extension RNMBXMapViewManager {
|
|
|
89
70
|
atPoint point: CGPoint,
|
|
90
71
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
91
72
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
73
|
+
view.withMapboxMap { map in
|
|
74
|
+
let coordinates = map.coordinate(for: point)
|
|
75
|
+
resolver(["coordinateFromView": [coordinates.longitude, coordinates.latitude]])
|
|
76
|
+
}
|
|
96
77
|
|
|
97
78
|
}
|
|
98
79
|
|
|
@@ -101,12 +82,11 @@ extension RNMBXMapViewManager {
|
|
|
101
82
|
atCoordinate coordinate: [NSNumber],
|
|
102
83
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
103
84
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
view.withMapboxMap { map in
|
|
86
|
+
let coordinate = CLLocationCoordinate2DMake(coordinate[1].doubleValue, coordinate[0].doubleValue)
|
|
87
|
+
let point = map.point(for: coordinate)
|
|
88
|
+
resolver(["pointInView": [(point.x), (point.y)]])
|
|
89
|
+
}
|
|
110
90
|
}
|
|
111
91
|
|
|
112
92
|
@objc public static func setHandledMapChangedEvents(
|
|
@@ -124,10 +104,9 @@ extension RNMBXMapViewManager {
|
|
|
124
104
|
_ view: RNMBXMapView,
|
|
125
105
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
126
106
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
107
|
+
view.withMapboxMap { map in
|
|
108
|
+
resolver(["zoom": map.cameraState.zoom])
|
|
109
|
+
}
|
|
131
110
|
}
|
|
132
111
|
|
|
133
112
|
@objc public static func getVisibleBounds(
|
|
@@ -148,27 +127,26 @@ extension RNMBXMapViewManager {
|
|
|
148
127
|
withLayerIDs layerIDs: [String]?,
|
|
149
128
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
150
129
|
rejecter: @escaping RCTPromiseRejectBlock) -> Void {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
130
|
+
view.withMapboxMap { map in
|
|
131
|
+
let point = CGPoint(x: CGFloat(point[0].floatValue), y: CGFloat(point[1].floatValue))
|
|
132
|
+
|
|
133
|
+
logged("queryRenderedFeaturesAtPoint.option", rejecter: rejecter) {
|
|
134
|
+
let options = try RenderedQueryOptions(layerIds: (layerIDs ?? []).isEmpty ? nil : layerIDs, filter: filter?.asExpression())
|
|
135
|
+
|
|
136
|
+
map.queryRenderedFeatures(with: point, options: options) { result in
|
|
137
|
+
switch result {
|
|
138
|
+
case .success(let features):
|
|
139
|
+
resolver([
|
|
140
|
+
"data": ["type": "FeatureCollection", "features": features.compactMap { queriedFeature in
|
|
141
|
+
logged("queryRenderedFeaturesAtPoint.feature.toJSON") { try queriedFeature.feature.toJSON() }
|
|
142
|
+
}]
|
|
143
|
+
])
|
|
144
|
+
case .failure(let error):
|
|
145
|
+
rejecter("queryRenderedFeaturesAtPoint","failed to query features", error)
|
|
168
146
|
}
|
|
169
147
|
}
|
|
170
|
-
|
|
171
|
-
|
|
148
|
+
}
|
|
149
|
+
}
|
|
172
150
|
}
|
|
173
151
|
|
|
174
152
|
@objc public static func queryRenderedFeaturesInRect(
|
|
@@ -104,6 +104,7 @@ using namespace facebook::react;
|
|
|
104
104
|
layoutMetrics.contentInsets,
|
|
105
105
|
layoutMetrics.borderWidth,
|
|
106
106
|
layoutMetrics.displayType,
|
|
107
|
+
layoutMetrics.positionType, // RN074
|
|
107
108
|
layoutMetrics.layoutDirection,
|
|
108
109
|
layoutMetrics.wasLeftAndRightSwapped,
|
|
109
110
|
layoutMetrics.pointScaleFactor,
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|