@rnmapbox/maps 10.1.39 → 10.1.41-rc.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.
- package/android/build.gradle +14 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerView.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +11 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraManager.kt +25 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraModule.kt +65 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXViewport.kt +4 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt +30 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXCustomLocationProviderManager.kt +4 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocation.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +8 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +59 -10
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleImportManager.kt +6 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +9 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt +5 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt +1 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +19 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt +8 -3
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXVectorSourceManager.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXLocationModule.kt +7 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt +27 -3
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/Annotation.kt +5 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXCameraModuleSpec.java +8 -0
- package/ios/RNMBX/RNMBXCamera.swift +64 -3
- package/ios/RNMBX/RNMBXCameraModule.mm +26 -1
- package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +11 -16
- package/ios/RNMBX/RNMBXShapeSource.swift +2 -4
- package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +1 -1
- package/ios/RNMBX/RNMBXShapeSourceViewManager.m +1 -1
- package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +1 -1
- package/ios/install.md +1 -1
- package/lib/commonjs/components/Camera.js +29 -1
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/NativeBridgeComponent.js +41 -0
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -0
- package/lib/commonjs/modules/location/locationManager.js +3 -1
- package/lib/commonjs/modules/location/locationManager.js.map +1 -1
- package/lib/commonjs/plugin/build/generateCode.js +5 -6
- package/lib/commonjs/plugin/install.md +2 -2
- package/lib/commonjs/specs/NativeMapViewModule.js +10 -0
- package/lib/commonjs/specs/NativeMapViewModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXCameraModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXCameraModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXImageModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXImageModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXLocationModule.js +9 -0
- package/lib/commonjs/specs/NativeRNMBXLocationModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js +11 -0
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXViewportModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXViewportModule.js.map +1 -0
- package/lib/commonjs/utils/NativeCommands.js +50 -0
- package/lib/commonjs/utils/NativeCommands.js.map +1 -0
- package/lib/{module/utils/nativeRef.ts → commonjs/utils/nativeRef.js} +8 -9
- package/lib/commonjs/utils/nativeRef.js.map +1 -0
- package/lib/module/components/Camera.js +29 -1
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/NativeBridgeComponent.js +37 -0
- package/lib/module/components/NativeBridgeComponent.js.map +1 -0
- package/lib/module/modules/location/locationManager.js +3 -1
- package/lib/module/modules/location/locationManager.js.map +1 -1
- package/lib/module/specs/NativeMapViewModule.js +7 -0
- package/lib/module/specs/NativeMapViewModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXCameraModule.js +8 -0
- package/lib/module/specs/NativeRNMBXCameraModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +8 -0
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXImageModule.js +7 -0
- package/lib/module/specs/NativeRNMBXImageModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXLocationModule.js +5 -0
- package/lib/module/specs/NativeRNMBXLocationModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js +8 -0
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.js +7 -0
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXShapeSourceModule.js +7 -0
- package/lib/module/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXTileStoreModule.js +10 -0
- package/lib/module/specs/NativeRNMBXTileStoreModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXViewportModule.js +8 -0
- package/lib/module/specs/NativeRNMBXViewportModule.js.map +1 -0
- package/lib/module/utils/NativeCommands.js +45 -0
- package/lib/module/utils/NativeCommands.js.map +1 -0
- package/lib/{commonjs/utils/nativeRef.ts → module/utils/nativeRef.js} +4 -9
- package/lib/module/utils/nativeRef.js.map +1 -0
- package/lib/typescript/src/Mapbox.d.ts +0 -1
- package/lib/typescript/src/Mapbox.d.ts.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/AbstractLayer.d.ts.map +1 -1
- package/lib/typescript/src/components/Camera.d.ts +20 -0
- package/lib/typescript/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/src/components/MapView.d.ts +4 -3
- package/lib/typescript/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/components/NativeBridgeComponent.d.ts +4 -4
- package/lib/typescript/src/components/NativeBridgeComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts +4 -3
- package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/src/components/ShapeSource.d.ts +4 -3
- package/lib/typescript/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/src/components/Style.d.ts.map +1 -1
- package/lib/typescript/src/modules/location/locationManager.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeMapViewModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeMapViewModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts +3 -3
- package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXAtmosphereNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCalloutNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImageSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXLightNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXModelsNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXNativeUserLocationNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXStyleImportNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXTerrainNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/codegenUtils.d.ts +1 -2
- package/lib/typescript/src/specs/codegenUtils.d.ts.map +1 -1
- package/lib/typescript/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/src/utils/NativeCommands.d.ts +0 -1
- package/lib/typescript/src/utils/NativeCommands.d.ts.map +1 -1
- package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts +1 -1
- package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts.map +1 -1
- package/lib/typescript/src/web/MapContext.d.ts +1 -1
- package/lib/typescript/src/web/MapContext.d.ts.map +1 -1
- package/lib/typescript/src/web/components/Camera.d.ts +2 -2
- package/lib/typescript/src/web/components/Camera.d.ts.map +1 -1
- package/package.json +5 -5
- package/plugin/build/generateCode.js +5 -6
- package/plugin/install.md +2 -2
- package/rnmapbox-maps.podspec +1 -1
- package/src/components/Camera.tsx +83 -1
- package/src/modules/location/locationManager.ts +3 -1
- package/src/specs/NativeRNMBXCameraModule.ts +16 -3
- package/src/specs/codegenUtils.ts +1 -1
- package/src/web/components/Camera.tsx +1 -1
- package/CHANGELOG.md +0 -390
- package/android/.gitignore +0 -9
- package/android/.npmignore +0 -9
- package/lib/commonjs/components/NativeBridgeComponent.tsx +0 -67
- package/lib/commonjs/specs/NativeMapViewModule.ts +0 -54
- package/lib/commonjs/specs/NativeRNMBXCameraModule.ts +0 -36
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
- package/lib/commonjs/specs/NativeRNMBXImageModule.ts +0 -10
- package/lib/commonjs/specs/NativeRNMBXLocationModule.ts +0 -32
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.ts +0 -23
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.ts +0 -27
- package/lib/commonjs/specs/NativeRNMBXViewportModule.ts +0 -41
- package/lib/commonjs/utils/NativeCommands.ts +0 -89
- package/lib/module/components/NativeBridgeComponent.tsx +0 -67
- package/lib/module/specs/NativeMapViewModule.ts +0 -54
- package/lib/module/specs/NativeRNMBXCameraModule.ts +0 -36
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
- package/lib/module/specs/NativeRNMBXImageModule.ts +0 -10
- package/lib/module/specs/NativeRNMBXLocationModule.ts +0 -32
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
- package/lib/module/specs/NativeRNMBXShapeSourceModule.ts +0 -23
- package/lib/module/specs/NativeRNMBXTileStoreModule.ts +0 -27
- package/lib/module/specs/NativeRNMBXViewportModule.ts +0 -41
- package/lib/module/utils/NativeCommands.ts +0 -89
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
def defaultMapboxMapsImpl = "mapbox"
|
|
2
|
-
def defaultMapboxMapsVersion = "10.
|
|
2
|
+
def defaultMapboxMapsVersion = "10.19.0"
|
|
3
3
|
|
|
4
4
|
def safeExtGet(prop, fallback) {
|
|
5
5
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -167,7 +167,19 @@ dependencies {
|
|
|
167
167
|
// Mapbox SDK
|
|
168
168
|
customizableDependencies('RNMapboxMapsLibs') {
|
|
169
169
|
if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
|
|
170
|
-
|
|
170
|
+
def targetSdk = safeExtGet("targetSdkVersion", 28)
|
|
171
|
+
def mapboxVersion = safeExtGet("RNMapboxMapsVersion", defaultMapboxMapsVersion)
|
|
172
|
+
|
|
173
|
+
// Use NDK27 variant for Android 15+ (API 35+) to support 16KB page size
|
|
174
|
+
// Required by Google Play for apps targeting Android 15+ by November 1, 2025
|
|
175
|
+
// See: https://github.com/rnmapbox/maps/issues/3896
|
|
176
|
+
// Mapbox Docs: https://docs.mapbox.com/android/maps/guides/#ndk-27
|
|
177
|
+
if (targetSdk >= 35) {
|
|
178
|
+
implementation "com.mapbox.maps:android-ndk27:${mapboxVersion}"
|
|
179
|
+
} else {
|
|
180
|
+
implementation "com.mapbox.maps:android:${mapboxVersion}"
|
|
181
|
+
}
|
|
182
|
+
|
|
171
183
|
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:6.11.0'
|
|
172
184
|
implementation 'androidx.asynclayoutinflater:asynclayoutinflater:1.0.0'
|
|
173
185
|
} else {
|
|
@@ -186,7 +186,7 @@ class RNMBXMarkerView(context: Context?, private val mManager: RNMBXMarkerViewMa
|
|
|
186
186
|
allowOverlapWithPuck(mAllowOverlapWithPuck)
|
|
187
187
|
offsets(offset.dx, offset.dy)
|
|
188
188
|
selected(mIsSelected)
|
|
189
|
-
|
|
189
|
+
ignoreCameraPadding(true)
|
|
190
190
|
}
|
|
191
191
|
return options
|
|
192
192
|
}
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt
CHANGED
|
@@ -18,6 +18,7 @@ import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
|
|
|
18
18
|
import com.rnmapbox.rnmbx.v11compat.annotation.*
|
|
19
19
|
import com.rnmapbox.rnmbx.utils.LatLng
|
|
20
20
|
import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toGNPointGeometry
|
|
21
|
+
import com.rnmapbox.rnmbx.utils.Logger
|
|
21
22
|
|
|
22
23
|
class RNMBXMarkerViewManager(reactApplicationContext: ReactApplicationContext) :
|
|
23
24
|
AbstractEventEmitter<RNMBXMarkerView>(reactApplicationContext),
|
|
@@ -39,12 +40,21 @@ class RNMBXMarkerViewManager(reactApplicationContext: ReactApplicationContext) :
|
|
|
39
40
|
@ReactProp(name = "coordinate")
|
|
40
41
|
override fun setCoordinate(markerView: RNMBXMarkerView, value: Dynamic) {
|
|
41
42
|
val array = value.asArray()
|
|
43
|
+
if (array == null) {
|
|
44
|
+
Logger.e("RNMBXMarkerViewManager", "array in setCoordinate is null")
|
|
45
|
+
return
|
|
46
|
+
}
|
|
42
47
|
markerView.setCoordinate(toGNPointGeometry(LatLng(array.getDouble(1), array.getDouble(0))))
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
@ReactProp(name = "anchor")
|
|
46
51
|
override fun setAnchor(markerView: RNMBXMarkerView, map: Dynamic) {
|
|
47
|
-
|
|
52
|
+
val mapValue = map.asMap()
|
|
53
|
+
if (mapValue == null) {
|
|
54
|
+
Logger.e("RNMBXMarkerViewManager", "map in setAnchor is null")
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
markerView.setAnchor(mapValue.getDouble("x").toFloat(), mapValue.getDouble("y").toFloat())
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
@ReactProp(name = "allowOverlap")
|
|
@@ -14,6 +14,7 @@ import com.rnmapbox.rnmbx.events.constants.EventKeys
|
|
|
14
14
|
import com.rnmapbox.rnmbx.events.constants.eventMapOf
|
|
15
15
|
import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toPointGeometry
|
|
16
16
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
17
|
+
import com.rnmapbox.rnmbx.utils.Logger
|
|
17
18
|
|
|
18
19
|
class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : AbstractEventEmitter<RNMBXPointAnnotation>(reactApplicationContext),
|
|
19
20
|
RNMBXPointAnnotationManagerInterface<RNMBXPointAnnotation> {
|
|
@@ -69,7 +70,12 @@ class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationConte
|
|
|
69
70
|
|
|
70
71
|
@ReactProp(name = "anchor")
|
|
71
72
|
override fun setAnchor(annotation: RNMBXPointAnnotation, map: Dynamic) {
|
|
72
|
-
|
|
73
|
+
val mapValue = map.asMap()
|
|
74
|
+
if (mapValue == null) {
|
|
75
|
+
Logger.e("RNMBXPointAnnotationManager", "anchor map is null")
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
annotation.setAnchor(mapValue.getDouble("x").toFloat(), mapValue.getDouble("y").toFloat())
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
@ReactProp(name = "draggable")
|
|
@@ -14,6 +14,7 @@ import com.rnmapbox.rnmbx.utils.extensions.asBooleanOrNull
|
|
|
14
14
|
import com.rnmapbox.rnmbx.utils.extensions.asDoubleOrNull
|
|
15
15
|
import com.rnmapbox.rnmbx.utils.extensions.asStringOrNull
|
|
16
16
|
import com.rnmapbox.rnmbx.rncompat.dynamic.*
|
|
17
|
+
import com.rnmapbox.rnmbx.utils.Logger
|
|
17
18
|
|
|
18
19
|
class RNMBXCameraManager(private val mContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) :
|
|
19
20
|
AbstractEventEmitter<RNMBXCamera>(
|
|
@@ -34,7 +35,12 @@ class RNMBXCameraManager(private val mContext: ReactApplicationContext, val view
|
|
|
34
35
|
@ReactProp(name = "stop")
|
|
35
36
|
override fun setStop(camera: RNMBXCamera, map: Dynamic) {
|
|
36
37
|
if (!map.isNull) {
|
|
37
|
-
val
|
|
38
|
+
val mapValue = map.asMap()
|
|
39
|
+
if (mapValue == null) {
|
|
40
|
+
Logger.e("RNMBXCameraManager", "stop map is null")
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
val stop = fromReadableMap(mContext, mapValue, null)
|
|
38
44
|
camera.setStop(stop)
|
|
39
45
|
}
|
|
40
46
|
}
|
|
@@ -42,7 +48,12 @@ class RNMBXCameraManager(private val mContext: ReactApplicationContext, val view
|
|
|
42
48
|
@ReactProp(name = "defaultStop")
|
|
43
49
|
override fun setDefaultStop(camera: RNMBXCamera, map: Dynamic) {
|
|
44
50
|
if (!map.isNull) {
|
|
45
|
-
val
|
|
51
|
+
val mapValue = map.asMap()
|
|
52
|
+
if (mapValue == null) {
|
|
53
|
+
Logger.e("RNMBXCameraManager", "defaultStop map is null")
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
val stop = fromReadableMap(mContext, mapValue, null)
|
|
46
57
|
camera.setDefaultStop(stop)
|
|
47
58
|
}
|
|
48
59
|
}
|
|
@@ -95,13 +106,23 @@ class RNMBXCameraManager(private val mContext: ReactApplicationContext, val view
|
|
|
95
106
|
|
|
96
107
|
@ReactProp(name = "followPadding")
|
|
97
108
|
override fun setFollowPadding(camera: RNMBXCamera, value: Dynamic) {
|
|
98
|
-
|
|
109
|
+
val mapValue = value.asMap()
|
|
110
|
+
if (mapValue == null) {
|
|
111
|
+
Logger.e("RNMBXCameraManager", "followPadding map is null")
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
camera.setFollowPadding(mapValue)
|
|
99
115
|
}
|
|
100
116
|
|
|
101
117
|
@ReactProp(name = "maxBounds")
|
|
102
118
|
override fun setMaxBounds(camera: RNMBXCamera, value: Dynamic) {
|
|
103
119
|
if (!value.isNull) {
|
|
104
|
-
val
|
|
120
|
+
val stringValue = value.asString()
|
|
121
|
+
if (stringValue == null) {
|
|
122
|
+
Logger.e("RNMBXCameraManager", "maxBounds string is null")
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
val collection = FeatureCollection.fromJson(stringValue)
|
|
105
126
|
camera.setMaxBounds(toLatLngBounds(collection))
|
|
106
127
|
} else {
|
|
107
128
|
camera.setMaxBounds(null)
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
package com.rnmapbox.rnmbx.components.camera
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import android.view.animation.AccelerateDecelerateInterpolator
|
|
4
|
+
import android.view.animation.LinearInterpolator
|
|
4
5
|
import com.facebook.react.bridge.Promise
|
|
5
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.bridge.ReadableArray
|
|
7
7
|
import com.facebook.react.bridge.ReadableMap
|
|
8
8
|
import com.facebook.react.bridge.WritableMap
|
|
9
9
|
import com.facebook.react.bridge.WritableNativeMap
|
|
10
|
+
import com.mapbox.maps.ScreenCoordinate
|
|
11
|
+
import com.mapbox.maps.plugin.animation.MapAnimationOptions
|
|
12
|
+
import com.mapbox.maps.plugin.animation.easeTo
|
|
13
|
+
import com.mapbox.maps.plugin.animation.moveBy
|
|
14
|
+
import com.mapbox.maps.plugin.animation.scaleBy
|
|
15
|
+
import com.mapbox.maps.toCameraOptions
|
|
10
16
|
import com.rnmapbox.rnmbx.NativeRNMBXCameraModuleSpec
|
|
17
|
+
import com.rnmapbox.rnmbx.components.camera.constants.CameraMode
|
|
11
18
|
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
|
|
12
19
|
import com.rnmapbox.rnmbx.utils.ViewRefTag
|
|
13
20
|
import com.rnmapbox.rnmbx.utils.ViewTagResolver
|
|
@@ -49,4 +56,60 @@ class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: V
|
|
|
49
56
|
promise.resolve(null)
|
|
50
57
|
}
|
|
51
58
|
}
|
|
59
|
+
|
|
60
|
+
private fun getAnimationOptions(
|
|
61
|
+
animationMode: Double,
|
|
62
|
+
animationDuration: Double
|
|
63
|
+
): MapAnimationOptions {
|
|
64
|
+
return MapAnimationOptions.Builder()
|
|
65
|
+
.apply {
|
|
66
|
+
when (animationMode.toInt()) {
|
|
67
|
+
CameraMode.LINEAR -> interpolator(LinearInterpolator())
|
|
68
|
+
CameraMode.EASE -> interpolator(AccelerateDecelerateInterpolator())
|
|
69
|
+
}
|
|
70
|
+
animationDuration.let { duration ->
|
|
71
|
+
duration(duration.toLong())
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.build()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
override fun moveBy(
|
|
78
|
+
viewRef: ViewRefTag?,
|
|
79
|
+
x: Double,
|
|
80
|
+
y: Double,
|
|
81
|
+
animationMode: Double,
|
|
82
|
+
animationDuration: Double,
|
|
83
|
+
promise: Promise
|
|
84
|
+
) {
|
|
85
|
+
withViewportOnUIThread(viewRef, promise) {
|
|
86
|
+
it.mapboxMap?.let { map ->
|
|
87
|
+
val animationOptions = getAnimationOptions(animationMode, animationDuration)
|
|
88
|
+
map.moveBy(ScreenCoordinate(x, y), animationOptions)
|
|
89
|
+
|
|
90
|
+
promise.resolve(null)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
override fun scaleBy(
|
|
96
|
+
viewRef: ViewRefTag?,
|
|
97
|
+
x: Double,
|
|
98
|
+
y: Double,
|
|
99
|
+
animationMode: Double,
|
|
100
|
+
animationDuration: Double,
|
|
101
|
+
scaleFactor: Double,
|
|
102
|
+
promise: Promise
|
|
103
|
+
) {
|
|
104
|
+
withViewportOnUIThread(viewRef, promise) {
|
|
105
|
+
it.mapboxMap?.let { map ->
|
|
106
|
+
val animationOptions =
|
|
107
|
+
getAnimationOptions(animationMode, animationDuration)
|
|
108
|
+
|
|
109
|
+
map.scaleBy(scaleFactor, ScreenCoordinate(x, y), animationOptions)
|
|
110
|
+
|
|
111
|
+
promise.resolve(null)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
52
115
|
}
|
|
@@ -40,14 +40,14 @@ import com.mapbox.maps.plugin.viewport.data.OverviewViewportStateOptions
|
|
|
40
40
|
import com.rnmapbox.rnmbx.events.constants.EventKeys
|
|
41
41
|
|
|
42
42
|
class BaseEvent(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
private val
|
|
43
|
+
surfaceId: Int,
|
|
44
|
+
viewTag: Int,
|
|
45
|
+
private val _eventName: String,
|
|
46
46
|
private val eventData: WritableMap,
|
|
47
47
|
private val canCoalesce: Boolean = false
|
|
48
48
|
): Event<BaseEvent>(surfaceId, viewTag) {
|
|
49
49
|
override fun getEventName(): String {
|
|
50
|
-
return
|
|
50
|
+
return _eventName
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
override fun canCoalesce(): Boolean {
|
|
@@ -72,8 +72,13 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
72
72
|
|
|
73
73
|
@ReactProp(name = "images")
|
|
74
74
|
override fun setImages(images: RNMBXImages, map: Dynamic) {
|
|
75
|
+
val mapValue = map.asMap()
|
|
76
|
+
if (mapValue == null) {
|
|
77
|
+
Logger.e("RNMBXImagesManager", "images map is null")
|
|
78
|
+
return
|
|
79
|
+
}
|
|
75
80
|
val imagesList = mutableListOf<Map.Entry<String, ImageEntry>>()
|
|
76
|
-
|
|
81
|
+
mapValue.forEach { imageName, imageInfo ->
|
|
77
82
|
when (imageInfo) {
|
|
78
83
|
is ReadableMap -> {
|
|
79
84
|
val uri = imageInfo.getString("uri")
|
|
@@ -160,7 +165,11 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
160
165
|
fun toNativeImage(dynamic: Dynamic): NativeImage? {
|
|
161
166
|
when (dynamic.type) {
|
|
162
167
|
ReadableType.String -> {
|
|
163
|
-
val resourceName = dynamic.asString()
|
|
168
|
+
val resourceName = dynamic.asString()
|
|
169
|
+
if (resourceName == null) {
|
|
170
|
+
Logger.e("RNMBXImages", "nativeImages string element is null")
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
164
173
|
val drawable =
|
|
165
174
|
convertDrawableToBitmap(ResourceUtils.getDrawableByName(mContext, resourceName))
|
|
166
175
|
if (drawable != null) {
|
|
@@ -172,6 +181,10 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
172
181
|
}
|
|
173
182
|
ReadableType.Map -> {
|
|
174
183
|
val map = dynamic.asMap()
|
|
184
|
+
if (map == null) {
|
|
185
|
+
Logger.e("RNMBXImages", "nativeImages map element is null")
|
|
186
|
+
return null
|
|
187
|
+
}
|
|
175
188
|
val resourceName = map.getString("name")
|
|
176
189
|
val drawable =
|
|
177
190
|
convertDrawableToBitmap(ResourceUtils.getDrawableByName(mContext, resourceName))
|
|
@@ -191,9 +204,14 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
191
204
|
|
|
192
205
|
@ReactProp(name = "nativeImages")
|
|
193
206
|
override fun setNativeImages(images: RNMBXImages, arr: Dynamic) {
|
|
207
|
+
val arrayValue = arr.asArray()
|
|
208
|
+
if (arrayValue == null) {
|
|
209
|
+
Logger.e("RNMBXImagesManager", "nativeImages array is null")
|
|
210
|
+
return
|
|
211
|
+
}
|
|
194
212
|
val nativeImages = mutableListOf<NativeImage>();
|
|
195
|
-
for (i in 0 until
|
|
196
|
-
val nativeImage = toNativeImage(
|
|
213
|
+
for (i in 0 until arrayValue.size()) {
|
|
214
|
+
val nativeImage = toNativeImage(arrayValue.getDynamic(i))
|
|
197
215
|
if (nativeImage != null) {
|
|
198
216
|
nativeImages.add(nativeImage)
|
|
199
217
|
}
|
|
@@ -241,6 +259,10 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
241
259
|
return null
|
|
242
260
|
}
|
|
243
261
|
val array = stretch.asArray()
|
|
262
|
+
if (array == null) {
|
|
263
|
+
Logger.e("RNMBXImages", "stretch array is null")
|
|
264
|
+
return null
|
|
265
|
+
}
|
|
244
266
|
var result = mutableListOf<ImageStretches>();
|
|
245
267
|
for (i in 0 until array.size()) {
|
|
246
268
|
if (array.getType(i) != ReadableType.Array) {
|
|
@@ -266,6 +288,10 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
|
|
|
266
288
|
return null
|
|
267
289
|
}
|
|
268
290
|
val array = content.asArray()
|
|
291
|
+
if (array == null) {
|
|
292
|
+
Logger.e("RNMBXImages", "content array is null")
|
|
293
|
+
return null
|
|
294
|
+
}
|
|
269
295
|
if (array.size() != 4) {
|
|
270
296
|
Logger.e("RNMBXImages", "content should be an array of 4 numbers, got $content")
|
|
271
297
|
return null
|
|
@@ -24,6 +24,10 @@ class RNMBXCustomLocationProviderManager : ViewGroupManager<RNMBXCustomLocationP
|
|
|
24
24
|
override fun setCoordinate(view: RNMBXCustomLocationProvider, value: Dynamic?) {
|
|
25
25
|
if (value?.type == ReadableType.Array) {
|
|
26
26
|
val array = value.asArray()
|
|
27
|
+
if (array == null) {
|
|
28
|
+
Logger.e(LOG_TAG, "coordinate array is null")
|
|
29
|
+
return
|
|
30
|
+
}
|
|
27
31
|
if (array.size() == 2 && array.getType(0) == ReadableType.Number && array.getType(1) == ReadableType.Number) {
|
|
28
32
|
view.coordinate = Pair(array.getDouble(0), array.getDouble(1))
|
|
29
33
|
} else {
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocation.kt
CHANGED
|
@@ -163,7 +163,7 @@ class RNMBXNativeUserLocation(context: Context) : AbstractMapFeature(context), O
|
|
|
163
163
|
if (pulsing.hasKey("color")) {
|
|
164
164
|
when (pulsing.getType("color")) {
|
|
165
165
|
ReadableType.Map ->
|
|
166
|
-
location2.pulsingColor = ColorPropConverter.getColor(pulsing.getMap("color"), mContext)
|
|
166
|
+
location2.pulsingColor = ColorPropConverter.getColor(pulsing.getMap("color"), mContext) ?: 0
|
|
167
167
|
ReadableType.Number ->
|
|
168
168
|
location2.pulsingColor = pulsing.getInt("color")
|
|
169
169
|
else ->
|
|
@@ -108,8 +108,14 @@ fun _convertToDoubleValueOrExpression(value: Dynamic?, name: String): Value? {
|
|
|
108
108
|
return null
|
|
109
109
|
}
|
|
110
110
|
return when (value.type) {
|
|
111
|
-
ReadableType.Array ->
|
|
112
|
-
|
|
111
|
+
ReadableType.Array -> {
|
|
112
|
+
val array = value.asArray()
|
|
113
|
+
if (array == null) {
|
|
114
|
+
Logger.e("RNMBXNativeUserLocationManager", "_convertToDoubleValueOrExpression: array is null for $name")
|
|
115
|
+
return null
|
|
116
|
+
}
|
|
117
|
+
Expression.fromRaw(Gson().toJson(array.toJsonArray()))
|
|
118
|
+
}
|
|
113
119
|
ReadableType.Number ->
|
|
114
120
|
Value.valueOf(value.asDouble())
|
|
115
121
|
else -> {
|
|
@@ -139,8 +139,13 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
139
139
|
|
|
140
140
|
@ReactProp(name = "localizeLabels")
|
|
141
141
|
override fun setLocalizeLabels(mapView: RNMBXMapView, localeMap: Dynamic) {
|
|
142
|
-
val
|
|
143
|
-
|
|
142
|
+
val mapValue = localeMap.asMap()
|
|
143
|
+
if (mapValue == null) {
|
|
144
|
+
Logger.e(LOG_TAG, "localizeLabels map is null")
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
val locale = mapValue.getString("locale")
|
|
148
|
+
val layerIds = mapValue.getArray("layerIds")?.toArrayList()?.mapNotNull {it.toString()}
|
|
144
149
|
mapView.setReactLocalizeLabels(locale, layerIds)
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -160,6 +165,10 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
160
165
|
mapView.withMap {
|
|
161
166
|
it.gesturesPlugin {
|
|
162
167
|
val map = settings.asMap()
|
|
168
|
+
if (map == null) {
|
|
169
|
+
Logger.e(LOG_TAG, "gestureSettings map is null")
|
|
170
|
+
return@gesturesPlugin Unit
|
|
171
|
+
}
|
|
163
172
|
this.updateSettings {
|
|
164
173
|
map.getAndLogIfNotBoolean("doubleTapToZoomInEnabled", LOG_TAG)?.let {
|
|
165
174
|
this.doubleTapToZoomInEnabled = it
|
|
@@ -207,7 +216,12 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
207
216
|
|
|
208
217
|
@ReactProp(name = "styleURL")
|
|
209
218
|
override fun setStyleURL(mapView: RNMBXMapView, styleURL:Dynamic) {
|
|
210
|
-
|
|
219
|
+
val url = styleURL.asString()
|
|
220
|
+
if (url == null) {
|
|
221
|
+
Logger.e(LOG_TAG, "styleURL is null")
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
mapView.setReactStyleURL(url)
|
|
211
225
|
}
|
|
212
226
|
|
|
213
227
|
@ReactProp(name = "preferredFramesPerSecond")
|
|
@@ -252,12 +266,22 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
252
266
|
|
|
253
267
|
@ReactProp(name = "attributionPosition")
|
|
254
268
|
override fun setAttributionPosition(mapView: RNMBXMapView, attributionPosition: Dynamic) {
|
|
255
|
-
|
|
269
|
+
val mapValue = attributionPosition.asMap()
|
|
270
|
+
if (mapValue == null) {
|
|
271
|
+
Logger.e(LOG_TAG, "attributionPosition map is null")
|
|
272
|
+
return
|
|
273
|
+
}
|
|
274
|
+
mapView.setReactAttributionPosition(mapValue)
|
|
256
275
|
}
|
|
257
276
|
|
|
258
277
|
@ReactProp(name = "attributionViewMargins")
|
|
259
278
|
override fun setAttributionViewMargins(mapView: RNMBXMapView, scaleBarMargins: Dynamic) {
|
|
260
|
-
|
|
279
|
+
val mapValue = scaleBarMargins.asMap()
|
|
280
|
+
if (mapValue == null) {
|
|
281
|
+
Logger.e(LOG_TAG, "attributionViewMargins map is null")
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
mapView.setReactAttributionViewMargins(mapValue)
|
|
261
285
|
}
|
|
262
286
|
|
|
263
287
|
@ReactProp(name = "attributionViewPosition")
|
|
@@ -272,7 +296,12 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
272
296
|
|
|
273
297
|
@ReactProp(name = "logoPosition")
|
|
274
298
|
override fun setLogoPosition(mapView: RNMBXMapView, logoPosition: Dynamic) {
|
|
275
|
-
|
|
299
|
+
val mapValue = logoPosition.asMap()
|
|
300
|
+
if (mapValue == null) {
|
|
301
|
+
Logger.e(LOG_TAG, "logoPosition map is null")
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
mapView.setReactLogoPosition(mapValue)
|
|
276
305
|
}
|
|
277
306
|
|
|
278
307
|
@ReactProp(name = "scaleBarEnabled")
|
|
@@ -282,12 +311,22 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
282
311
|
|
|
283
312
|
@ReactProp(name = "scaleBarViewMargins")
|
|
284
313
|
override fun setScaleBarViewMargins(mapView: RNMBXMapView, scaleBarMargins: Dynamic) {
|
|
285
|
-
|
|
314
|
+
val mapValue = scaleBarMargins.asMap()
|
|
315
|
+
if (mapValue == null) {
|
|
316
|
+
Logger.e(LOG_TAG, "scaleBarViewMargins map is null")
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
mapView.setReactScaleBarViewMargins(mapValue)
|
|
286
320
|
}
|
|
287
321
|
|
|
288
322
|
@ReactProp(name = "scaleBarPosition")
|
|
289
323
|
override fun setScaleBarPosition(mapView: RNMBXMapView, scaleBarPosition: Dynamic) {
|
|
290
|
-
|
|
324
|
+
val mapValue = scaleBarPosition.asMap()
|
|
325
|
+
if (mapValue == null) {
|
|
326
|
+
Logger.e(LOG_TAG, "scaleBarPosition map is null")
|
|
327
|
+
return
|
|
328
|
+
}
|
|
329
|
+
mapView.setReactScaleBarPosition(mapValue)
|
|
291
330
|
}
|
|
292
331
|
|
|
293
332
|
@ReactProp(name = "compassEnabled")
|
|
@@ -302,7 +341,12 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
302
341
|
|
|
303
342
|
@ReactProp(name = "compassViewMargins")
|
|
304
343
|
override fun setCompassViewMargins(mapView: RNMBXMapView, compassViewMargins: Dynamic) {
|
|
305
|
-
|
|
344
|
+
val mapValue = compassViewMargins.asMap()
|
|
345
|
+
if (mapValue == null) {
|
|
346
|
+
Logger.e(LOG_TAG, "compassViewMargins map is null")
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
mapView.setReactCompassViewMargins(mapValue)
|
|
306
350
|
}
|
|
307
351
|
|
|
308
352
|
@ReactProp(name = "compassViewPosition")
|
|
@@ -312,7 +356,12 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
|
|
|
312
356
|
|
|
313
357
|
@ReactProp(name = "compassPosition")
|
|
314
358
|
override fun setCompassPosition(mapView: RNMBXMapView, compassMargins: Dynamic) {
|
|
315
|
-
|
|
359
|
+
val mapValue = compassMargins.asMap()
|
|
360
|
+
if (mapValue == null) {
|
|
361
|
+
Logger.e(LOG_TAG, "compassPosition map is null")
|
|
362
|
+
return
|
|
363
|
+
}
|
|
364
|
+
mapView.setReactCompassPosition(mapValue)
|
|
316
365
|
}
|
|
317
366
|
|
|
318
367
|
@ReactProp(name = "contentInset") @Suppress("UNUSED_PARAMETER")
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleImportManager.kt
CHANGED
|
@@ -52,7 +52,12 @@ class RNMBXStyleImportManager(context: ReactApplicationContext) :
|
|
|
52
52
|
if (value.type != ReadableType.Map) {
|
|
53
53
|
Logger.e(REACT_CLASS, "config expected Map but received: ${value.type}")
|
|
54
54
|
} else {
|
|
55
|
-
|
|
55
|
+
val mapValue = value.asMap()
|
|
56
|
+
if (mapValue == null) {
|
|
57
|
+
Logger.e(REACT_CLASS, "config map is null")
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
view.config = mapValue.toValueHashMap()
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
@@ -223,11 +223,15 @@ class RNMBXStyleValue(config: ReadableMap) {
|
|
|
223
223
|
val dynamic = mPayload!!.getDynamic("value")
|
|
224
224
|
if (dynamic.type == ReadableType.Array) {
|
|
225
225
|
val array = dynamic.asArray()
|
|
226
|
-
if (array
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
if (array == null) {
|
|
227
|
+
Logger.e("RNMBXStyleValue", "value array is null")
|
|
228
|
+
} else {
|
|
229
|
+
if (array.size() > 0 && mPayload.getString("type") == "array") {
|
|
230
|
+
val map = array.getMap(0)
|
|
231
|
+
if (map != null && map.getString("type") == "string") {
|
|
232
|
+
isExpression = true
|
|
233
|
+
mExpression = ExpressionParser.fromTyped(mPayload)
|
|
234
|
+
}
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
}
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt
CHANGED
|
@@ -27,7 +27,11 @@ class RNMBXModelLayer(context: Context?) : RNMBXLayer<ModelLayer?>(
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
fun setSourceLayerID(value: String) {
|
|
30
|
+
fun setSourceLayerID(value: String?) {
|
|
31
|
+
if (value == null) {
|
|
32
|
+
Logger.e("RNMBXModelLayer", "setSourceLayerID: sourceLayerID is null")
|
|
33
|
+
return
|
|
34
|
+
}
|
|
31
35
|
mSourceLayerID = value
|
|
32
36
|
}
|
|
33
37
|
}
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt
CHANGED
|
@@ -5,6 +5,7 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
5
5
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
6
6
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
7
|
import com.facebook.react.viewmanagers.RNMBXModelLayerManagerInterface
|
|
8
|
+
import com.rnmapbox.rnmbx.utils.Logger
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class RNMBXModelLayerManager : ViewGroupManager<RNMBXModelLayer>(),
|
|
@@ -47,11 +47,12 @@ class RNMBXRasterSourceManager(reactApplicationContext: ReactApplicationContext)
|
|
|
47
47
|
|
|
48
48
|
@ReactProp(name = "sourceBounds")
|
|
49
49
|
override fun setSourceBounds(source: RNMBXRasterSource, value: Dynamic) {
|
|
50
|
-
|
|
50
|
+
val array = value.asArray()
|
|
51
|
+
if (value.type != ReadableType.Array || array == null || array.size() != 4) {
|
|
51
52
|
Logger.e(REACT_CLASS, "source bounds must be an array with left, bottom, top, and right values")
|
|
52
53
|
return
|
|
53
54
|
}
|
|
54
|
-
val bboxArray = Array(4) { i ->
|
|
55
|
+
val bboxArray = Array(4) { i -> array.getDouble(i) }
|
|
55
56
|
|
|
56
57
|
if(!this.validateBbox(bboxArray)){
|
|
57
58
|
Logger.e(REACT_CLASS, "source bounds contain invalid bbox")
|
|
@@ -82,7 +82,12 @@ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext, val
|
|
|
82
82
|
|
|
83
83
|
@ReactProp(name = "shape")
|
|
84
84
|
override fun setShape(source: RNMBXShapeSource, geoJSONStr: Dynamic) {
|
|
85
|
-
|
|
85
|
+
val str = geoJSONStr.asString()
|
|
86
|
+
if (str == null) {
|
|
87
|
+
Logger.e(LOG_TAG, "shape string is null")
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
source.setShape(str)
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
@ReactProp(name = "cluster")
|
|
@@ -102,11 +107,16 @@ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext, val
|
|
|
102
107
|
|
|
103
108
|
@ReactProp(name = "clusterProperties")
|
|
104
109
|
override fun setClusterProperties(source: RNMBXShapeSource, map: Dynamic) {
|
|
110
|
+
val mapValue = map.asMap()
|
|
111
|
+
if (mapValue == null) {
|
|
112
|
+
Logger.e(LOG_TAG, "clusterProperties map is null")
|
|
113
|
+
return
|
|
114
|
+
}
|
|
105
115
|
val properties = HashMap<String, Any>()
|
|
106
|
-
val iterator =
|
|
116
|
+
val iterator = mapValue.keySetIterator()
|
|
107
117
|
while (iterator.hasNextKey()) {
|
|
108
118
|
val name = iterator.nextKey()
|
|
109
|
-
val expressions =
|
|
119
|
+
val expressions = mapValue.getArray(name)
|
|
110
120
|
val builder: MutableList<Value> = ArrayList()
|
|
111
121
|
for (iExp in 0 until expressions!!.size()) {
|
|
112
122
|
var argument: Expression
|
|
@@ -158,7 +168,12 @@ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext, val
|
|
|
158
168
|
|
|
159
169
|
@ReactProp(name = "hitbox")
|
|
160
170
|
override fun setHitbox(source: RNMBXShapeSource, map: Dynamic) {
|
|
161
|
-
|
|
171
|
+
val mapValue = map.asMap()
|
|
172
|
+
if (mapValue == null) {
|
|
173
|
+
Logger.e(LOG_TAG, "hitbox map is null")
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
source.setHitbox(mapValue)
|
|
162
177
|
}
|
|
163
178
|
|
|
164
179
|
override fun customEvents(): Map<String, String>? {
|
package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt
CHANGED
|
@@ -39,10 +39,15 @@ abstract class RNMBXTileSourceManager<T : RNMBXTileSource<*>> internal construct
|
|
|
39
39
|
|
|
40
40
|
@ReactProp(name = "tileUrlTemplates")
|
|
41
41
|
fun setTileUrlTemplates(source: T, tileUrlTemplates: Dynamic) {
|
|
42
|
+
val array = tileUrlTemplates.asArray()
|
|
43
|
+
if (array == null) {
|
|
44
|
+
Logger.e("RNMBXTileSourceManager", "tileUrlTemplates array is null")
|
|
45
|
+
return
|
|
46
|
+
}
|
|
42
47
|
val urls: MutableList<String> = ArrayList()
|
|
43
|
-
for (i in 0 until
|
|
44
|
-
if (
|
|
45
|
-
|
|
48
|
+
for (i in 0 until array.size()) {
|
|
49
|
+
if (array.getType(i) == ReadableType.String) {
|
|
50
|
+
array.getString(i)?.let { urls.add(it) } ?: Logger.d("RNMBXTileSource", "Skipping null URL template at index $i")
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
source!!.tileUrlTemplates = urls
|