@maplibre/maplibre-react-native 11.0.0-alpha.33 → 11.0.0-alpha.34
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/MapLibreReactNative.podspec +1 -1
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +102 -90
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +271 -176
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +66 -34
- package/android/src/main/java/org/maplibre/reactnative/http/RequestHeadersInterceptor.kt +65 -0
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNNetworkModule.kt +67 -0
- package/ios/modules/network/MLRNNetworkHTTPHeaders.h +14 -0
- package/ios/modules/network/MLRNNetworkHTTPHeaders.m +97 -0
- package/ios/modules/network/MLRNNetworkModule.h +8 -0
- package/ios/modules/network/MLRNNetworkModule.mm +28 -0
- package/lib/commonjs/components/layers/BackgroundLayer.js +2 -9
- package/lib/commonjs/components/layers/BackgroundLayer.js.map +1 -1
- package/lib/commonjs/components/layers/CircleLayer.js +2 -9
- package/lib/commonjs/components/layers/CircleLayer.js.map +1 -1
- package/lib/commonjs/components/layers/FillExtrusionLayer.js +2 -9
- package/lib/commonjs/components/layers/FillExtrusionLayer.js.map +1 -1
- package/lib/commonjs/components/layers/FillLayer.js +2 -9
- package/lib/commonjs/components/layers/FillLayer.js.map +1 -1
- package/lib/commonjs/components/layers/HeatmapLayer.js +2 -9
- package/lib/commonjs/components/layers/HeatmapLayer.js.map +1 -1
- package/lib/commonjs/components/layers/LineLayer.js +2 -9
- package/lib/commonjs/components/layers/LineLayer.js.map +1 -1
- package/lib/commonjs/components/layers/RasterLayer.js +2 -9
- package/lib/commonjs/components/layers/RasterLayer.js.map +1 -1
- package/lib/commonjs/components/layers/SymbolLayer.js +2 -9
- package/lib/commonjs/components/layers/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/map-view/MapView.js +0 -4
- package/lib/commonjs/components/map-view/MapView.js.map +1 -1
- package/lib/commonjs/index.js +8 -43
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/network/NativeNetworkModule.js +9 -0
- package/lib/commonjs/modules/network/NativeNetworkModule.js.map +1 -0
- package/lib/commonjs/modules/network/NetworkManager.js +72 -0
- package/lib/commonjs/modules/network/NetworkManager.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotManager.js +3 -5
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +1 -3
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/components/layers/BackgroundLayer.js +3 -10
- package/lib/module/components/layers/BackgroundLayer.js.map +1 -1
- package/lib/module/components/layers/CircleLayer.js +3 -10
- package/lib/module/components/layers/CircleLayer.js.map +1 -1
- package/lib/module/components/layers/FillExtrusionLayer.js +3 -10
- package/lib/module/components/layers/FillExtrusionLayer.js.map +1 -1
- package/lib/module/components/layers/FillLayer.js +3 -10
- package/lib/module/components/layers/FillLayer.js.map +1 -1
- package/lib/module/components/layers/HeatmapLayer.js +3 -10
- package/lib/module/components/layers/HeatmapLayer.js.map +1 -1
- package/lib/module/components/layers/LineLayer.js +3 -10
- package/lib/module/components/layers/LineLayer.js.map +1 -1
- package/lib/module/components/layers/RasterLayer.js +3 -10
- package/lib/module/components/layers/RasterLayer.js.map +1 -1
- package/lib/module/components/layers/SymbolLayer.js +3 -10
- package/lib/module/components/layers/SymbolLayer.js.map +1 -1
- package/lib/module/components/map-view/MapView.js +1 -5
- package/lib/module/components/map-view/MapView.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/network/NativeNetworkModule.js +5 -0
- package/lib/module/modules/network/NativeNetworkModule.js.map +1 -0
- package/lib/module/modules/network/NetworkManager.js +68 -0
- package/lib/module/modules/network/NetworkManager.js.map +1 -0
- package/lib/module/modules/snapshot/SnapshotManager.js +3 -5
- package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js +1 -3
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/BackgroundLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/CircleLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/FillExtrusionLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/FillLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/FillLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/HeatmapLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/LineLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/LineLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/RasterLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/layers/SymbolLayer.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/layers/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/network/NativeNetworkModule.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/network/NativeNetworkModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/network/NetworkManager.d.ts +56 -0
- package/lib/typescript/commonjs/src/modules/network/NetworkManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotManager.d.ts +2 -3
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +7 -7
- package/lib/typescript/module/src/components/layers/BackgroundLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/CircleLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/FillExtrusionLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/FillLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/FillLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/HeatmapLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/LineLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/LineLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/RasterLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/layers/SymbolLayer.d.ts +1 -1
- package/lib/typescript/module/src/components/layers/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/network/NativeNetworkModule.d.ts +9 -0
- package/lib/typescript/module/src/modules/network/NativeNetworkModule.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/network/NetworkManager.d.ts +56 -0
- package/lib/typescript/module/src/modules/network/NetworkManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/snapshot/SnapshotManager.d.ts +2 -3
- package/lib/typescript/module/src/modules/snapshot/SnapshotManager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts +2 -1
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +7 -7
- package/package.json +2 -2
- package/src/components/layers/BackgroundLayer.tsx +3 -11
- package/src/components/layers/CircleLayer.tsx +3 -11
- package/src/components/layers/FillExtrusionLayer.tsx +3 -11
- package/src/components/layers/FillLayer.tsx +3 -11
- package/src/components/layers/HeatmapLayer.tsx +3 -11
- package/src/components/layers/LineLayer.tsx +3 -11
- package/src/components/layers/RasterLayer.tsx +3 -11
- package/src/components/layers/SymbolLayer.tsx +3 -11
- package/src/components/map-view/MapView.tsx +0 -8
- package/src/index.ts +4 -3
- package/src/modules/network/NativeNetworkModule.ts +12 -0
- package/src/modules/network/NetworkManager.ts +74 -0
- package/src/modules/snapshot/SnapshotManager.ts +3 -5
- package/src/modules/snapshot/SnapshotOptions.ts +3 -5
- package/android/src/main/java/org/maplibre/reactnative/http/CustomHeadersInterceptor.java +0 -38
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +0 -112
- package/ios/modules/mlrn/MLRNCustomHeaders.h +0 -20
- package/ios/modules/mlrn/MLRNCustomHeaders.m +0 -98
- package/ios/modules/mlrn/MLRNModule.h +0 -5
- package/ios/modules/mlrn/MLRNModule.m +0 -45
- package/lib/commonjs/MLRNModule.js +0 -21
- package/lib/commonjs/MLRNModule.js.map +0 -1
- package/lib/module/MLRNModule.js +0 -12
- package/lib/module/MLRNModule.js.map +0 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +0 -6
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +0 -1
- package/lib/typescript/module/src/MLRNModule.d.ts +0 -6
- package/lib/typescript/module/src/MLRNModule.d.ts.map +0 -1
- package/src/MLRNModule.ts +0 -28
package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt
CHANGED
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.Promise
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReadableArray
|
|
7
7
|
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
import org.maplibre.android.MapLibre
|
|
8
9
|
import org.maplibre.reactnative.NativeMapViewModuleSpec
|
|
9
10
|
import org.maplibre.reactnative.utils.ConvertUtils
|
|
10
11
|
import org.maplibre.reactnative.utils.ExpressionParser
|
|
@@ -14,68 +15,97 @@ import org.maplibre.reactnative.utils.ReactTagResolver
|
|
|
14
15
|
|
|
15
16
|
@ReactModule(name = NativeMapViewModuleSpec.NAME)
|
|
16
17
|
class MLRNMapViewModule(
|
|
17
|
-
reactContext: ReactApplicationContext,
|
|
18
|
+
reactContext: ReactApplicationContext,
|
|
19
|
+
private val reactTagResolver: ReactTagResolver,
|
|
18
20
|
) : NativeMapViewModuleSpec(reactContext) {
|
|
19
21
|
companion object {
|
|
20
22
|
const val NAME = "MLRNMapViewModule"
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
override fun initialize() {
|
|
26
|
+
reactApplicationContext.runOnUiQueueThread { MapLibre.getInstance(reactApplicationContext) }
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
private fun withViewportOnUIThread(
|
|
24
|
-
reactTag: ReactTag,
|
|
30
|
+
reactTag: ReactTag,
|
|
31
|
+
promise: Promise,
|
|
32
|
+
fn: (MLRNMapView) -> Unit,
|
|
25
33
|
) {
|
|
26
34
|
reactTagResolver.withViewResolved(reactTag.toInt(), promise, fn)
|
|
27
35
|
}
|
|
28
36
|
|
|
29
|
-
override fun getCenter(
|
|
37
|
+
override fun getCenter(
|
|
38
|
+
reactTag: Double,
|
|
39
|
+
promise: Promise,
|
|
40
|
+
) {
|
|
30
41
|
withViewportOnUIThread(reactTag, promise) {
|
|
31
42
|
promise.resolve(it.getCenter())
|
|
32
43
|
}
|
|
33
44
|
}
|
|
34
45
|
|
|
35
|
-
override fun getZoom(
|
|
46
|
+
override fun getZoom(
|
|
47
|
+
reactTag: Double,
|
|
48
|
+
promise: Promise,
|
|
49
|
+
) {
|
|
36
50
|
withViewportOnUIThread(reactTag, promise) {
|
|
37
51
|
promise.resolve(it.getZoom())
|
|
38
52
|
}
|
|
39
53
|
}
|
|
40
54
|
|
|
41
|
-
override fun getBearing(
|
|
55
|
+
override fun getBearing(
|
|
56
|
+
reactTag: Double,
|
|
57
|
+
promise: Promise,
|
|
58
|
+
) {
|
|
42
59
|
withViewportOnUIThread(reactTag, promise) {
|
|
43
60
|
promise.resolve(it.getBearing())
|
|
44
61
|
}
|
|
45
62
|
}
|
|
46
63
|
|
|
47
|
-
override fun getPitch(
|
|
64
|
+
override fun getPitch(
|
|
65
|
+
reactTag: Double,
|
|
66
|
+
promise: Promise,
|
|
67
|
+
) {
|
|
48
68
|
withViewportOnUIThread(reactTag, promise) {
|
|
49
69
|
promise.resolve(it.getPitch())
|
|
50
70
|
}
|
|
51
71
|
}
|
|
52
72
|
|
|
53
|
-
override fun getBounds(
|
|
73
|
+
override fun getBounds(
|
|
74
|
+
reactTag: Double,
|
|
75
|
+
promise: Promise,
|
|
76
|
+
) {
|
|
54
77
|
withViewportOnUIThread(reactTag, promise) {
|
|
55
78
|
promise.resolve(it.getBounds())
|
|
56
79
|
}
|
|
57
80
|
}
|
|
58
81
|
|
|
59
|
-
override fun getViewState(
|
|
82
|
+
override fun getViewState(
|
|
83
|
+
reactTag: Double,
|
|
84
|
+
promise: Promise,
|
|
85
|
+
) {
|
|
60
86
|
withViewportOnUIThread(reactTag, promise) {
|
|
61
87
|
promise.resolve(it.getViewState())
|
|
62
88
|
}
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
override fun project(
|
|
66
|
-
reactTag: Double,
|
|
92
|
+
reactTag: Double,
|
|
93
|
+
lngLat: ReadableArray,
|
|
94
|
+
promise: Promise,
|
|
67
95
|
) {
|
|
68
96
|
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
69
97
|
promise.resolve(
|
|
70
98
|
mapView.project(
|
|
71
|
-
GeoJSONUtils.toLatLng(lngLat)
|
|
72
|
-
)
|
|
99
|
+
GeoJSONUtils.toLatLng(lngLat)!!,
|
|
100
|
+
),
|
|
73
101
|
)
|
|
74
102
|
}
|
|
75
103
|
}
|
|
76
104
|
|
|
77
105
|
override fun unproject(
|
|
78
|
-
reactTag: Double,
|
|
106
|
+
reactTag: Double,
|
|
107
|
+
pixelPoint: ReadableArray,
|
|
108
|
+
promise: Promise,
|
|
79
109
|
) {
|
|
80
110
|
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
81
111
|
promise.resolve(mapView.unproject(ConvertUtils.toPointF(pixelPoint)))
|
|
@@ -87,7 +117,7 @@ class MLRNMapViewModule(
|
|
|
87
117
|
pixelPoint: ReadableArray,
|
|
88
118
|
layers: ReadableArray?,
|
|
89
119
|
filter: ReadableArray?,
|
|
90
|
-
promise: Promise
|
|
120
|
+
promise: Promise,
|
|
91
121
|
) {
|
|
92
122
|
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
93
123
|
promise.resolve(
|
|
@@ -95,7 +125,7 @@ class MLRNMapViewModule(
|
|
|
95
125
|
ConvertUtils.toPointF(pixelPoint),
|
|
96
126
|
layers,
|
|
97
127
|
ExpressionParser.from(filter),
|
|
98
|
-
)
|
|
128
|
+
),
|
|
99
129
|
)
|
|
100
130
|
}
|
|
101
131
|
}
|
|
@@ -105,31 +135,30 @@ class MLRNMapViewModule(
|
|
|
105
135
|
pixelPointBounds: ReadableArray?,
|
|
106
136
|
layers: ReadableArray?,
|
|
107
137
|
filter: ReadableArray?,
|
|
108
|
-
promise: Promise
|
|
138
|
+
promise: Promise,
|
|
109
139
|
) {
|
|
110
|
-
|
|
111
|
-
|
|
112
140
|
withViewportOnUIThread(reactTag, promise) { mapView ->
|
|
113
|
-
val rect =
|
|
114
|
-
null
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
val rect =
|
|
142
|
+
if (pixelPointBounds == null) {
|
|
143
|
+
null
|
|
144
|
+
} else {
|
|
145
|
+
val topLeft = pixelPointBounds.getArray(0)
|
|
146
|
+
val bottomRight = pixelPointBounds.getArray(1)
|
|
147
|
+
|
|
148
|
+
RectF(
|
|
149
|
+
topLeft!!.getDouble(0).toFloat(),
|
|
150
|
+
topLeft.getDouble(1).toFloat(),
|
|
151
|
+
bottomRight!!.getDouble(0).toFloat(),
|
|
152
|
+
bottomRight.getDouble(1).toFloat(),
|
|
153
|
+
)
|
|
154
|
+
}
|
|
126
155
|
|
|
127
156
|
promise.resolve(
|
|
128
157
|
mapView.queryRenderedFeaturesWithRect(
|
|
129
158
|
rect,
|
|
130
159
|
layers,
|
|
131
160
|
ExpressionParser.from(filter),
|
|
132
|
-
)
|
|
161
|
+
),
|
|
133
162
|
)
|
|
134
163
|
}
|
|
135
164
|
}
|
|
@@ -139,7 +168,7 @@ class MLRNMapViewModule(
|
|
|
139
168
|
visible: Boolean,
|
|
140
169
|
sourceId: String,
|
|
141
170
|
sourceLayerId: String?,
|
|
142
|
-
promise: Promise
|
|
171
|
+
promise: Promise,
|
|
143
172
|
) {
|
|
144
173
|
withViewportOnUIThread(reactTag, promise) {
|
|
145
174
|
it.setSourceVisibility(visible, sourceId, sourceLayerId)
|
|
@@ -148,7 +177,9 @@ class MLRNMapViewModule(
|
|
|
148
177
|
}
|
|
149
178
|
|
|
150
179
|
override fun takeSnap(
|
|
151
|
-
reactTag: Double,
|
|
180
|
+
reactTag: Double,
|
|
181
|
+
writeToDisk: Boolean,
|
|
182
|
+
promise: Promise,
|
|
152
183
|
) {
|
|
153
184
|
withViewportOnUIThread(reactTag, promise) {
|
|
154
185
|
it.takeSnap(writeToDisk) { payload ->
|
|
@@ -158,7 +189,8 @@ class MLRNMapViewModule(
|
|
|
158
189
|
}
|
|
159
190
|
|
|
160
191
|
override fun showAttribution(
|
|
161
|
-
reactTag: Double,
|
|
192
|
+
reactTag: Double,
|
|
193
|
+
promise: Promise,
|
|
162
194
|
) {
|
|
163
195
|
withViewportOnUIThread(reactTag, promise) {
|
|
164
196
|
it.showAttribution()
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
package org.maplibre.reactnative.http
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import okhttp3.Interceptor
|
|
5
|
+
import okhttp3.Response
|
|
6
|
+
import java.io.IOException
|
|
7
|
+
|
|
8
|
+
data class HeaderConfig(
|
|
9
|
+
val value: String,
|
|
10
|
+
val matchRegex: Regex?,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class RequestHeadersInterceptor : Interceptor {
|
|
14
|
+
private val requestHeaders: MutableMap<String, HeaderConfig> = HashMap()
|
|
15
|
+
|
|
16
|
+
fun addHeader(
|
|
17
|
+
name: String,
|
|
18
|
+
value: String,
|
|
19
|
+
match: String?,
|
|
20
|
+
) {
|
|
21
|
+
val regex =
|
|
22
|
+
if (match != null) {
|
|
23
|
+
try {
|
|
24
|
+
Regex(match)
|
|
25
|
+
} catch (e: Exception) {
|
|
26
|
+
Log.e(
|
|
27
|
+
"RequestHeadersInterceptor",
|
|
28
|
+
"Invalid regex pattern '$match': ${e.message}",
|
|
29
|
+
)
|
|
30
|
+
null
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
requestHeaders[name] = HeaderConfig(value, regex)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fun removeHeader(name: String) {
|
|
40
|
+
requestHeaders.remove(name)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Throws(IOException::class)
|
|
44
|
+
override fun intercept(chain: Interceptor.Chain): Response {
|
|
45
|
+
val modifiedHeaderBuilder = chain.request().newBuilder()
|
|
46
|
+
val requestUrl = chain.request().url.toString()
|
|
47
|
+
|
|
48
|
+
for (entry in requestHeaders.entries) {
|
|
49
|
+
val config = entry.value
|
|
50
|
+
val shouldApply =
|
|
51
|
+
config.matchRegex == null || config.matchRegex.containsMatchIn(requestUrl)
|
|
52
|
+
|
|
53
|
+
if (shouldApply) {
|
|
54
|
+
modifiedHeaderBuilder.addHeader(entry.key, config.value)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
val request = modifiedHeaderBuilder.build()
|
|
59
|
+
return chain.proceed(request)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
companion object {
|
|
63
|
+
val INSTANCE: RequestHeadersInterceptor = RequestHeadersInterceptor()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
package org.maplibre.reactnative.modules
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
import okhttp3.Dispatcher
|
|
7
|
+
import okhttp3.OkHttpClient
|
|
8
|
+
import org.maplibre.android.MapLibre
|
|
9
|
+
import org.maplibre.android.module.http.HttpRequestUtil
|
|
10
|
+
import org.maplibre.reactnative.NativeNetworkModuleSpec
|
|
11
|
+
import org.maplibre.reactnative.http.RequestHeadersInterceptor
|
|
12
|
+
|
|
13
|
+
@ReactModule(name = MLRNNetworkModule.NAME)
|
|
14
|
+
class MLRNNetworkModule(
|
|
15
|
+
reactContext: ReactApplicationContext,
|
|
16
|
+
) : NativeNetworkModuleSpec(reactContext) {
|
|
17
|
+
companion object {
|
|
18
|
+
const val NAME = "MLRNNetworkModule"
|
|
19
|
+
private var requestHeadersInterceptorAdded = false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override fun getName() = NAME
|
|
23
|
+
|
|
24
|
+
private val context: ReactApplicationContext = reactContext
|
|
25
|
+
|
|
26
|
+
override fun addRequestHeader(
|
|
27
|
+
name: String,
|
|
28
|
+
value: String,
|
|
29
|
+
match: String?,
|
|
30
|
+
) {
|
|
31
|
+
context.runOnUiQueueThread {
|
|
32
|
+
if (!requestHeadersInterceptorAdded) {
|
|
33
|
+
Log.i("MLRNNetworkModule", "Add interceptor")
|
|
34
|
+
val httpClient =
|
|
35
|
+
OkHttpClient
|
|
36
|
+
.Builder()
|
|
37
|
+
.addInterceptor(RequestHeadersInterceptor.INSTANCE)
|
|
38
|
+
.dispatcher(getDispatcher())
|
|
39
|
+
.build()
|
|
40
|
+
HttpRequestUtil.setOkHttpClient(httpClient)
|
|
41
|
+
requestHeadersInterceptorAdded = true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
RequestHeadersInterceptor.INSTANCE.addHeader(name, value, match)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun removeRequestHeader(name: String) {
|
|
49
|
+
context.runOnUiQueueThread {
|
|
50
|
+
RequestHeadersInterceptor.INSTANCE.removeHeader(name)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override fun setConnected(connected: Boolean) {
|
|
55
|
+
context.runOnUiQueueThread {
|
|
56
|
+
MapLibre.setConnected(connected)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private fun getDispatcher(): Dispatcher {
|
|
61
|
+
val dispatcher = Dispatcher()
|
|
62
|
+
// Matches core limit set on
|
|
63
|
+
// https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/src/http_file_source.cpp#L192
|
|
64
|
+
dispatcher.maxRequestsPerHost = 20
|
|
65
|
+
return dispatcher
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <MapLibre/MLNNetworkConfiguration.h>
|
|
3
|
+
|
|
4
|
+
@interface MLRNNetworkHTTPHeaders : NSObject <MLNNetworkConfigurationDelegate>
|
|
5
|
+
|
|
6
|
+
+ (id)sharedInstance;
|
|
7
|
+
|
|
8
|
+
- (void)addRequestHeader:(NSString *)name
|
|
9
|
+
value:(NSString *)value
|
|
10
|
+
match:(nullable NSString *)match;
|
|
11
|
+
|
|
12
|
+
- (void)removeRequestHeader:(NSString *)header;
|
|
13
|
+
|
|
14
|
+
@end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#import "MLRNNetworkHTTPHeaders.h"
|
|
2
|
+
#import <MapLibre/MLNNetworkConfiguration.h>
|
|
3
|
+
#import <MapLibre/MapLibre.h>
|
|
4
|
+
|
|
5
|
+
@interface HeaderConfig : NSObject
|
|
6
|
+
@property (nonatomic, strong) NSString *value;
|
|
7
|
+
@property (nonatomic, strong, nullable) NSRegularExpression *matchRegex;
|
|
8
|
+
|
|
9
|
+
- (instancetype)initWithValue:(NSString *)value match:(nullable NSString *)match;
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@implementation HeaderConfig
|
|
13
|
+
|
|
14
|
+
- (instancetype)initWithValue:(NSString *)value match:(nullable NSString *)match {
|
|
15
|
+
if (self = [super init]) {
|
|
16
|
+
_value = value;
|
|
17
|
+
|
|
18
|
+
if (match != nil) {
|
|
19
|
+
NSError *error = nil;
|
|
20
|
+
_matchRegex = [NSRegularExpression regularExpressionWithPattern:match options:0 error:&error];
|
|
21
|
+
if (error != nil) {
|
|
22
|
+
NSLog(@"[MLRNNetworkHTTPHeaders] Invalid regex pattern '%@': %@", match,
|
|
23
|
+
error.localizedDescription);
|
|
24
|
+
_matchRegex = nil;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
_matchRegex = nil;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
@implementation MLRNNetworkHTTPHeaders {
|
|
36
|
+
NSMutableDictionary<NSString *, HeaderConfig *> *requestHeaders;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (instancetype)init {
|
|
40
|
+
if (self = [super init]) {
|
|
41
|
+
requestHeaders = [[NSMutableDictionary alloc] init];
|
|
42
|
+
[[MLNNetworkConfiguration sharedManager] setDelegate:self];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
+ (id)sharedInstance {
|
|
49
|
+
static MLRNNetworkHTTPHeaders *networkHttpHeaders;
|
|
50
|
+
static dispatch_once_t onceToken;
|
|
51
|
+
|
|
52
|
+
dispatch_once(&onceToken, ^{
|
|
53
|
+
networkHttpHeaders = [[self alloc] init];
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return networkHttpHeaders;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (void)addRequestHeader:(NSString *)name value:(NSString *)value match:(nullable NSString *)match {
|
|
60
|
+
HeaderConfig *config = [[HeaderConfig alloc] initWithValue:value match:match];
|
|
61
|
+
[requestHeaders setObject:config forKey:name];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)removeRequestHeader:(NSString *)header {
|
|
65
|
+
[requestHeaders removeObjectForKey:header];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#pragma mark - MLNNetworkConfigurationDelegate
|
|
69
|
+
|
|
70
|
+
- (NSMutableURLRequest *)willSendRequest:(NSMutableURLRequest *)request {
|
|
71
|
+
NSDictionary<NSString *, HeaderConfig *> *currentHeaders = [requestHeaders copy];
|
|
72
|
+
|
|
73
|
+
if (currentHeaders != nil && [currentHeaders count] > 0) {
|
|
74
|
+
NSString *requestUrl = request.URL.absoluteString;
|
|
75
|
+
|
|
76
|
+
for (NSString *headerName in currentHeaders) {
|
|
77
|
+
HeaderConfig *config = currentHeaders[headerName];
|
|
78
|
+
BOOL shouldApply = YES;
|
|
79
|
+
|
|
80
|
+
if (config.matchRegex != nil) {
|
|
81
|
+
NSRange range =
|
|
82
|
+
[config.matchRegex rangeOfFirstMatchInString:requestUrl
|
|
83
|
+
options:0
|
|
84
|
+
range:NSMakeRange(0, requestUrl.length)];
|
|
85
|
+
shouldApply = (range.location != NSNotFound);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (shouldApply) {
|
|
89
|
+
[request setValue:config.value forHTTPHeaderField:headerName];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return request;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#import "MLRNNetworkModule.h"
|
|
2
|
+
|
|
3
|
+
#import "MLRNNetworkHTTPHeaders.h"
|
|
4
|
+
|
|
5
|
+
@implementation MLRNNetworkModule
|
|
6
|
+
|
|
7
|
+
+ (NSString *)moduleName {
|
|
8
|
+
return @"MLRNNetworkModule";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
12
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
13
|
+
return std::make_shared<facebook::react::NativeNetworkModuleSpecJSI>(params);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (void)addRequestHeader:(NSString *)name value:(NSString *)value match:(NSString *_Nullable)match {
|
|
17
|
+
[MLRNNetworkHTTPHeaders.sharedInstance addRequestHeader:name value:value match:match];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (void)removeRequestHeader:(NSString *)name {
|
|
21
|
+
[MLRNNetworkHTTPHeaders.sharedInstance removeRequestHeader:name];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (void)setConnected:(BOOL)connected {
|
|
25
|
+
// Android only
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@end
|
|
@@ -7,20 +7,13 @@ exports.NATIVE_MODULE_NAME = exports.BackgroundLayer = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _useAbstractLayer = require("../../hooks/useAbstractLayer.js");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const MLRNModule = _reactNative.NativeModules.MLRNModule;
|
|
11
10
|
const NATIVE_MODULE_NAME = exports.NATIVE_MODULE_NAME = "MLRNBackgroundLayer";
|
|
12
11
|
const MLRNBackgroundLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
13
|
-
const BackgroundLayer =
|
|
14
|
-
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
15
|
-
...props
|
|
16
|
-
}) => {
|
|
12
|
+
const BackgroundLayer = props => {
|
|
17
13
|
const {
|
|
18
14
|
baseProps,
|
|
19
15
|
setNativeLayer
|
|
20
|
-
} = (0, _useAbstractLayer.useAbstractLayer)(
|
|
21
|
-
...props,
|
|
22
|
-
sourceID
|
|
23
|
-
});
|
|
16
|
+
} = (0, _useAbstractLayer.useAbstractLayer)(props);
|
|
24
17
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNBackgroundLayer, {
|
|
25
18
|
testID: "mlrnBackgroundLayer",
|
|
26
19
|
ref: setNativeLayer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","NATIVE_MODULE_NAME","exports","MLRNBackgroundLayer","requireNativeComponent","BackgroundLayer","props","baseProps","setNativeLayer","useAbstractLayer","jsx","testID","ref"],"sourceRoot":"../../../../src","sources":["components/layers/BackgroundLayer.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAIsC,IAAAE,WAAA,GAAAF,OAAA;AAI/B,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,qBAAqB;AAYvD,MAAME,mBAAmB,GACvB,IAAAC,mCAAsB,EAAuBH,kBAAkB,CAAC;AAE3D,MAAMI,eAAe,GAAIC,KAA2B,IAAK;EAC9D,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAG,IAAAC,kCAAgB,EAGpDH,KAAK,CAAC;EAER,oBACE,IAAAN,WAAA,CAAAU,GAAA,EAACP,mBAAmB;IAClBQ,MAAM,EAAC,qBAAqB;IAC5BC,GAAG,EAAEJ,cAAe;IAAA,GAChBD;EAAS,CACd,CAAC;AAEN,CAAC;AAACL,OAAA,CAAAG,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -7,24 +7,17 @@ exports.NATIVE_MODULE_NAME = exports.CircleLayer = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _useAbstractLayer = require("../../hooks/useAbstractLayer.js");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const MLRNModule = _reactNative.NativeModules.MLRNModule;
|
|
11
10
|
const NATIVE_MODULE_NAME = exports.NATIVE_MODULE_NAME = "MLRNCircleLayer";
|
|
12
11
|
const MLRNCircleLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* CircleLayer is a style layer that renders one or more filled circles on the map.
|
|
16
15
|
*/
|
|
17
|
-
const CircleLayer =
|
|
18
|
-
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
16
|
+
const CircleLayer = props => {
|
|
21
17
|
const {
|
|
22
18
|
baseProps,
|
|
23
19
|
setNativeLayer
|
|
24
|
-
} = (0, _useAbstractLayer.useAbstractLayer)(
|
|
25
|
-
...props,
|
|
26
|
-
sourceID
|
|
27
|
-
});
|
|
20
|
+
} = (0, _useAbstractLayer.useAbstractLayer)(props);
|
|
28
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNCircleLayer, {
|
|
29
22
|
testID: "mlrnCircleLayer",
|
|
30
23
|
ref: setNativeLayer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","NATIVE_MODULE_NAME","exports","MLRNCircleLayer","requireNativeComponent","CircleLayer","props","baseProps","setNativeLayer","useAbstractLayer","jsx","testID","ref"],"sourceRoot":"../../../../src","sources":["components/layers/CircleLayer.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAIsC,IAAAE,WAAA,GAAAF,OAAA;AAI/B,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,iBAAiB;AAYnD,MAAME,eAAe,GAAG,IAAAC,mCAAsB,EAAcH,kBAAkB,CAAC;;AAE/E;AACA;AACA;AACO,MAAMI,WAAW,GAAIC,KAAuB,IAAK;EACtD,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAG,IAAAC,kCAAgB,EAGpDH,KAAK,CAAC;EAER,oBACE,IAAAN,WAAA,CAAAU,GAAA,EAACP,eAAe;IACdQ,MAAM,EAAC,iBAAiB;IACxBC,GAAG,EAAEJ,cAAe;IAAA,GAChBD;EAAS,CACd,CAAC;AAEN,CAAC;AAACL,OAAA,CAAAG,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -7,24 +7,17 @@ exports.NATIVE_MODULE_NAME = exports.FillExtrusionLayer = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _useAbstractLayer = require("../../hooks/useAbstractLayer.js");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const MLRNModule = _reactNative.NativeModules.MLRNModule;
|
|
11
10
|
const NATIVE_MODULE_NAME = exports.NATIVE_MODULE_NAME = "MLRNFillExtrusionLayer";
|
|
12
11
|
const MLRNFillExtrusionLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* FillExtrusionLayer is a style layer that renders one or more 3D extruded polygons on the map.
|
|
16
15
|
*/
|
|
17
|
-
const FillExtrusionLayer =
|
|
18
|
-
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
16
|
+
const FillExtrusionLayer = props => {
|
|
21
17
|
const {
|
|
22
18
|
baseProps,
|
|
23
19
|
setNativeLayer
|
|
24
|
-
} = (0, _useAbstractLayer.useAbstractLayer)(
|
|
25
|
-
...props,
|
|
26
|
-
sourceID
|
|
27
|
-
});
|
|
20
|
+
} = (0, _useAbstractLayer.useAbstractLayer)(props);
|
|
28
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNFillExtrusionLayer, {
|
|
29
22
|
ref: setNativeLayer,
|
|
30
23
|
...baseProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","NATIVE_MODULE_NAME","exports","MLRNFillExtrusionLayer","requireNativeComponent","FillExtrusionLayer","props","baseProps","setNativeLayer","useAbstractLayer","jsx","ref"],"sourceRoot":"../../../../src","sources":["components/layers/FillExtrusionLayer.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAIsC,IAAAE,WAAA,GAAAF,OAAA;AAI/B,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,wBAAwB;AAY1D,MAAME,sBAAsB,GAC1B,IAAAC,mCAAsB,EAAcH,kBAAkB,CAAC;;AAEzD;AACA;AACA;AACO,MAAMI,kBAAkB,GAAIC,KAA8B,IAAK;EACpE,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAG,IAAAC,kCAAgB,EAGpDH,KAAK,CAAC;EAER,oBAAO,IAAAN,WAAA,CAAAU,GAAA,EAACP,sBAAsB;IAACQ,GAAG,EAAEH,cAAe;IAAA,GAAKD;EAAS,CAAG,CAAC;AACvE,CAAC;AAACL,OAAA,CAAAG,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -7,24 +7,17 @@ exports.NATIVE_MODULE_NAME = exports.FillLayer = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _useAbstractLayer = require("../../hooks/useAbstractLayer.js");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const MLRNModule = _reactNative.NativeModules.MLRNModule;
|
|
11
10
|
const NATIVE_MODULE_NAME = exports.NATIVE_MODULE_NAME = "MLRNFillLayer";
|
|
12
11
|
const MLRNFillLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* FillLayer is a style layer that renders one or more filled (and optionally stroked) polygons on the map.
|
|
16
15
|
*/
|
|
17
|
-
const FillLayer =
|
|
18
|
-
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
16
|
+
const FillLayer = props => {
|
|
21
17
|
const {
|
|
22
18
|
baseProps,
|
|
23
19
|
setNativeLayer
|
|
24
|
-
} = (0, _useAbstractLayer.useAbstractLayer)(
|
|
25
|
-
...props,
|
|
26
|
-
sourceID
|
|
27
|
-
});
|
|
20
|
+
} = (0, _useAbstractLayer.useAbstractLayer)(props);
|
|
28
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNFillLayer, {
|
|
29
22
|
ref: setNativeLayer,
|
|
30
23
|
...baseProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_useAbstractLayer","_jsxRuntime","NATIVE_MODULE_NAME","exports","MLRNFillLayer","requireNativeComponent","FillLayer","props","baseProps","setNativeLayer","useAbstractLayer","jsx","ref"],"sourceRoot":"../../../../src","sources":["components/layers/FillLayer.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAIsC,IAAAE,WAAA,GAAAF,OAAA;AAI/B,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,eAAe;AAWjD,MAAME,aAAa,GAAG,IAAAC,mCAAsB,EAAcH,kBAAkB,CAAC;;AAE7E;AACA;AACA;AACO,MAAMI,SAAS,GAAIC,KAAqB,IAAK;EAClD,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAG,IAAAC,kCAAgB,EAGpDH,KAAK,CAAC;EAER,oBAAO,IAAAN,WAAA,CAAAU,GAAA,EAACP,aAAa;IAACQ,GAAG,EAAEH,cAAe;IAAA,GAAKD;EAAS,CAAG,CAAC;AAC9D,CAAC;AAACL,OAAA,CAAAG,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -7,23 +7,16 @@ exports.NATIVE_MODULE_NAME = exports.HeatmapLayer = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _useAbstractLayer = require("../../hooks/useAbstractLayer.js");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const MLRNModule = _reactNative.NativeModules.MLRNModule;
|
|
11
10
|
const NATIVE_MODULE_NAME = exports.NATIVE_MODULE_NAME = "MLRNHeatmapLayer";
|
|
12
11
|
const MLRNHeatmapLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
13
12
|
/**
|
|
14
13
|
* HeatmapLayer is a style layer that renders one or more filled circles on the map.
|
|
15
14
|
*/
|
|
16
|
-
const HeatmapLayer =
|
|
17
|
-
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
18
|
-
...props
|
|
19
|
-
}) => {
|
|
15
|
+
const HeatmapLayer = props => {
|
|
20
16
|
const {
|
|
21
17
|
baseProps,
|
|
22
18
|
setNativeLayer
|
|
23
|
-
} = (0, _useAbstractLayer.useAbstractLayer)(
|
|
24
|
-
...props,
|
|
25
|
-
sourceID
|
|
26
|
-
});
|
|
19
|
+
} = (0, _useAbstractLayer.useAbstractLayer)(props);
|
|
27
20
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MLRNHeatmapLayer, {
|
|
28
21
|
ref: setNativeLayer,
|
|
29
22
|
...baseProps
|