@rnmapbox/maps 10.0.15-rc.1 → 10.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/android/build.gradle +20 -0
  2. package/android/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +109 -12
  3. package/android/src/main/java-v10/com/mapbox/rctmgl/components/AbstractEventEmitter.kt +2 -3
  4. package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/NativeMapViewModule.kt +193 -0
  5. package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLAndroidTextureMapViewManager.kt +16 -2
  6. package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +1 -1
  7. package/android/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapViewManager.kt +75 -160
  8. package/android/src/main/java-v10/com/mapbox/rctmgl/mapbox/Light.kt +6 -0
  9. package/android/src/main/old-arch/com/facebook/react/viewmanagers/MBXAndroidTextureMapViewManagerDelegate.java +89 -0
  10. package/android/src/main/old-arch/com/facebook/react/viewmanagers/MBXAndroidTextureMapViewManagerInterface.java +37 -0
  11. package/android/src/main/old-arch/com/facebook/react/viewmanagers/MBXMapViewManagerDelegate.java +89 -0
  12. package/android/src/main/old-arch/com/facebook/react/viewmanagers/MBXMapViewManagerInterface.java +37 -0
  13. package/android/src/main/old-arch/com/mapbox/rctmgl/NativeMapViewModuleSpec.java +88 -0
  14. package/ios/RCTMGL-v10/CustomHttpHeaders.swift +18 -0
  15. package/ios/RCTMGL-v10/MBXMapViewComponentView.h +18 -0
  16. package/ios/RCTMGL-v10/MBXMapViewComponentView.mm +203 -0
  17. package/ios/RCTMGL-v10/MBXMapViewManager.m +37 -0
  18. package/ios/RCTMGL-v10/MBXMapViewManager.swift +250 -0
  19. package/ios/RCTMGL-v10/MBXMapViewModule.h +18 -0
  20. package/ios/RCTMGL-v10/MBXMapViewModule.mm +167 -0
  21. package/ios/RCTMGL-v10/MGLModule.swift +15 -1
  22. package/ios/RCTMGL-v10/MGLSnapshotModule.swift +7 -1
  23. package/ios/RCTMGL-v10/RCTMGLAtmosphere.swift +4 -0
  24. package/ios/RCTMGL-v10/RCTMGLBackgroundLayer.swift +2 -1
  25. package/ios/RCTMGL-v10/RCTMGLCamera.swift +23 -0
  26. package/ios/RCTMGL-v10/RCTMGLCircleLayer.swift +4 -0
  27. package/ios/RCTMGL-v10/RCTMGLFillExtrustionLayer.swift +4 -0
  28. package/ios/RCTMGL-v10/RCTMGLFillLayer.swift +4 -0
  29. package/ios/RCTMGL-v10/RCTMGLHeatmapLayer.swift +4 -1
  30. package/ios/RCTMGL-v10/RCTMGLImageSource.swift +4 -0
  31. package/ios/RCTMGL-v10/RCTMGLImages.swift +14 -2
  32. package/ios/RCTMGL-v10/RCTMGLLayer.swift +35 -11
  33. package/ios/RCTMGL-v10/RCTMGLLight.swift +14 -4
  34. package/ios/RCTMGL-v10/RCTMGLLineLayer.swift +4 -0
  35. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +65 -12
  36. package/ios/RCTMGL-v10/RCTMGLLocationModuleV11.swift +32 -0
  37. package/ios/RCTMGL-v10/RCTMGLMapView.swift +115 -27
  38. package/ios/RCTMGL-v10/RCTMGLNativeUserLocation.swift +4 -0
  39. package/ios/RCTMGL-v10/RCTMGLOfflineModule.swift +17 -0
  40. package/ios/RCTMGL-v10/RCTMGLRasterDemSource.swift +4 -0
  41. package/ios/RCTMGL-v10/RCTMGLRasterLayer.swift +4 -0
  42. package/ios/RCTMGL-v10/RCTMGLRasterSource.swift +4 -0
  43. package/ios/RCTMGL-v10/RCTMGLShapeSource.swift +65 -3
  44. package/ios/RCTMGL-v10/RCTMGLSource.swift +4 -0
  45. package/ios/RCTMGL-v10/RCTMGLStyleValue.swift +60 -1
  46. package/ios/RCTMGL-v10/RCTMGLSymbolLayer.swift +4 -0
  47. package/ios/RCTMGL-v10/RCTMGLVectorSource.swift +4 -0
  48. package/ios/RCTMGL-v10/rnmapbox_maps.h +1 -0
  49. package/lib/commonjs/components/MapView.js +47 -11
  50. package/lib/commonjs/components/MapView.js.map +1 -1
  51. package/lib/commonjs/specs/MBXAndroidTextureMapViewNativeComponent.js +13 -0
  52. package/lib/commonjs/specs/MBXAndroidTextureMapViewNativeComponent.js.map +1 -0
  53. package/lib/commonjs/specs/MBXMapViewNativeComponent.js +11 -0
  54. package/lib/commonjs/specs/MBXMapViewNativeComponent.js.map +1 -0
  55. package/lib/commonjs/specs/NativeMapViewModule.js +11 -0
  56. package/lib/commonjs/specs/NativeMapViewModule.js.map +1 -0
  57. package/lib/commonjs/specs/codegenUtils.js +2 -0
  58. package/lib/commonjs/specs/codegenUtils.js.map +1 -0
  59. package/lib/module/components/MapView.js +47 -10
  60. package/lib/module/components/MapView.js.map +1 -1
  61. package/lib/module/specs/MBXAndroidTextureMapViewNativeComponent.js +5 -0
  62. package/lib/module/specs/MBXAndroidTextureMapViewNativeComponent.js.map +1 -0
  63. package/lib/module/specs/MBXMapViewNativeComponent.js +3 -0
  64. package/lib/module/specs/MBXMapViewNativeComponent.js.map +1 -0
  65. package/lib/module/specs/NativeMapViewModule.js +5 -0
  66. package/lib/module/specs/NativeMapViewModule.js.map +1 -0
  67. package/lib/module/specs/codegenUtils.js +2 -0
  68. package/lib/module/specs/codegenUtils.js.map +1 -0
  69. package/lib/typescript/components/MapView.d.ts +13 -3
  70. package/lib/typescript/components/MapView.d.ts.map +1 -1
  71. package/lib/typescript/specs/MBXAndroidTextureMapViewNativeComponent.d.ts +52 -0
  72. package/lib/typescript/specs/MBXAndroidTextureMapViewNativeComponent.d.ts.map +1 -0
  73. package/lib/typescript/specs/MBXMapViewNativeComponent.d.ts +52 -0
  74. package/lib/typescript/specs/MBXMapViewNativeComponent.d.ts.map +1 -0
  75. package/lib/typescript/specs/NativeMapViewModule.d.ts +21 -0
  76. package/lib/typescript/specs/NativeMapViewModule.d.ts.map +1 -0
  77. package/lib/typescript/specs/codegenUtils.d.ts +2 -0
  78. package/lib/typescript/specs/codegenUtils.d.ts.map +1 -0
  79. package/package.json +9 -1
  80. package/rnmapbox-maps.podspec +22 -4
  81. package/setup-jest.js +16 -0
  82. package/src/components/MapView.tsx +56 -12
  83. package/src/specs/MBXAndroidTextureMapViewNativeComponent.ts +63 -0
  84. package/src/specs/MBXMapViewNativeComponent.ts +63 -0
  85. package/src/specs/NativeMapViewModule.ts +54 -0
  86. package/src/specs/codegenUtils.ts +4 -0
  87. package/ios/RCTMGL-v10/RCTMGLMapViewManager.m +0 -107
  88. package/ios/RCTMGL-v10/RCTMGLMapViewManager.swift +0 -285
@@ -5,6 +5,14 @@ def safeExtGet(prop, fallback) {
5
5
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
6
6
  }
7
7
 
8
+ def isNewArchitectureEnabled() {
9
+ // To opt-in for the New Architecture, you can either:
10
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
11
+ // - Invoke gradle with `-newArchEnabled=true`
12
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
13
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
14
+ }
15
+
8
16
  // expo plugin
9
17
  if (rootProject.ext.has('expoRNMapboxMapsImpl')) {
10
18
  rootProject.ext.set('RNMapboxMapsImpl', rootProject.ext.get('expoRNMapboxMapsImpl'))
@@ -25,6 +33,9 @@ buildscript {
25
33
  }
26
34
  }
27
35
 
36
+ if (isNewArchitectureEnabled()) {
37
+ apply plugin: 'com.facebook.react'
38
+ }
28
39
  apply plugin: 'com.android.library'
29
40
 
30
41
  if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
@@ -68,6 +79,14 @@ android {
68
79
  throw new GradleException(msg)
69
80
  }
70
81
 
82
+ if (!isNewArchitectureEnabled()) {
83
+ sourceSets {
84
+ main {
85
+ java.srcDirs += 'src/main/old-arch'
86
+ }
87
+ }
88
+ }
89
+
71
90
  compileSdkVersion safeExtGet("compileSdkVersion", 28)
72
91
  buildToolsVersion safeExtGet("buildToolsVersion", '28.0.3')
73
92
 
@@ -76,6 +95,7 @@ android {
76
95
  targetSdkVersion safeExtGet('targetSdkVersion', 26)
77
96
  versionCode 1
78
97
  versionName "1.0"
98
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
79
99
  }
80
100
 
81
101
  compileOptions {
@@ -1,14 +1,21 @@
1
1
  package com.mapbox.rctmgl;
2
2
 
3
+ import androidx.annotation.Nullable;
4
+
3
5
  import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.TurboReactPackage;
4
7
  import com.facebook.react.bridge.JavaScriptModule;
5
8
  import com.facebook.react.bridge.NativeModule;
6
9
  import com.facebook.react.bridge.ReactApplicationContext;
10
+ import com.facebook.react.module.model.ReactModuleInfo;
11
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
7
12
  import com.facebook.react.uimanager.ViewManager;
8
13
 
9
14
  import java.util.ArrayList;
10
15
  import java.util.Collections;
16
+ import java.util.HashMap;
11
17
  import java.util.List;
18
+ import java.util.Map;
12
19
 
13
20
  import com.mapbox.rctmgl.components.camera.RCTMGLCameraManager;
14
21
 
@@ -18,6 +25,7 @@ import com.mapbox.rctmgl.components.annotation.RCTMGLMarkerViewManager;
18
25
  import com.mapbox.rctmgl.components.images.RCTMGLImageManager;
19
26
  import com.mapbox.rctmgl.components.images.RCTMGLImagesManager;
20
27
  import com.mapbox.rctmgl.components.location.RCTMGLNativeUserLocationManager;
28
+ import com.mapbox.rctmgl.components.mapview.NativeMapViewModule;
21
29
  import com.mapbox.rctmgl.components.mapview.RCTMGLMapViewManager;
22
30
  import com.mapbox.rctmgl.components.mapview.RCTMGLAndroidTextureMapViewManager;
23
31
  import com.mapbox.rctmgl.components.styles.atmosphere.RCTMGLAtmosphereManager;
@@ -49,20 +57,27 @@ import com.mapbox.rctmgl.modules.RCTMGLLocationModule;
49
57
  import com.mapbox.rctmgl.modules.RCTMGLModule;
50
58
 
51
59
 
52
- public class RCTMGLPackage implements ReactPackage {
60
+ public class RCTMGLPackage extends TurboReactPackage {
53
61
 
62
+ @Nullable
54
63
  @Override
55
- public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
56
- List<NativeModule> modules = new ArrayList<>();
57
- modules.add(new RCTMGLModule(reactApplicationContext));
58
- modules.add(new RCTMGLLocationModule(reactApplicationContext));
59
-
60
- modules.add(new RCTMGLOfflineModule(reactApplicationContext));
61
- modules.add(new RCTMGLSnapshotModule(reactApplicationContext));
62
-
63
- modules.add(new RCTMGLLogging(reactApplicationContext));
64
-
65
- return modules;
64
+ public NativeModule getModule(String s, ReactApplicationContext reactApplicationContext) {
65
+ switch (s) {
66
+ case RCTMGLModule.REACT_CLASS:
67
+ return new RCTMGLModule(reactApplicationContext);
68
+ case RCTMGLLocationModule.REACT_CLASS:
69
+ return new RCTMGLLocationModule(reactApplicationContext);
70
+ case RCTMGLOfflineModule.REACT_CLASS:
71
+ return new RCTMGLOfflineModule(reactApplicationContext);
72
+ case RCTMGLSnapshotModule.REACT_CLASS:
73
+ return new RCTMGLSnapshotModule(reactApplicationContext);
74
+ case RCTMGLLogging.REACT_CLASS:
75
+ return new RCTMGLLogging(reactApplicationContext);
76
+ case NativeMapViewModule.NAME:
77
+ return new NativeMapViewModule(reactApplicationContext);
78
+ }
79
+
80
+ return null;
66
81
  }
67
82
 
68
83
  @Deprecated
@@ -115,4 +130,86 @@ public class RCTMGLPackage implements ReactPackage {
115
130
 
116
131
  return managers;
117
132
  }
133
+
134
+ @Override
135
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
136
+ return () -> {
137
+ final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
138
+ boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
139
+
140
+ moduleInfos.put(
141
+ RCTMGLModule.REACT_CLASS,
142
+ new ReactModuleInfo(
143
+ RCTMGLModule.REACT_CLASS,
144
+ RCTMGLModule.REACT_CLASS,
145
+ false, // canOverrideExistingModule
146
+ false, // needsEagerInit
147
+ true, // hasConstants
148
+ false, // isCxxModule
149
+ false // isTurboModule
150
+ ));
151
+
152
+ moduleInfos.put(
153
+ RCTMGLLocationModule.REACT_CLASS,
154
+ new ReactModuleInfo(
155
+ RCTMGLLocationModule.REACT_CLASS,
156
+ RCTMGLLocationModule.REACT_CLASS,
157
+ false, // canOverrideExistingModule
158
+ false, // needsEagerInit
159
+ true, // hasConstants
160
+ false, // isCxxModule
161
+ false // isTurboModule
162
+ ));
163
+
164
+ moduleInfos.put(
165
+ RCTMGLOfflineModule.REACT_CLASS,
166
+ new ReactModuleInfo(
167
+ RCTMGLOfflineModule.REACT_CLASS,
168
+ RCTMGLOfflineModule.REACT_CLASS,
169
+ false, // canOverrideExistingModule
170
+ false, // needsEagerInit
171
+ true, // hasConstants
172
+ false, // isCxxModule
173
+ false // isTurboModule
174
+ ));
175
+
176
+ moduleInfos.put(
177
+ RCTMGLSnapshotModule.REACT_CLASS,
178
+ new ReactModuleInfo(
179
+ RCTMGLSnapshotModule.REACT_CLASS,
180
+ RCTMGLSnapshotModule.REACT_CLASS,
181
+ false, // canOverrideExistingModule
182
+ false, // needsEagerInit
183
+ true, // hasConstants
184
+ false, // isCxxModule
185
+ false // isTurboModule
186
+ ));
187
+
188
+ moduleInfos.put(
189
+ RCTMGLLogging.REACT_CLASS,
190
+ new ReactModuleInfo(
191
+ RCTMGLLogging.REACT_CLASS,
192
+ RCTMGLLogging.REACT_CLASS,
193
+ false, // canOverrideExistingModule
194
+ false, // needsEagerInit
195
+ true, // hasConstants
196
+ false, // isCxxModule
197
+ false // isTurboModule
198
+ ));
199
+
200
+ moduleInfos.put(
201
+ NativeMapViewModule.NAME,
202
+ new ReactModuleInfo(
203
+ NativeMapViewModule.NAME,
204
+ NativeMapViewModule.NAME,
205
+ false, // canOverrideExistingModule
206
+ false, // needsEagerInit
207
+ false, // hasConstants
208
+ false, // isCxxModule
209
+ isTurboModule // isTurboModule
210
+ ));
211
+
212
+ return moduleInfos;
213
+ };
214
+ }
118
215
  }
@@ -5,11 +5,10 @@ import android.view.ViewGroup
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.common.MapBuilder
7
7
  import com.facebook.react.uimanager.ThemedReactContext
8
- import com.facebook.react.uimanager.UIManagerModule
8
+ import com.facebook.react.uimanager.UIManagerHelper
9
9
  import com.facebook.react.uimanager.ViewGroupManager
10
10
  import com.facebook.react.uimanager.events.EventDispatcher
11
11
  import com.mapbox.rctmgl.events.IEvent
12
- import javax.annotation.Nonnull
13
12
 
14
13
  /**
15
14
  * Created by nickitaliano on 8/23/17.
@@ -47,7 +46,7 @@ abstract class AbstractEventEmitter<T : ViewGroup?>(reactApplicationContext: Rea
47
46
  }
48
47
 
49
48
  override fun addEventEmitters(context: ThemedReactContext, view: T) {
50
- mEventDispatcher = context.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
49
+ mEventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, view!!.id)
51
50
  }
52
51
 
53
52
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
@@ -0,0 +1,193 @@
1
+ package com.mapbox.rctmgl.components.mapview
2
+
3
+ import com.facebook.react.bridge.Promise
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.ReadableArray
6
+ import com.facebook.react.bridge.WritableMap
7
+ import com.facebook.react.bridge.WritableNativeMap
8
+ import com.facebook.react.uimanager.UIManagerHelper
9
+ import com.facebook.react.uimanager.common.UIManagerType
10
+ import com.mapbox.rctmgl.BuildConfig
11
+ import com.mapbox.rctmgl.NativeMapViewModuleSpec
12
+ import com.mapbox.rctmgl.utils.ConvertUtils
13
+ import com.mapbox.rctmgl.utils.ExpressionParser
14
+ import com.mapbox.rctmgl.utils.extensions.toCoordinate
15
+ import com.mapbox.rctmgl.utils.extensions.toScreenCoordinate
16
+
17
+ class NativeMapViewModule(context: ReactApplicationContext) : NativeMapViewModuleSpec(context) {
18
+ private fun withMapViewOnUIThread(viewRef: Double?, promise: Promise, fn: (RCTMGLMapView) -> Unit) {
19
+ if (viewRef == null) {
20
+ return
21
+ }
22
+
23
+ reactApplicationContext.runOnUiQueueThread {
24
+ val manager = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED)
25
+ UIManagerHelper.getUIManager(reactApplicationContext, UIManagerType.FABRIC)
26
+ else
27
+ UIManagerHelper.getUIManager(reactApplicationContext, UIManagerType.DEFAULT)
28
+
29
+ val view = manager?.resolveView(viewRef.toInt()) as? RCTMGLMapView
30
+
31
+ if (view != null) {
32
+ fn(view)
33
+ } else {
34
+ promise.reject(Exception("cannot find map view for tag ${viewRef.toInt()}"))
35
+ }
36
+ }
37
+ }
38
+
39
+ private fun createCommandResponse(promise: Promise): CommandResponse = object : CommandResponse {
40
+ override fun success(builder: (WritableMap) -> Unit) {
41
+ val payload: WritableMap = WritableNativeMap()
42
+ builder(payload)
43
+
44
+ promise.resolve(payload)
45
+ }
46
+
47
+ override fun error(message: String) {
48
+ promise.reject(Exception(message))
49
+ }
50
+ }
51
+
52
+ override fun takeSnap(viewRef: Double?, writeToDisk: Boolean, promise: Promise) {
53
+ withMapViewOnUIThread(viewRef, promise) {
54
+ it.takeSnap(writeToDisk, createCommandResponse(promise))
55
+ }
56
+ }
57
+
58
+ override fun queryTerrainElevation(
59
+ viewRef: Double?,
60
+ coordinates: ReadableArray,
61
+ promise: Promise
62
+ ) {
63
+ withMapViewOnUIThread(viewRef, promise) {
64
+ it.queryTerrainElevation(coordinates.getDouble(0), coordinates.getDouble(1), createCommandResponse(promise))
65
+ }
66
+ }
67
+
68
+ override fun setSourceVisibility(
69
+ viewRef: Double?,
70
+ visible: Boolean,
71
+ sourceId: String,
72
+ sourceLayerId: String?,
73
+ promise: Promise
74
+ ) {
75
+ withMapViewOnUIThread(viewRef, promise) {
76
+ it.setSourceVisibility(visible, sourceId, sourceLayerId)
77
+
78
+ promise.resolve(null)
79
+ }
80
+ }
81
+
82
+ override fun getCenter(viewRef: Double?, promise: Promise) {
83
+ withMapViewOnUIThread(viewRef, promise) {
84
+ it.getCenter(createCommandResponse(promise))
85
+ }
86
+ }
87
+
88
+ override fun getCoordinateFromView(
89
+ viewRef: Double?,
90
+ atPoint: ReadableArray,
91
+ promise: Promise
92
+ ) {
93
+ withMapViewOnUIThread(viewRef, promise) {
94
+ it.getCoordinateFromView(atPoint.toScreenCoordinate(), createCommandResponse(promise))
95
+ }
96
+ }
97
+
98
+ override fun getPointInView(viewRef: Double?, atCoordinate: ReadableArray, promise: Promise) {
99
+ withMapViewOnUIThread(viewRef, promise) {
100
+ it.getPointInView(atCoordinate.toCoordinate(), createCommandResponse(promise))
101
+ }
102
+ }
103
+
104
+ override fun getZoom(viewRef: Double?, promise: Promise) {
105
+ withMapViewOnUIThread(viewRef, promise) {
106
+ it.getZoom(createCommandResponse(promise))
107
+ }
108
+ }
109
+
110
+ override fun getVisibleBounds(viewRef: Double?, promise: Promise) {
111
+ withMapViewOnUIThread(viewRef, promise) {
112
+ it.getVisibleBounds(createCommandResponse(promise))
113
+ }
114
+ }
115
+
116
+ override fun queryRenderedFeaturesAtPoint(
117
+ viewRef: Double?,
118
+ atPoint: ReadableArray,
119
+ withFilter: ReadableArray,
120
+ withLayerIDs: ReadableArray,
121
+ promise: Promise
122
+ ) {
123
+ withMapViewOnUIThread(viewRef, promise) {
124
+ val layerIds = ConvertUtils.toStringList(withLayerIDs)
125
+
126
+ it.queryRenderedFeaturesAtPoint(
127
+ ConvertUtils.toPointF(atPoint),
128
+ ExpressionParser.from(withFilter),
129
+ if (layerIds.size == 0) null else layerIds,
130
+ createCommandResponse(promise)
131
+ )
132
+ }
133
+ }
134
+
135
+ override fun queryRenderedFeaturesInRect(
136
+ viewRef: Double?,
137
+ withBBox: ReadableArray,
138
+ withFilter: ReadableArray,
139
+ withLayerIDs: ReadableArray,
140
+ promise: Promise
141
+ ) {
142
+ withMapViewOnUIThread(viewRef, promise) {
143
+ val layerIds = ConvertUtils.toStringList(withLayerIDs)
144
+
145
+ it.queryRenderedFeaturesInRect(
146
+ ConvertUtils.toRectF(withBBox),
147
+ ExpressionParser.from(withFilter),
148
+ if (layerIds.size == 0) null else layerIds,
149
+ createCommandResponse(promise)
150
+ )
151
+ }
152
+ }
153
+
154
+ override fun setHandledMapChangedEvents(
155
+ viewRef: Double?,
156
+ events: ReadableArray,
157
+ promise: Promise
158
+ ) {
159
+ withMapViewOnUIThread(viewRef, promise) {
160
+ it.setHandledMapChangedEvents(events.asArrayString())
161
+ promise.resolve(null)
162
+ }
163
+ }
164
+
165
+ override fun clearData(viewRef: Double?, promise: Promise) {
166
+ withMapViewOnUIThread(viewRef, promise) {
167
+ it.clearData(createCommandResponse(promise))
168
+ }
169
+ }
170
+
171
+ override fun querySourceFeatures(
172
+ viewRef: Double?,
173
+ sourceId: String,
174
+ withFilter: ReadableArray,
175
+ withSourceLayerIDs: ReadableArray,
176
+ promise: Promise
177
+ ) {
178
+ withMapViewOnUIThread(viewRef, promise) {
179
+ val sourceLayerIds = ConvertUtils.toStringList(withSourceLayerIDs)
180
+
181
+ it.querySourceFeatures(
182
+ sourceId,
183
+ ExpressionParser.from(withFilter),
184
+ if (sourceLayerIds.size == 0) null else sourceLayerIds,
185
+ createCommandResponse(promise)
186
+ )
187
+ }
188
+ }
189
+
190
+ companion object {
191
+ const val NAME = "MBXMapViewModule"
192
+ }
193
+ }
@@ -2,11 +2,25 @@ package com.mapbox.rctmgl.components.mapview
2
2
 
3
3
  import com.facebook.react.bridge.ReactApplicationContext
4
4
  import com.facebook.react.uimanager.ThemedReactContext
5
+ import com.facebook.react.uimanager.ViewManagerDelegate
6
+ import com.facebook.react.viewmanagers.MBXAndroidTextureMapViewManagerDelegate
7
+ import com.facebook.react.viewmanagers.MBXAndroidTextureMapViewManagerInterface
8
+ import com.facebook.react.viewmanagers.MBXMapViewManagerDelegate
5
9
  import com.mapbox.maps.MapInitOptions
6
10
 
7
11
  class RCTMGLAndroidTextureMapViewManager(context: ReactApplicationContext) : RCTMGLMapViewManager(
8
12
  context
9
- ) {
13
+ ), MBXAndroidTextureMapViewManagerInterface<RCTMGLMapView> {
14
+ private val mDelegate: ViewManagerDelegate<RCTMGLMapView>
15
+
16
+ init {
17
+ mDelegate = MBXAndroidTextureMapViewManagerDelegate<RCTMGLMapView, RCTMGLAndroidTextureMapViewManager>(this)
18
+ }
19
+
20
+ override fun getDelegate(): ViewManagerDelegate<RCTMGLMapView>? {
21
+ return mDelegate
22
+ }
23
+
10
24
  override fun getName(): String {
11
25
  return REACT_CLASS
12
26
  }
@@ -18,6 +32,6 @@ class RCTMGLAndroidTextureMapViewManager(context: ReactApplicationContext) : RCT
18
32
  }
19
33
 
20
34
  companion object {
21
- const val REACT_CLASS = "RCTMGLAndroidTextureMapView"
35
+ const val REACT_CLASS = "MBXAndroidTextureMapView"
22
36
  }
23
37
  }
@@ -970,7 +970,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
970
970
  ScreenCoordinate(rect.right.toDouble(), rect.bottom.toDouble() ),
971
971
  ScreenCoordinate(rect.left.toDouble(), rect.top.toDouble()),
972
972
  )
973
- mMap?.queryRenderedFeatures(
973
+ mMap.queryRenderedFeatures(
974
974
  RenderedQueryGeometry(screenBox),
975
975
  RenderedQueryOptions(layerIDs, filter)
976
976
  ) { features ->