@rnmapbox/maps 10.2.7 → 10.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +9 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +8 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +180 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +4 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +2 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXOfflineModuleLegacy.kt +10 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/layers/generated/RasterParticleLayer.kt +58 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/sources/generated/RasterArraySource.kt +20 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +22 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +16 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +45 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +38 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +85 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +41 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +76 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerDelegate.java +54 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerInterface.java +23 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerDelegate.java +66 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerInterface.java +27 -0
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +2 -0
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.swift +5 -0
- package/ios/RNMBX/RNMBXCamera.swift +88 -17
- package/ios/RNMBX/RNMBXCameraModule.h +3 -2
- package/ios/RNMBX/RNMBXCameraModule.mm +8 -16
- package/ios/RNMBX/RNMBXCustomLocationProvider.swift +18 -24
- package/ios/RNMBX/RNMBXImageModule.h +3 -2
- package/ios/RNMBX/RNMBXImageModule.mm +8 -16
- package/ios/RNMBX/RNMBXImages.swift +1 -4
- package/ios/RNMBX/RNMBXInteractiveElement.swift +22 -15
- package/ios/RNMBX/RNMBXMapView.swift +68 -6
- package/ios/RNMBX/RNMBXNativeUserLocation.swift +6 -6
- package/ios/RNMBX/RNMBXPointAnnotation.swift +6 -8
- package/ios/RNMBX/RNMBXPointAnnotationModule.h +3 -2
- package/ios/RNMBX/RNMBXPointAnnotationModule.mm +8 -16
- package/ios/RNMBX/RNMBXRasterArraySource.swift +47 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.mm +168 -0
- package/ios/RNMBX/RNMBXRasterArraySourceViewManager.swift +16 -0
- package/ios/RNMBX/RNMBXRasterParticleLayer.swift +100 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.mm +121 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerViewManager.swift +17 -0
- package/ios/RNMBX/RNMBXShapeSource.swift +5 -4
- package/ios/RNMBX/RNMBXShapeSourceModule.h +3 -2
- package/ios/RNMBX/RNMBXShapeSourceModule.mm +8 -16
- package/ios/RNMBX/RNMBXSource.swift +51 -21
- package/ios/RNMBX/RNMBXStyle.swift +152 -27
- package/ios/RNMBX/RNMBXStyleValue.swift +27 -0
- package/ios/RNMBX/RNMBXViewport.swift +13 -13
- package/ios/RNMBX/RNMBXViewportModule.h +3 -2
- package/ios/RNMBX/RNMBXViewportModule.mm +8 -16
- package/lib/commonjs/plugin/build/withMapbox.js +1 -1
- package/lib/commonjs/plugin/src/withMapbox.ts +13 -3
- package/lib/module/Mapbox.native.js +2 -0
- package/lib/module/Mapbox.native.js.map +1 -1
- package/lib/module/RNMBXModule.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterArraySource.js +67 -0
- package/lib/module/components/RasterArraySource.js.map +1 -0
- package/lib/module/components/RasterParticleLayer.js +40 -0
- package/lib/module/components/RasterParticleLayer.js.map +1 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js +14 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js.map +1 -1
- package/lib/module/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/lib/module/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/lib/module/utils/MapboxStyles.js.map +1 -1
- package/lib/module/utils/styleMap.js +9 -0
- package/lib/module/utils/styleMap.js.map +1 -1
- package/lib/typescript/plugin/src/withMapbox.d.ts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts.map +1 -1
- package/lib/typescript/src/Mapbox.native.d.ts +3 -1
- package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/src/components/RasterArraySource.d.ts +72 -0
- package/lib/typescript/src/components/RasterArraySource.d.ts.map +1 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts +80 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts.map +1 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts +11 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts +16 -0
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts +25 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/utils/MapboxStyles.d.ts +44 -2
- package/lib/typescript/src/utils/MapboxStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/styleMap.d.ts.map +1 -1
- package/package.json +13 -1
- package/plugin/build/withMapbox.js +1 -1
- package/plugin/src/withMapbox.ts +13 -3
- package/rnmapbox-maps.podspec +1 -1
- package/src/Mapbox.native.ts +3 -0
- package/src/RNMBXModule.ts +1 -4
- package/src/components/PointAnnotation.tsx +2 -2
- package/src/components/RasterArraySource.tsx +134 -0
- package/src/components/RasterParticleLayer.tsx +117 -0
- package/src/modules/offline/offlineManagerLegacy.ts +14 -0
- package/src/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/src/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/src/utils/MapboxStyles.ts +47 -1
- package/src/utils/styleMap.ts +10 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
package com.rnmapbox.rnmbx.components.styles.layers
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Dynamic
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
6
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
import com.facebook.react.viewmanagers.RNMBXRasterParticleLayerManagerInterface
|
|
8
|
+
|
|
9
|
+
class RNMBXRasterParticleLayerManager : ViewGroupManager<RNMBXRasterParticleLayer>(),
|
|
10
|
+
RNMBXRasterParticleLayerManagerInterface<RNMBXRasterParticleLayer> {
|
|
11
|
+
override fun getName(): String {
|
|
12
|
+
return REACT_CLASS
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun createViewInstance(reactContext: ThemedReactContext): RNMBXRasterParticleLayer {
|
|
16
|
+
return RNMBXRasterParticleLayer(reactContext)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// @{codepart-replace-start(LayerManagerCommonProps.codepart-kt.ejs,{layerType:"RNMBXRasterParticleLayer"})}
|
|
20
|
+
@ReactProp(name = "id")
|
|
21
|
+
override fun setId(layer: RNMBXRasterParticleLayer, id: Dynamic) {
|
|
22
|
+
layer.iD = id.asString()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@ReactProp(name = "existing")
|
|
26
|
+
override fun setExisting(layer: RNMBXRasterParticleLayer, existing: Dynamic) {
|
|
27
|
+
layer.setExisting(existing.asBoolean())
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ReactProp(name = "sourceID")
|
|
31
|
+
override fun setSourceID(layer: RNMBXRasterParticleLayer, sourceID: Dynamic) {
|
|
32
|
+
layer.setSourceID(sourceID.asString())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactProp(name = "aboveLayerID")
|
|
36
|
+
override fun setAboveLayerID(layer: RNMBXRasterParticleLayer, aboveLayerID: Dynamic) {
|
|
37
|
+
layer.setAboveLayerID(aboveLayerID.asString())
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@ReactProp(name = "belowLayerID")
|
|
41
|
+
override fun setBelowLayerID(layer: RNMBXRasterParticleLayer, belowLayerID: Dynamic) {
|
|
42
|
+
layer.setBelowLayerID(belowLayerID.asString())
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@ReactProp(name = "layerIndex")
|
|
46
|
+
override fun setLayerIndex(layer: RNMBXRasterParticleLayer, layerIndex: Dynamic) {
|
|
47
|
+
layer.setLayerIndex(layerIndex.asInt())
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactProp(name = "minZoomLevel")
|
|
51
|
+
override fun setMinZoomLevel(layer: RNMBXRasterParticleLayer, minZoomLevel: Dynamic) {
|
|
52
|
+
layer.setMinZoomLevel(minZoomLevel.asDouble())
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@ReactProp(name = "maxZoomLevel")
|
|
56
|
+
override fun setMaxZoomLevel(layer: RNMBXRasterParticleLayer, maxZoomLevel: Dynamic) {
|
|
57
|
+
layer.setMaxZoomLevel(maxZoomLevel.asDouble())
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@ReactProp(name = "reactStyle")
|
|
61
|
+
override fun setReactStyle(layer: RNMBXRasterParticleLayer, style: Dynamic) {
|
|
62
|
+
layer.setReactStyle(style.asMap())
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@ReactProp(name = "sourceLayerID")
|
|
66
|
+
override fun setSourceLayerID(layer: RNMBXRasterParticleLayer, sourceLayerID: Dynamic) {
|
|
67
|
+
layer.setSourceLayerID(sourceLayerID.asString())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@ReactProp(name = "filter")
|
|
71
|
+
override fun setFilter(layer: RNMBXRasterParticleLayer, filterList: Dynamic) {
|
|
72
|
+
layer.setFilter(filterList.asArray())
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@ReactProp(name = "slot")
|
|
76
|
+
override fun setSlot(layer: RNMBXRasterParticleLayer, slot: Dynamic) {
|
|
77
|
+
layer.setSlot(slot.asString())
|
|
78
|
+
}
|
|
79
|
+
// @{codepart-replace-end}
|
|
80
|
+
|
|
81
|
+
companion object {
|
|
82
|
+
const val REACT_CLASS = "RNMBXRasterParticleLayer"
|
|
83
|
+
const val isImplemented = true
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package com.rnmapbox.rnmbx.components.styles.sources
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.mapbox.maps.extension.style.sources.generated.RasterArraySource
|
|
5
|
+
|
|
6
|
+
class RNMBXRasterArraySource(context: Context?) : RNMBXTileSource<RasterArraySource?>(context) {
|
|
7
|
+
private var mTileSize: Int? = null
|
|
8
|
+
override fun makeSource(): RasterArraySource {
|
|
9
|
+
val id = iD!!
|
|
10
|
+
val configurationUrl = uRL
|
|
11
|
+
val tileSize = if (mTileSize == null) DEFAULT_TILE_SIZE else mTileSize!!
|
|
12
|
+
return if (configurationUrl != null) {
|
|
13
|
+
RasterArraySource.Builder(id).url(configurationUrl).tileSize(tileSize.toLong()).build()
|
|
14
|
+
} else RasterArraySource.Builder(id).tileSet(buildTileset())
|
|
15
|
+
.tileSize(tileSize.toLong()).build()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fun setTileSize(tileSize: Int) {
|
|
19
|
+
mTileSize = tileSize
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override fun hasPressListener(): Boolean {
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override fun onPress(feature: OnPressEvent?) {
|
|
27
|
+
// ignore, cannot query raster array layers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun hasNoDataSoRefersToExisting(): Boolean {
|
|
31
|
+
return uRL == null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
companion object {
|
|
35
|
+
const val DEFAULT_TILE_SIZE = 512
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fun setSourceBounds(value: Array<Double>) {
|
|
39
|
+
bounds = value
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package com.rnmapbox.rnmbx.components.styles.sources
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Dynamic
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
import com.facebook.react.viewmanagers.RNMBXRasterArraySourceManagerInterface
|
|
8
|
+
import com.rnmapbox.rnmbx.events.constants.EventKeys
|
|
9
|
+
import com.rnmapbox.rnmbx.events.constants.eventMapOf
|
|
10
|
+
import javax.annotation.Nonnull
|
|
11
|
+
import com.facebook.react.bridge.ReadableType
|
|
12
|
+
import com.rnmapbox.rnmbx.utils.Logger
|
|
13
|
+
|
|
14
|
+
class RNMBXRasterArraySourceManager(reactApplicationContext: ReactApplicationContext) :
|
|
15
|
+
RNMBXTileSourceManager<RNMBXRasterArraySource>(reactApplicationContext),
|
|
16
|
+
RNMBXRasterArraySourceManagerInterface<RNMBXRasterArraySource> {
|
|
17
|
+
@Nonnull
|
|
18
|
+
override fun getName(): String {
|
|
19
|
+
return REACT_CLASS
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Nonnull
|
|
23
|
+
override fun createViewInstance(@Nonnull reactContext: ThemedReactContext): RNMBXRasterArraySource {
|
|
24
|
+
return RNMBXRasterArraySource(reactContext)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@ReactProp(name = "tileSize")
|
|
28
|
+
override fun setTileSize(source: RNMBXRasterArraySource, tileSize: Dynamic) {
|
|
29
|
+
source.setTileSize(tileSize.asInt())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override fun customEvents(): Map<String, String>? {
|
|
33
|
+
return eventMapOf(
|
|
34
|
+
EventKeys.MAP_ANDROID_CALLBACK to "onAndroidCallback"
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
const val REACT_CLASS = "RNMBXRasterArraySource"
|
|
40
|
+
const val isImplemented = true
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@ReactProp(name = "existing")
|
|
44
|
+
override fun setExisting(source: RNMBXRasterArraySource, value: Dynamic) {
|
|
45
|
+
source.mExisting = value.asBoolean()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@ReactProp(name = "sourceBounds")
|
|
49
|
+
override fun setSourceBounds(source: RNMBXRasterArraySource, value: Dynamic) {
|
|
50
|
+
val array = value.asArray()
|
|
51
|
+
if (value.type != ReadableType.Array || array == null || array.size() != 4) {
|
|
52
|
+
Logger.e(REACT_CLASS, "source bounds must be an array with left, bottom, top, and right values")
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
val bboxArray = Array(4) { i -> array.getDouble(i) }
|
|
56
|
+
|
|
57
|
+
if(!this.validateBbox(bboxArray)){
|
|
58
|
+
Logger.e(REACT_CLASS, "source bounds contain invalid bbox")
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
source.setSourceBounds(bboxArray)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun validateBbox(bbox: Array<Double>): Boolean {
|
|
66
|
+
if (bbox.size != 4) return false
|
|
67
|
+
|
|
68
|
+
val (swLng, swLat, neLng, neLat) = bbox
|
|
69
|
+
|
|
70
|
+
val isLngValid = swLng in -180.0..180.0 && neLng in -180.0..180.0
|
|
71
|
+
val isLatValid = swLat in -90.0..90.0 && neLat in -90.0..90.0
|
|
72
|
+
val isSouthWestOfNorthEast = swLng < neLng && swLat < neLat
|
|
73
|
+
|
|
74
|
+
return isLngValid && isLatValid && isSouthWestOfNorthEast
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.DynamicFromObject;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
+
|
|
19
|
+
public class RNMBXRasterArraySourceManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNMBXRasterArraySourceManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
20
|
+
public RNMBXRasterArraySourceManagerDelegate(U viewManager) {
|
|
21
|
+
super(viewManager);
|
|
22
|
+
}
|
|
23
|
+
@Override
|
|
24
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
25
|
+
switch (propName) {
|
|
26
|
+
case "id":
|
|
27
|
+
mViewManager.setId(view, new DynamicFromObject(value));
|
|
28
|
+
break;
|
|
29
|
+
case "existing":
|
|
30
|
+
mViewManager.setExisting(view, new DynamicFromObject(value));
|
|
31
|
+
break;
|
|
32
|
+
case "url":
|
|
33
|
+
mViewManager.setUrl(view, new DynamicFromObject(value));
|
|
34
|
+
break;
|
|
35
|
+
case "tileUrlTemplates":
|
|
36
|
+
mViewManager.setTileUrlTemplates(view, new DynamicFromObject(value));
|
|
37
|
+
break;
|
|
38
|
+
case "minZoomLevel":
|
|
39
|
+
mViewManager.setMinZoomLevel(view, new DynamicFromObject(value));
|
|
40
|
+
break;
|
|
41
|
+
case "maxZoomLevel":
|
|
42
|
+
mViewManager.setMaxZoomLevel(view, new DynamicFromObject(value));
|
|
43
|
+
break;
|
|
44
|
+
case "tileSize":
|
|
45
|
+
mViewManager.setTileSize(view, new DynamicFromObject(value));
|
|
46
|
+
break;
|
|
47
|
+
case "sourceBounds":
|
|
48
|
+
mViewManager.setSourceBounds(view, new DynamicFromObject(value));
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
super.setProperty(view, propName, value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import com.facebook.react.bridge.Dynamic;
|
|
14
|
+
public interface RNMBXRasterArraySourceManagerInterface<T extends View> {
|
|
15
|
+
void setId(T view, Dynamic value);
|
|
16
|
+
void setExisting(T view, Dynamic value);
|
|
17
|
+
void setUrl(T view, Dynamic value);
|
|
18
|
+
void setTileUrlTemplates(T view, Dynamic value);
|
|
19
|
+
void setMinZoomLevel(T view, Dynamic value);
|
|
20
|
+
void setMaxZoomLevel(T view, Dynamic value);
|
|
21
|
+
void setTileSize(T view, Dynamic value);
|
|
22
|
+
void setSourceBounds(T view, Dynamic value);
|
|
23
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.DynamicFromObject;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
+
|
|
19
|
+
public class RNMBXRasterParticleLayerManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNMBXRasterParticleLayerManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
20
|
+
public RNMBXRasterParticleLayerManagerDelegate(U viewManager) {
|
|
21
|
+
super(viewManager);
|
|
22
|
+
}
|
|
23
|
+
@Override
|
|
24
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
25
|
+
switch (propName) {
|
|
26
|
+
case "sourceID":
|
|
27
|
+
mViewManager.setSourceID(view, new DynamicFromObject(value));
|
|
28
|
+
break;
|
|
29
|
+
case "existing":
|
|
30
|
+
mViewManager.setExisting(view, new DynamicFromObject(value));
|
|
31
|
+
break;
|
|
32
|
+
case "filter":
|
|
33
|
+
mViewManager.setFilter(view, new DynamicFromObject(value));
|
|
34
|
+
break;
|
|
35
|
+
case "aboveLayerID":
|
|
36
|
+
mViewManager.setAboveLayerID(view, new DynamicFromObject(value));
|
|
37
|
+
break;
|
|
38
|
+
case "belowLayerID":
|
|
39
|
+
mViewManager.setBelowLayerID(view, new DynamicFromObject(value));
|
|
40
|
+
break;
|
|
41
|
+
case "layerIndex":
|
|
42
|
+
mViewManager.setLayerIndex(view, new DynamicFromObject(value));
|
|
43
|
+
break;
|
|
44
|
+
case "maxZoomLevel":
|
|
45
|
+
mViewManager.setMaxZoomLevel(view, new DynamicFromObject(value));
|
|
46
|
+
break;
|
|
47
|
+
case "minZoomLevel":
|
|
48
|
+
mViewManager.setMinZoomLevel(view, new DynamicFromObject(value));
|
|
49
|
+
break;
|
|
50
|
+
case "sourceLayerID":
|
|
51
|
+
mViewManager.setSourceLayerID(view, new DynamicFromObject(value));
|
|
52
|
+
break;
|
|
53
|
+
case "slot":
|
|
54
|
+
mViewManager.setSlot(view, new DynamicFromObject(value));
|
|
55
|
+
break;
|
|
56
|
+
case "id":
|
|
57
|
+
mViewManager.setId(view, new DynamicFromObject(value));
|
|
58
|
+
break;
|
|
59
|
+
case "reactStyle":
|
|
60
|
+
mViewManager.setReactStyle(view, new DynamicFromObject(value));
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
super.setProperty(view, propName, value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import com.facebook.react.bridge.Dynamic;
|
|
14
|
+
public interface RNMBXRasterParticleLayerManagerInterface<T extends View> {
|
|
15
|
+
void setSourceID(T view, Dynamic value);
|
|
16
|
+
void setExisting(T view, Dynamic value);
|
|
17
|
+
void setFilter(T view, Dynamic value);
|
|
18
|
+
void setAboveLayerID(T view, Dynamic value);
|
|
19
|
+
void setBelowLayerID(T view, Dynamic value);
|
|
20
|
+
void setLayerIndex(T view, Dynamic value);
|
|
21
|
+
void setMaxZoomLevel(T view, Dynamic value);
|
|
22
|
+
void setMinZoomLevel(T view, Dynamic value);
|
|
23
|
+
void setSourceLayerID(T view, Dynamic value);
|
|
24
|
+
void setSlot(T view, Dynamic value);
|
|
25
|
+
void setId(T view, Dynamic value);
|
|
26
|
+
void setReactStyle(T view, Dynamic value);
|
|
27
|
+
}
|
|
@@ -14,6 +14,8 @@ RCT_EXTERN_METHOD(pausePackDownload:(NSString *)name
|
|
|
14
14
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
15
15
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
16
16
|
|
|
17
|
+
RCT_EXTERN_METHOD(setTileCountLimit:(nonnull NSNumber *)limit)
|
|
18
|
+
|
|
17
19
|
RCT_EXTERN_METHOD(getPackStatus:(NSString *)name
|
|
18
20
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
19
21
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
@@ -363,6 +363,11 @@ func getRegionByName(name: String, offlineRegions: [OfflineRegion]) -> OfflineRe
|
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
@objc
|
|
367
|
+
func setTileCountLimit(_ limit: NSNumber) {
|
|
368
|
+
self.offlineRegionManager.setOfflineMapboxTileCountLimitForLimit(limit.uint64Value)
|
|
369
|
+
}
|
|
370
|
+
|
|
366
371
|
@objc
|
|
367
372
|
func resetDatabase(_ resolver: @escaping RCTPromiseResolveBlock,
|
|
368
373
|
rejecter: @escaping RCTPromiseRejectBlock)
|
|
@@ -15,11 +15,46 @@ public enum RemovalReason {
|
|
|
15
15
|
case ViewRemoval, StyleChange, OnDestroy, ComponentChange, Reorder
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
/// Base protocol for all map components
|
|
19
|
+
public protocol RNMBXMapComponentProtocol: AnyObject {
|
|
20
|
+
func waitForStyleLoad() -> Bool
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// Default implementation: most components don't need to wait for style load
|
|
24
|
+
extension RNMBXMapComponentProtocol {
|
|
25
|
+
public func waitForStyleLoad() -> Bool {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Protocol for components that can work without direct MapView access
|
|
31
|
+
public protocol RNMBXMapComponent: RNMBXMapComponentProtocol {
|
|
19
32
|
func addToMap(_ map: RNMBXMapView, style: Style)
|
|
20
33
|
func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// Protocol for components that require a valid MapView instance for both add and remove operations.
|
|
37
|
+
/// Use this protocol when your component needs to interact with the native MapView directly.
|
|
38
|
+
/// The MapView parameter is guaranteed to be non-nil when these methods are called.
|
|
39
|
+
///
|
|
40
|
+
/// This protocol inherits from RNMBXMapComponent to ensure compatibility with existing code,
|
|
41
|
+
/// but provides default implementations of the base protocol methods that throw errors,
|
|
42
|
+
/// forcing implementers to use the mapView-aware versions.
|
|
43
|
+
public protocol RNMBXMapAndMapViewComponent: RNMBXMapComponent {
|
|
44
|
+
func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style)
|
|
45
|
+
func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// Default implementations for RNMBXMapAndMapViewComponent that prevent accidental use of base protocol methods
|
|
49
|
+
extension RNMBXMapAndMapViewComponent {
|
|
50
|
+
public func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
51
|
+
Logger.error("CRITICAL: addToMap(_:style:) called on RNMBXMapAndMapViewComponent. Use addToMap(_:mapView:style:) instead. Component: \(type(of: self))")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
55
|
+
Logger.error("CRITICAL: removeFromMap(_:reason:) called on RNMBXMapAndMapViewComponent. Use removeFromMap(_:mapView:reason:) instead. Component: \(type(of: self))")
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
23
58
|
}
|
|
24
59
|
|
|
25
60
|
enum CameraMode: Int {
|
|
@@ -85,7 +120,7 @@ class CameraUpdateQueue {
|
|
|
85
120
|
open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
|
|
86
121
|
private weak var _map: RNMBXMapView! = nil
|
|
87
122
|
private var _mapCallbacks: [(RNMBXMapView) -> Void] = []
|
|
88
|
-
|
|
123
|
+
|
|
89
124
|
weak var map : RNMBXMapView? {
|
|
90
125
|
return _map;
|
|
91
126
|
}
|
|
@@ -103,11 +138,7 @@ open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
|
|
|
103
138
|
_mapCallbacks.append(callback)
|
|
104
139
|
}
|
|
105
140
|
}
|
|
106
|
-
|
|
107
|
-
public func waitForStyleLoad() -> Bool {
|
|
108
|
-
return false
|
|
109
|
-
}
|
|
110
|
-
|
|
141
|
+
|
|
111
142
|
public func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
112
143
|
_mapCallbacks.forEach { callback in
|
|
113
144
|
callback(map)
|
|
@@ -115,7 +146,7 @@ open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
|
|
|
115
146
|
_mapCallbacks = []
|
|
116
147
|
_map = map
|
|
117
148
|
}
|
|
118
|
-
|
|
149
|
+
|
|
119
150
|
public func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
120
151
|
_mapCallbacks = []
|
|
121
152
|
_map = nil
|
|
@@ -123,8 +154,48 @@ open class RNMBXMapComponentBase : UIView, RNMBXMapComponent {
|
|
|
123
154
|
}
|
|
124
155
|
}
|
|
125
156
|
|
|
157
|
+
/// Base class for components that require MapView to be non-nil
|
|
158
|
+
open class RNMBXMapAndMapViewComponentBase : UIView, RNMBXMapAndMapViewComponent {
|
|
159
|
+
private weak var _map: RNMBXMapView! = nil
|
|
160
|
+
private var _mapCallbacks: [(RNMBXMapView) -> Void] = []
|
|
161
|
+
|
|
162
|
+
weak var map : RNMBXMapView? {
|
|
163
|
+
return _map;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
func withMapView(_ callback: @escaping (_ mapView: MapView) -> Void) {
|
|
167
|
+
withRNMBXMapView { mapView in
|
|
168
|
+
callback(mapView.mapView)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
func withRNMBXMapView(_ callback: @escaping (_ map: RNMBXMapView) -> Void) {
|
|
173
|
+
if let map = _map {
|
|
174
|
+
callback(map)
|
|
175
|
+
} else {
|
|
176
|
+
_mapCallbacks.append(callback)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Uses default implementation from RNMBXMapComponentProtocol extension
|
|
181
|
+
|
|
182
|
+
public func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
183
|
+
_mapCallbacks.forEach { callback in
|
|
184
|
+
callback(map)
|
|
185
|
+
}
|
|
186
|
+
_mapCallbacks = []
|
|
187
|
+
_map = map
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
public func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
191
|
+
_mapCallbacks = []
|
|
192
|
+
_map = nil
|
|
193
|
+
return true
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
126
197
|
@objc(RNMBXCamera)
|
|
127
|
-
open class RNMBXCamera :
|
|
198
|
+
open class RNMBXCamera : RNMBXMapAndMapViewComponentBase {
|
|
128
199
|
var cameraAnimator: BasicCameraAnimator?
|
|
129
200
|
let cameraUpdateQueue = CameraUpdateQueue()
|
|
130
201
|
|
|
@@ -519,18 +590,18 @@ open class RNMBXCamera : RNMBXMapComponentBase {
|
|
|
519
590
|
_updateCamera()
|
|
520
591
|
}
|
|
521
592
|
|
|
522
|
-
public override func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
523
|
-
super.addToMap(map, style: style)
|
|
593
|
+
public override func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
594
|
+
super.addToMap(map, mapView: mapView, style: style)
|
|
524
595
|
map.reactCamera = self
|
|
525
596
|
}
|
|
526
|
-
|
|
527
|
-
public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
597
|
+
|
|
598
|
+
public override func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
528
599
|
if (reason == .StyleChange) {
|
|
529
600
|
return false
|
|
530
601
|
}
|
|
531
602
|
|
|
532
|
-
|
|
533
|
-
return super.removeFromMap(map, reason:reason)
|
|
603
|
+
mapView.viewport.removeStatusObserver(self)
|
|
604
|
+
return super.removeFromMap(map, mapView: mapView, reason: reason)
|
|
534
605
|
}
|
|
535
606
|
|
|
536
607
|
@objc public func moveBy(x: Double, y: Double, animationMode: NSNumber?, animationDuration: NSNumber?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
+
#import "RNMBXViewResolver.h"
|
|
3
4
|
|
|
4
5
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
6
|
#import "rnmapbox_maps_specs.h"
|
|
@@ -9,9 +10,9 @@
|
|
|
9
10
|
|
|
10
11
|
@interface RNMBXCameraModule : NSObject
|
|
11
12
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
-
<NativeRNMBXCameraModuleSpec>
|
|
13
|
+
<NativeRNMBXCameraModuleSpec, RNMBXViewResolverDelegate>
|
|
13
14
|
#else
|
|
14
|
-
<RCTBridgeModule>
|
|
15
|
+
<RCTBridgeModule, RNMBXViewResolverDelegate>
|
|
15
16
|
#endif
|
|
16
17
|
|
|
17
18
|
@end
|
|
@@ -36,22 +36,14 @@ RCT_EXPORT_MODULE();
|
|
|
36
36
|
|
|
37
37
|
- (void)withCamera:(nonnull NSNumber*)viewRef block:(void (^)(RNMBXCamera *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
RNMBXCamera *view = [uiManager viewForReactTag:viewRef];
|
|
48
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
49
|
-
if (view != nil) {
|
|
50
|
-
block(view);
|
|
51
|
-
} else {
|
|
52
|
-
reject(methodName, [NSString stringWithFormat:@"Unknown reactTag: %@", viewRef], nil);
|
|
53
|
-
}
|
|
54
|
-
}];
|
|
39
|
+
[RNMBXViewResolver withViewRef:viewRef
|
|
40
|
+
delegate:self
|
|
41
|
+
expectedClass:[RNMBXCamera class]
|
|
42
|
+
block:^(UIView *view) {
|
|
43
|
+
block((RNMBXCamera *)view);
|
|
44
|
+
}
|
|
45
|
+
reject:reject
|
|
46
|
+
methodName:methodName];
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
RCT_EXPORT_METHOD(updateCameraStop:(nonnull NSNumber *)viewRef
|