diff --git a/README.md b/README.md index c384918a1..97fc4227d 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ const styles = StyleSheet.create({ - [Callout](/docs/Callout.md) - [Camera](docs/Camera.md) - [UserLocation](docs/UserLocation.md) -- [LocaitonPuck](docs/LocationPuck.md) +- [LocationPuck](docs/LocationPuck.md) - [Images](docs/Images.md) - [Image](docs/Image.md) - [Models](docs/Models.md) diff --git a/android/build.gradle b/android/build.gradle index ec9cfc991..4014c50da 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ def defaultMapboxMapsImpl = "mapbox" -def defaultMapboxMapsVersion = "10.16.3" +def defaultMapboxMapsVersion = "10.16.4" def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback diff --git a/android/install.md b/android/install.md index 5455f580d..67acc37c8 100644 --- a/android/install.md +++ b/android/install.md @@ -46,7 +46,7 @@ Set `RNMapboxMapsVersion` in `android/build.gradle > buildscript > ext` section ```groovy buildscript { ext { - RNMapboxMapsVersion = '11.0.0' + RNMapboxMapsVersion = '11.1.0' } } ``` diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt index c979e43b8..5ca61ca97 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt @@ -1512,14 +1512,18 @@ fun RNMBXMapView.updateRequestDisallowInterceptTouchEvent(oldValue: Boolean, val return } if (value) { - mapView.setOnTouchListener { view, event -> - this.requestDisallowInterceptTouchEvent(true) - mapView.onTouchEvent(event) - true + withMapView { + it.setOnTouchListener { view, event -> + this.requestDisallowInterceptTouchEvent(true) + mapView.onTouchEvent(event) + true + } } } else { - mapView.setOnTouchListener { view, event -> - mapView.onTouchEvent(event) + withMapView { + it.setOnTouchListener { view, event -> + mapView.onTouchEvent(event) + } } } } diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSource.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSource.kt index 106742a25..5fbcb0b1d 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSource.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSource.kt @@ -21,6 +21,9 @@ import com.rnmapbox.rnmbx.v11compat.feature.* // import com.rnmapbox.rnmbx.utils.DownloadMapImageTask; class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterDemSourceManager) : RNMBXTileSource(context) { + + private var tileSize: Long? = null + override fun onPress(event: OnPressEvent?) { mManager.handleEvent(FeatureClickEvent.makeVectorSourceEvent(this, event)) } @@ -35,15 +38,18 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD return mMap!!.getStyle()!!.getSource(DEFAULT_ID) as RasterDemSource } val configurationUrl = uRL - return if (configurationUrl != null) { - RasterDemSource( - RasterDemSource.Builder(id) - .url(configurationUrl) - ) - } else RasterDemSource( + + val builder = if (configurationUrl != null) { + RasterDemSource.Builder(id) + .url(configurationUrl) + } else { RasterDemSource.Builder(id) .tileSet(buildTileset()) - ) + } + + tileSize?.let { builder.tileSize(it) } + + return RasterDemSource(builder) } fun querySourceFeatures( @@ -81,4 +87,8 @@ class RNMBXRasterDemSource(context: Context?, private val mManager: RNMBXRasterD override fun hasNoDataSoRefersToExisting(): Boolean { return uRL == null && tileUrlTemplates.isEmpty() } + + fun setTileSize(tileSize: Int) { + this.tileSize = tileSize.toLong() + } } \ No newline at end of file diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt index 4e8c71561..c843d11f0 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt @@ -39,6 +39,6 @@ class RNMBXRasterDemSourceManager(private val mContext: ReactApplicationContext) @ReactProp(name = "tileSize") override fun setTileSize(view: RNMBXRasterDemSource, value: Dynamic) { - Logger.e("RNMBXRasterDemSourceManager", "tileSize not implemented") + view.setTileSize(value.asInt()) } } \ No newline at end of file diff --git a/docs/examples.json b/docs/examples.json index 10b8b390d..20856b87f 100644 --- a/docs/examples.json +++ b/docs/examples.json @@ -468,9 +468,12 @@ "metadata": { "title": "Query Terrain Elevation", "tags": [ - "MapView#queryTerrainElevation" + "MapView#queryTerrainElevation", + "AnimatedShape", + "AnimatedRouteCoordinatesArray", + "AnimatedExtractCoordinateFromArray" ], - "docs": "\nQuery Terrain Elevation\n" + "docs": "\nThis is a fairly complex example demonstraing the use of AnimatedShape, Camera animation, queryTerrainElevation and AnimatedMarkerView\n" }, "fullPath": "example/src/examples/V10/QueryTerrainElevation.js", "relPath": "V10/QueryTerrainElevation.js", diff --git a/example/android/build.gradle b/example/android/build.gradle index 3677db5dd..c9ecdeff8 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -8,10 +8,10 @@ buildscript { RNMapboxMapsImpl = "mapbox" kotlinVersion = '1.6.21' } else if (System.getenv('CI_MAP_IMPL').equals('mapbox11')) { - RNMapboxMapsVersion = '11.0.0' + RNMapboxMapsVersion = '11.1.0' RNMapboxMapsImpl = "mapbox" } else if (project.hasProperty('RNMBX11') && project.getProperty('RNMBX11').toBoolean()) { - RNMapboxMapsVersion = '11.0.0' + RNMapboxMapsVersion = '11.1.0' } // Mapbox deps diff --git a/example/ios/Podfile b/example/ios/Podfile index 9f8975648..0f0e6cbe0 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -10,7 +10,7 @@ prepare_react_native_project! $RNMapboxMapsImpl = 'mapbox' if ENV['RNMBX11'] - $RNMapboxMapsVersion = '= 11.0.0' + $RNMapboxMapsVersion = '= 11.1.0' end if ENV['CI_MAP_IMPL'] diff --git a/example/src/examples/Animations/AnimatedLine.js b/example/src/examples/Animations/AnimatedLine.js index 5b74db1e7..879427e96 100755 --- a/example/src/examples/Animations/AnimatedLine.js +++ b/example/src/examples/Animations/AnimatedLine.js @@ -1,6 +1,14 @@ import React from 'react'; import { Easing, Button } from 'react-native'; -import { Animated, MapView, Camera } from '@rnmapbox/maps'; +import { + Animated, + MapView, + Camera, + AnimatedRouteCoordinatesArray, + AnimatedExtractCoordinateFromArray, + AnimatedCoordinatesArray, + AnimatedShape, +} from '@rnmapbox/maps'; import along from '@turf/along'; import length from '@turf/length'; import { point, lineString } from '@turf/helpers'; @@ -47,7 +55,7 @@ class AnimatedLine extends React.Component { constructor(props) { super(props); - const route = new Animated.RouteCoordinatesArray([ + const route = new AnimatedRouteCoordinatesArray([ [blon, blat], [blon, blat + 2 * bdelta], [blon + bdelta, blat + 2 * bdelta + bdelta], @@ -58,7 +66,7 @@ class AnimatedLine extends React.Component { backgroundColor: 'blue', coordinates: [[-73.99155, 40.73581]], - shape: new Animated.CoordinatesArray( + shape: new AnimatedCoordinatesArray( [...Array(steps).keys()].map((v, i) => [ lon + delta * (i / steps) * (i / steps), lat + (delta * i) / steps, @@ -69,7 +77,7 @@ class AnimatedLine extends React.Component { features: [], }, route, - actPoint: new Animated.ExtractCoordinateFromArray(route, -1), + actPoint: new AnimatedExtractCoordinateFromArray(route, -1), }; } @@ -219,7 +227,7 @@ class AnimatedLine extends React.Component { { - let [routeGeojson, setRouteGeojson] = useState(null); +const QueryTerrainElevation = () => { let [animatedRoute, setAnimatedRoute] = useState(null); let [actPoint, setActPoint] = useState(null); - // let [pinRoute, setPinRoute] = useState(null); let camera = useRef(); let [altitude, setAltitude] = useState(null); let updateAltitudeInterval = useRef(); @@ -93,21 +90,20 @@ const QueryTerrainElevation = ({ ...props }) => { 'https://docs.mapbox.com/mapbox-gl-js/assets/route-pin.geojson', ); let featureCollection = await response.json(); - setRouteGeojson(featureCollection); + let pinRoute = featureCollection.features[0].geometry.coordinates; - let animatedRoute = new Animated.RouteCoordinatesArray(pinRoute, { + let animatedRoute = new AnimatedRouteCoordinatesArray(pinRoute, { end: { from: length(lineString(pinRoute)), }, }); setAnimatedRoute(animatedRoute); - setActPoint(new Animated.ExtractCoordinateFromArray(animatedRoute, -1)); - //setPinRoute(pinRoute); + setActPoint(new AnimatedExtractCoordinateFromArray(animatedRoute, -1)); })(); }, []); return ( - + <>