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 (
-
+ <>
- {routeGeojson && false && (
-
-
-
- )}
{animatedRoute && (
{
{
{
)}
-
+ >
);
};
@@ -235,9 +218,14 @@ export default QueryTerrainElevation;
/** @type ExampleWithMetadata['metadata'] */
const metadata = {
title: 'Query Terrain Elevation',
- tags: ['MapView#queryTerrainElevation'],
+ tags: [
+ 'MapView#queryTerrainElevation',
+ 'AnimatedShape',
+ 'AnimatedRouteCoordinatesArray',
+ 'AnimatedExtractCoordinateFromArray',
+ ],
docs: `
-Query Terrain Elevation
+This is a fairly complex example demonstraing the use of AnimatedShape, Camera animation, queryTerrainElevation and AnimatedMarkerView
`,
};
QueryTerrainElevation.metadata = metadata;
diff --git a/ios/install.md b/ios/install.md
index ff4356980..6fea81e43 100644
--- a/ios/install.md
+++ b/ios/install.md
@@ -69,7 +69,7 @@ We have support for mapbox 11.
Add the following to your Podfile:
```ruby
-$RNMapboxMapsVersion = '= 11.0.0'
+$RNMapboxMapsVersion = '= 11.1.0'
```
If using expo managed workflow, set the "RNMapboxMapsVersion" variable. See the [expo guide](/plugin/install.md)
diff --git a/package.json b/package.json
index 2204a66a1..bd945be65 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rnmapbox/maps",
"description": "A Mapbox react native module for creating custom maps",
- "version": "10.1.6",
+ "version": "10.1.8",
"publishConfig": {
"access": "public"
},
diff --git a/plugin/install.md b/plugin/install.md
index a468ae94a..970022a04 100644
--- a/plugin/install.md
+++ b/plugin/install.md
@@ -20,7 +20,7 @@ After installing this package, add the [config plugin](https://docs.expo.io/guid
[
"@rnmapbox/maps",
{
- "RNMapboxMapsVersion": "11.0.0"
+ "RNMapboxMapsVersion": "11.1.0"
}
]
]
@@ -93,7 +93,7 @@ To use V11 just set the version to a 11 version, see [the ios guide](/ios/instal
[
"@rnmapbox/maps",
{
- "RNMapboxMapsVersion": "11.0.0",
+ "RNMapboxMapsVersion": "11.1.0",
"RNMapboxMapsDownloadToken": "sk.ey...qg",
}
]
diff --git a/rnmapbox-maps.podspec b/rnmapbox-maps.podspec
index 1abe80e89..81745b31d 100644
--- a/rnmapbox-maps.podspec
+++ b/rnmapbox-maps.podspec
@@ -20,7 +20,7 @@ require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
## Warning: these lines are scanned by autogenerate.js
-rnMapboxMapsDefaultMapboxVersion = '~> 10.16.3'
+rnMapboxMapsDefaultMapboxVersion = '~> 10.16.4'
rnMapboxMapsDefaultImpl = 'mapbox'
diff --git a/setup-jest.js b/setup-jest.js
index fb8f6f90f..e168c5efd 100644
--- a/setup-jest.js
+++ b/setup-jest.js
@@ -40,6 +40,7 @@ NativeModules.RNMBXModule = {
EventTypes: keyMirror([
'MapClick',
'MapLongClick',
+ 'MapIdle',
'RegionWillChange',
'RegionIsChanging',
'RegionDidChange',
diff --git a/src/classes/AnimatedRouteCoordinatesArray.js b/src/classes/AnimatedRouteCoordinatesArray.js
index 45f6f8c6a..c9b35e6b4 100644
--- a/src/classes/AnimatedRouteCoordinatesArray.js
+++ b/src/classes/AnimatedRouteCoordinatesArray.js
@@ -22,7 +22,7 @@ export class AnimatedRouteCoordinatesArray extends AnimatedCoordinatesArray {
* Calculate initial state
*
* @param {*} args - to value from animate
- * @param {} options - options, example
+ * @param {{end?: {from?: number}}} options - options, example
* @returns {object} - the state object
*/
onInitialState(coordinatesArray, options = null) {
@@ -32,7 +32,7 @@ export class AnimatedRouteCoordinatesArray extends AnimatedCoordinatesArray {
}
return {
fullRoute: coordinatesArray.map((coord) => [coord[0], coord[1]]),
- end: { from: 0 },
+ end,
};
}
@@ -57,7 +57,6 @@ export class AnimatedRouteCoordinatesArray extends AnimatedCoordinatesArray {
const { fullRoute, end } = state;
const currentEnd = end.from * (1.0 - progress) + progress * end.to;
- // console.log("Current end:", end, currentEnd);
let prevsum = 0;
let actsum = 0;
let i = fullRoute.length - 1;
@@ -72,6 +71,10 @@ export class AnimatedRouteCoordinatesArray extends AnimatedCoordinatesArray {
}
if (actsum <= currentEnd) {
const actRoute = [...fullRoute.slice(0, i + 1)];
+ const minLineStringElements = 2;
+ if (actRoute.length < minLineStringElements) {
+ actRoute.push(actRoute[0]);
+ }
return { fullRoute, end: { ...end, current: currentEnd }, actRoute };
}
const r = (currentEnd - prevsum) / (actsum - prevsum);