@rnmapbox/maps 10.0.0-beta.41 → 10.0.0-beta.42
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/.eslintrc.js +2 -1
- package/.github/workflows/ios-actions.yml +1 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +2 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +21 -31
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +26 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/atmosphere/RCTMGLAtmosphere.kt +59 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/atmosphere/RCTMGLAtmosphereManager.kt +30 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/terrain/RCTMGLTerrain.kt +32 -27
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/terrain/RCTMGLTerrainManager.kt +5 -11
- package/docs/Annotations.md +4 -3
- package/docs/Camera.md +1 -1
- package/docs/MapView.md +2 -2
- package/docs/Terrain.md +64 -9
- package/docs/docs.json +54 -45
- package/index.d.ts +2 -7
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +25 -7
- package/ios/RCTMGL-v10/RCTMGLImages.swift +1 -99
- package/ios/RCTMGL-v10/RCTMGLLogging.swift +8 -0
- package/ios/RCTMGL-v10/RCTMGLMapView.swift +35 -39
- package/ios/RCTMGL-v10/RCTMGLSingletonLayer.swift +7 -1
- package/ios/RCTMGL-v10/RCTMGLStyle.swift +34 -0
- package/ios/RCTMGL-v10/RCTMGLTerrain.swift +56 -63
- package/ios/RCTMGL-v10/RCTMGLTerrainManager.m +2 -3
- package/javascript/components/Camera.tsx +17 -1
- package/javascript/components/MapView.js +8 -12
- package/javascript/components/Terrain.tsx +112 -0
- package/javascript/index.js +8 -4
- package/javascript/types/index.ts +0 -14
- package/javascript/utils/MapboxStyles.ts +20 -2
- package/javascript/utils/deprecation.ts +39 -0
- package/javascript/utils/styleMap.ts +26 -0
- package/package.json +6 -6
- package/scripts/autogenHelpers/globals.js +2 -0
- package/scripts/autogenerate.js +13 -0
- package/scripts/templates/MapboxStyles.ts.ejs +1 -1
- package/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +1 -0
- package/.eslintignore +0 -1
- package/javascript/components/Terrain.js +0 -56
- package/javascript/utils/deprecation.js +0 -24
package/.eslintrc.js
CHANGED
|
@@ -78,8 +78,9 @@ module.exports = {
|
|
|
78
78
|
'no-unused-expressions': ['error', { allowTaggedTemplates: true }],
|
|
79
79
|
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
80
80
|
'react-native/no-inline-styles': 0,
|
|
81
|
+
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
|
|
81
82
|
},
|
|
82
|
-
ignorePatterns: ['**/rnmapbox.web.symlink'],
|
|
83
|
+
ignorePatterns: ['**/rnmapbox.web.symlink', 'plugin/build/'],
|
|
83
84
|
overrides: [
|
|
84
85
|
{
|
|
85
86
|
// Match TypeScript Files
|
|
@@ -64,7 +64,7 @@ jobs:
|
|
|
64
64
|
brew install xcbeautify
|
|
65
65
|
|
|
66
66
|
- name: Build for detox
|
|
67
|
-
run: yarn detox build --configuration ios.debug | xcbeautify -qq
|
|
67
|
+
run: set -o pipefail && NSUnbufferedIO=YES yarn detox build --configuration ios.debug 2>&1 | xcbeautify -qq
|
|
68
68
|
|
|
69
69
|
- name: Test with detox
|
|
70
70
|
run: |
|
|
@@ -20,6 +20,7 @@ import com.mapbox.rctmgl.components.images.RCTMGLImagesManager;
|
|
|
20
20
|
import com.mapbox.rctmgl.components.location.RCTMGLNativeUserLocationManager;
|
|
21
21
|
import com.mapbox.rctmgl.components.mapview.RCTMGLMapViewManager;
|
|
22
22
|
import com.mapbox.rctmgl.components.mapview.RCTMGLAndroidTextureMapViewManager;
|
|
23
|
+
import com.mapbox.rctmgl.components.styles.atmosphere.RCTMGLAtmosphereManager;
|
|
23
24
|
import com.mapbox.rctmgl.components.styles.layers.RCTMGLBackgroundLayerManager;
|
|
24
25
|
import com.mapbox.rctmgl.components.styles.layers.RCTMGLCircleLayerManager;
|
|
25
26
|
import com.mapbox.rctmgl.components.styles.layers.RCTMGLFillExtrusionLayerManager;
|
|
@@ -107,6 +108,7 @@ public class RCTMGLPackage implements ReactPackage {
|
|
|
107
108
|
managers.add(new RCTMGLRasterLayerManager());
|
|
108
109
|
managers.add(new RCTMGLSkyLayerManager());
|
|
109
110
|
managers.add(new RCTMGLTerrainManager());
|
|
111
|
+
managers.add(new RCTMGLAtmosphereManager());
|
|
110
112
|
managers.add(new RCTMGLBackgroundLayerManager());
|
|
111
113
|
|
|
112
114
|
managers.add(new RCTMGLLightManager());
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt
CHANGED
|
@@ -159,7 +159,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
159
159
|
override fun onStyleLoaded(style: Style) {
|
|
160
160
|
savedStyle = style
|
|
161
161
|
setUpImage(style)
|
|
162
|
-
|
|
162
|
+
addQueuedFeaturesToMap()
|
|
163
163
|
setupLocalization(style)
|
|
164
164
|
}
|
|
165
165
|
})
|
|
@@ -305,26 +305,28 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
305
305
|
mCameraChangeTracker.setReason(CameraChangeTracker.EMPTY)
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
private fun
|
|
309
|
-
|
|
310
|
-
return
|
|
311
|
-
}
|
|
312
|
-
for (key in mSources.keys) {
|
|
313
|
-
val source = mSources[key]
|
|
314
|
-
source?.removeFromMap(this)
|
|
315
|
-
}
|
|
308
|
+
private fun removeAllFeaturesFromMap() {
|
|
309
|
+
mFeatures.forEach { it -> it.removeFromMap(this) }
|
|
316
310
|
}
|
|
317
311
|
|
|
318
|
-
private fun
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
312
|
+
private fun addQueuedFeaturesToMap() {
|
|
313
|
+
mQueuedFeatures?.let { queuedFeatures ->
|
|
314
|
+
queuedFeatures.forEach {
|
|
315
|
+
it.addToMap(this)
|
|
316
|
+
mFeatures.add(it)
|
|
317
|
+
}
|
|
318
|
+
queuedFeatures.clear()
|
|
325
319
|
}
|
|
326
320
|
}
|
|
327
321
|
|
|
322
|
+
private fun addAllFeaturesToMap() {
|
|
323
|
+
mQueuedFeatures?.also {
|
|
324
|
+
this.addQueuedFeaturesToMap()
|
|
325
|
+
} ?: run {
|
|
326
|
+
mFeatures.forEach { it.addToMap(this) }
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
328
330
|
private val allTouchableSources: List<RCTSource<*>>
|
|
329
331
|
private get() {
|
|
330
332
|
val sources: MutableList<RCTSource<*>> = ArrayList()
|
|
@@ -380,19 +382,18 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
380
382
|
|
|
381
383
|
fun setReactStyleURL(styleURL: String) {
|
|
382
384
|
if (mMap != null) {
|
|
383
|
-
|
|
385
|
+
removeAllFeaturesFromMap()
|
|
384
386
|
if (isJSONValid(mStyleURL)) {
|
|
385
387
|
mMap.loadStyleJson(styleURL, object : Style.OnStyleLoaded {
|
|
386
388
|
override fun onStyleLoaded(style: Style) {
|
|
387
|
-
|
|
389
|
+
addAllFeaturesToMap()
|
|
388
390
|
}
|
|
389
391
|
})
|
|
390
392
|
} else {
|
|
391
393
|
mMap.loadStyleUri(styleURL, object : Style.OnStyleLoaded {
|
|
392
394
|
override fun onStyleLoaded(style: Style) {
|
|
393
395
|
savedStyle = style
|
|
394
|
-
|
|
395
|
-
addQueuedFeatures()
|
|
396
|
+
addAllFeaturesToMap()
|
|
396
397
|
}
|
|
397
398
|
},
|
|
398
399
|
object : OnMapLoadErrorListener {
|
|
@@ -606,17 +607,6 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
606
607
|
return GeoJSONUtils.toPointFeature(latLng, properties)
|
|
607
608
|
}
|
|
608
609
|
|
|
609
|
-
fun addQueuedFeatures() {
|
|
610
|
-
if (mQueuedFeatures != null && mQueuedFeatures!!.size > 0) {
|
|
611
|
-
for (i in mQueuedFeatures!!.indices) {
|
|
612
|
-
val feature = mQueuedFeatures!![i]
|
|
613
|
-
feature.addToMap(this)
|
|
614
|
-
mFeatures.add(feature)
|
|
615
|
-
}
|
|
616
|
-
mQueuedFeatures = null
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
610
|
private fun setupLocalization(style: Style) {
|
|
621
611
|
/*
|
|
622
612
|
mLocalizationPlugin = new LocalizationPlugin(RCTMGLMapView.this, mMap, style);
|
package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java
CHANGED
|
@@ -17,6 +17,7 @@ import com.mapbox.maps.extension.style.layers.generated.SymbolLayer;
|
|
|
17
17
|
import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer;
|
|
18
18
|
import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer;
|
|
19
19
|
import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere;
|
|
20
|
+
import com.mapbox.maps.extension.style.terrain.generated.Terrain;
|
|
20
21
|
// import com.mapbox.maps.extension.style.layers.properties.generated.Visibility;
|
|
21
22
|
import com.mapbox.maps.extension.style.layers.properties.generated.*;
|
|
22
23
|
import com.mapbox.maps.extension.style.types.StyleTransition;
|
|
@@ -886,6 +887,23 @@ public class RCTMGLStyleFactory {
|
|
|
886
887
|
}
|
|
887
888
|
}
|
|
888
889
|
}
|
|
890
|
+
public static void setTerrainLayerStyle(final Terrain layer, RCTMGLStyle style) {
|
|
891
|
+
List<String> styleKeys = style.getAllStyleKeys();
|
|
892
|
+
|
|
893
|
+
if (styleKeys.size() == 0) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
for (String styleKey : styleKeys) {
|
|
898
|
+
final RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey);
|
|
899
|
+
|
|
900
|
+
switch (styleKey) {
|
|
901
|
+
case "exaggeration":
|
|
902
|
+
RCTMGLStyleFactory.setExaggeration(layer, styleValue);
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
889
907
|
|
|
890
908
|
public static void setFillSortKey(FillLayer layer, RCTMGLStyleValue styleValue) {
|
|
891
909
|
if (styleValue.isExpression()) {
|
|
@@ -2635,4 +2653,12 @@ public class RCTMGLStyleFactory {
|
|
|
2635
2653
|
}
|
|
2636
2654
|
}
|
|
2637
2655
|
|
|
2656
|
+
public static void setExaggeration(Terrain layer, RCTMGLStyleValue styleValue) {
|
|
2657
|
+
if (styleValue.isExpression()) {
|
|
2658
|
+
layer.exaggeration(styleValue.getExpression());
|
|
2659
|
+
} else {
|
|
2660
|
+
layer.exaggeration(styleValue.getFloat(VALUE_KEY));
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2638
2664
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.mapbox.rctmgl.components.styles.atmosphere
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.mapbox.maps.MapboxMap
|
|
6
|
+
import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere
|
|
7
|
+
import com.mapbox.maps.extension.style.terrain.generated.Terrain
|
|
8
|
+
import com.mapbox.maps.extension.style.terrain.generated.removeTerrain
|
|
9
|
+
import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
|
|
10
|
+
import com.mapbox.rctmgl.components.styles.RCTMGLStyle
|
|
11
|
+
import com.mapbox.rctmgl.components.styles.RCTMGLStyleFactory
|
|
12
|
+
import com.mapbox.rctmgl.components.styles.sources.AbstractSourceConsumer
|
|
13
|
+
import com.mapbox.rctmgl.utils.Logger
|
|
14
|
+
|
|
15
|
+
class RCTMGLAtmosphere(context: Context?) : AbstractSourceConsumer(context) {
|
|
16
|
+
override var iD: String? = null
|
|
17
|
+
protected var mAtmosphere: Atmosphere? = null
|
|
18
|
+
|
|
19
|
+
// beginregion RCTLayer
|
|
20
|
+
@JvmField
|
|
21
|
+
protected var mMap: MapboxMap? = null
|
|
22
|
+
|
|
23
|
+
@JvmField
|
|
24
|
+
protected var mReactStyle: ReadableMap? = null
|
|
25
|
+
|
|
26
|
+
fun setReactStyle(reactStyle: ReadableMap?) {
|
|
27
|
+
mReactStyle = reactStyle
|
|
28
|
+
if (mAtmosphere != null) {
|
|
29
|
+
addStyles()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// endregion RCTLayer
|
|
33
|
+
|
|
34
|
+
override fun addToMap(mapView: RCTMGLMapView) {
|
|
35
|
+
mMap = mapView.getMapboxMap()
|
|
36
|
+
val atmosphere = makeAtmosphere()
|
|
37
|
+
mAtmosphere = atmosphere
|
|
38
|
+
addStyles()
|
|
39
|
+
mapView.savedStyle?.let { atmosphere.bindTo(it) }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun removeFromMap(mapView: RCTMGLMapView) {
|
|
43
|
+
mapView.savedStyle?.let { it.removeTerrain() }
|
|
44
|
+
mMap = null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fun makeAtmosphere(): Atmosphere {
|
|
48
|
+
return Atmosphere()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fun addStyles() {
|
|
52
|
+
RCTMGLStyleFactory.setAtmosphereLayerStyle(
|
|
53
|
+
mAtmosphere, RCTMGLStyle(
|
|
54
|
+
context, mReactStyle!!,
|
|
55
|
+
mMap!!
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package com.mapbox.rctmgl.components.styles.atmosphere
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
6
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
|
|
8
|
+
class RCTMGLAtmosphereManager : ViewGroupManager<RCTMGLAtmosphere>() {
|
|
9
|
+
override fun getName(): String {
|
|
10
|
+
return REACT_CLASS
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun createViewInstance(reactContext: ThemedReactContext): RCTMGLAtmosphere {
|
|
14
|
+
return RCTMGLAtmosphere(reactContext)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@ReactProp(name = "id")
|
|
18
|
+
fun setId(layer: RCTMGLAtmosphere, id: String?) {
|
|
19
|
+
layer.iD = id
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@ReactProp(name = "reactStyle")
|
|
23
|
+
fun setReactStyle(atmosphere: RCTMGLAtmosphere, reactStyle: ReadableMap?) {
|
|
24
|
+
atmosphere.setReactStyle(reactStyle)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
companion object {
|
|
28
|
+
const val REACT_CLASS = "RCTMGLAtmosphere"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,58 +1,63 @@
|
|
|
1
1
|
package com.mapbox.rctmgl.components.styles.terrain
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
-
import com.facebook.react.bridge.
|
|
5
|
-
import com.mapbox.
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.mapbox.maps.MapboxMap
|
|
6
6
|
import com.mapbox.maps.extension.style.terrain.generated.Terrain
|
|
7
|
+
import com.mapbox.maps.extension.style.terrain.generated.removeTerrain
|
|
7
8
|
import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
|
|
8
|
-
import com.
|
|
9
|
-
import com.mapbox.rctmgl.
|
|
9
|
+
import com.mapbox.rctmgl.components.styles.RCTMGLStyle
|
|
10
|
+
import com.mapbox.rctmgl.components.styles.RCTMGLStyleFactory
|
|
11
|
+
import com.mapbox.rctmgl.components.styles.sources.AbstractSourceConsumer
|
|
10
12
|
import com.mapbox.rctmgl.utils.Logger
|
|
11
13
|
|
|
12
14
|
class RCTMGLTerrain(context: Context?) : AbstractSourceConsumer(context) {
|
|
13
15
|
override var iD: String? = null
|
|
14
16
|
protected var mSourceID: String? = null
|
|
15
|
-
protected var mExaggeration: Dynamic? = null
|
|
16
17
|
protected var mTerrain: Terrain? = null
|
|
17
18
|
|
|
19
|
+
// beginregion RCTLayer
|
|
20
|
+
@JvmField
|
|
21
|
+
protected var mMap: MapboxMap? = null
|
|
22
|
+
|
|
23
|
+
@JvmField
|
|
24
|
+
protected var mReactStyle: ReadableMap? = null
|
|
25
|
+
|
|
26
|
+
fun setReactStyle(reactStyle: ReadableMap?) {
|
|
27
|
+
mReactStyle = reactStyle
|
|
28
|
+
if (mTerrain != null) {
|
|
29
|
+
addStyles()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// endregion RCTLayer
|
|
33
|
+
|
|
18
34
|
fun setSourceID(sourceID: String?) {
|
|
19
35
|
mSourceID = sourceID
|
|
20
36
|
}
|
|
21
37
|
|
|
22
38
|
override fun addToMap(mapView: RCTMGLMapView) {
|
|
39
|
+
mMap = mapView.getMapboxMap()
|
|
23
40
|
val terrain = makeTerrain()
|
|
24
|
-
addStyles(terrain)
|
|
25
41
|
mTerrain = terrain
|
|
26
|
-
|
|
42
|
+
addStyles()
|
|
43
|
+
mapView.savedStyle?.let { terrain.bindTo(it) }
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
override fun removeFromMap(mapView: RCTMGLMapView) {
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
mapView.savedStyle?.let { it.removeTerrain() }
|
|
48
|
+
mMap = null
|
|
32
49
|
}
|
|
33
50
|
|
|
34
51
|
fun makeTerrain(): Terrain {
|
|
35
52
|
return Terrain(mSourceID!!)
|
|
36
53
|
}
|
|
37
54
|
|
|
38
|
-
fun
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
when (mExaggeration!!.type) {
|
|
44
|
-
ReadableType.Number -> terrain.exaggeration(mExaggeration!!.asDouble())
|
|
45
|
-
ReadableType.Array -> terrain.exaggeration(
|
|
46
|
-
ExpressionParser.from(mExaggeration!!.asArray())!!
|
|
47
|
-
)
|
|
48
|
-
else -> Logger.e(
|
|
49
|
-
"RCTMGLTerrain",
|
|
50
|
-
"Unexpected type passed to exaggeration:$mExaggeration"
|
|
55
|
+
fun addStyles() {
|
|
56
|
+
RCTMGLStyleFactory.setTerrainLayerStyle(
|
|
57
|
+
mTerrain, RCTMGLStyle(
|
|
58
|
+
context, mReactStyle!!,
|
|
59
|
+
mMap!!
|
|
51
60
|
)
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
fun setSourceLayerID(sourceLayerID: String?) {
|
|
56
|
-
Logger.e("RCTMGLSkyLayer", "Source layer should not be set for source layer id")
|
|
61
|
+
)
|
|
57
62
|
}
|
|
58
63
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
package com.mapbox.rctmgl.components.styles.terrain
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.bridge.
|
|
4
|
-
import com.mapbox.rctmgl.components.styles.sources.AbstractSourceConsumer
|
|
5
|
-
import com.mapbox.maps.extension.style.terrain.generated.Terrain
|
|
6
|
-
import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
|
|
7
|
-
import com.facebook.react.bridge.ReadableType
|
|
8
|
-
import com.facebook.react.uimanager.ViewGroupManager
|
|
9
|
-
import com.mapbox.rctmgl.components.styles.terrain.RCTMGLTerrain
|
|
10
|
-
import com.mapbox.rctmgl.components.styles.terrain.RCTMGLTerrainManager
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap
|
|
11
4
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
12
6
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
13
7
|
|
|
14
8
|
class RCTMGLTerrainManager : ViewGroupManager<RCTMGLTerrain>() {
|
|
@@ -30,9 +24,9 @@ class RCTMGLTerrainManager : ViewGroupManager<RCTMGLTerrain>() {
|
|
|
30
24
|
layer.setSourceID(sourceID)
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
@ReactProp(name = "
|
|
34
|
-
fun
|
|
35
|
-
|
|
27
|
+
@ReactProp(name = "reactStyle")
|
|
28
|
+
fun setReactStyle(terrain: RCTMGLTerrain, reactStyle: ReadableMap?) {
|
|
29
|
+
terrain.setReactStyle(reactStyle)
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
companion object {
|
package/docs/Annotations.md
CHANGED
|
@@ -5,11 +5,12 @@ Comparsion of various annotations available in React native mapbox:
|
|
|
5
5
|
| *Feature* | *SymbolLayer* | *PointAnnotation* |*MarkerView* |*CircleLayer* |
|
|
6
6
|
|------------------------|--------------------|---------------------------------------------------------------------------------------------------------------------------------------|-------------------------|---------------------|
|
|
7
7
|
| Can use images | ✓ | | | |
|
|
8
|
-
| RN Views as children | iOS: static |
|
|
9
|
-
| Interactions | click |
|
|
10
|
-
| Control Z-index | ✓ |
|
|
8
|
+
| RN Views as children | iOS: static | static in v10, *was interactive on iOS before v10* |interactive | |
|
|
9
|
+
| Interactions | click | click & drag & callout | supports full interactivity in the sense that inside MarkerViews one can place any RN View, which can be interacted with. Not to be misunderstood with drag n drop interactivity. | click |
|
|
10
|
+
| Control Z-index | ✓ | n/a |always on top | ✓ |
|
|
11
11
|
| Clustering | ✓ | | | ✓ |
|
|
12
12
|
| Style with expressions | ✓ | | | ✓ |
|
|
13
|
+
| v10 implementation | [SymbolLayer](https://docs.mapbox.com/ios/maps/api/10.8.1/Structs/SymbolLayer.html) | [PointAnnotation](https://docs.mapbox.com/ios/maps/api/10.8.1/Classes/PointAnnotationManager.html) |[ViewAnnotations](https://docs.mapbox.com/ios/maps/api/10.8.1/Classes/ViewAnnotationManager.html) |[CircleLayer](https://docs.mapbox.com/ios/maps/api/10.8.1/Structs/CircleLayer.html) |
|
|
13
14
|
| iOS implementation | [MGLStyleSymbolLayer](https://docs.mapbox.com/ios/api/maps/5.8.0/Classes/MGLSymbolStyleLayer.html) | [MGLAnnotationView](https://docs.mapbox.com/ios/api/maps/5.8.0/Classes/MGLAnnotationView.html) |[MGLAnnotationView](https://docs.mapbox.com/ios/api/maps/5.8.0/Classes/MGLAnnotationView.html) |[MGLCircleStyleLayer](https://docs.mapbox.com/ios/api/maps/5.8.0/Classes/MGLCircleStyleLayer.html) |
|
|
14
15
|
| Android implementation | [SymbolLayer](https://docs.mapbox.com/android/api/map-sdk/9.0.0/com/mapbox/mapboxsdk/style/layers/SymbolLayer.html)| [annotation.Symbol](https://docs.mapbox.com/android/api/plugins/annotation/0.8.0/com/mapbox/mapboxsdk/plugins/annotation/Symbol.html) |[annotation.Marker](https://docs.mapbox.com/android/api/plugins/markerview/0.4.0/com/mapbox/mapboxsdk/plugins/markerview/MarkerView.html) |[CircleLayer](https://docs.mapbox.com/android/api/map-sdk/9.0.0/com/mapbox/mapboxsdk/style/layers/CircleLayer.html)|
|
|
15
16
|
|
package/docs/Camera.md
CHANGED
|
@@ -60,7 +60,7 @@ return (
|
|
|
60
60
|
| animationMode | `union` | `none` | `false` | The easing or path the camera uses to animate to a new configuration. |
|
|
61
61
|
| allowUpdates | `boolean` | `none` | `false` | Whether the camera should send any configuration to the native module. Prevents unnecessary tile<br/>fetching and improves performance when the map is not visible. Defaults to `true`. |
|
|
62
62
|
| triggerKey | `string \| number` | `none` | `false` | Any arbitrary primitive value that, when changed, causes the camera to retry moving to its target<br/>configuration. (Not yet implemented.) |
|
|
63
|
-
| onUserTrackingModeChange | `
|
|
63
|
+
| onUserTrackingModeChange | `func` | `none` | `false` | Executes when user tracking mode changes.<br/>*signature:*`(event:MapboxGLEvent) => void` |
|
|
64
64
|
|
|
65
65
|
## methods
|
|
66
66
|
### setCamera()
|
package/docs/MapView.md
CHANGED
|
@@ -33,8 +33,8 @@ MapView backed by Mapbox Native GL
|
|
|
33
33
|
| onRegionWillChange | `func` | `none` | `false` | <v10 only<br/><br/>This event is triggered whenever the currently displayed map region is about to change. |
|
|
34
34
|
| onRegionIsChanging | `func` | `none` | `false` | This event is triggered whenever the currently displayed map region is changing. |
|
|
35
35
|
| onRegionDidChange | `func` | `none` | `false` | This event is triggered whenever the currently displayed map region finished changing. |
|
|
36
|
-
| onCameraChanged | `func` | `none` | `false` | iOS, v10 only,
|
|
37
|
-
| onMapIdle | `func` | `none` | `false` | iOS, v10 only,
|
|
36
|
+
| onCameraChanged | `func` | `none` | `false` | iOS, v10 only, deprecated will be removed in next version - please use onRegionIsChanging. |
|
|
37
|
+
| onMapIdle | `func` | `none` | `false` | iOS, v10 only, deprecated will be removed in next version - please use onRegionDidChange |
|
|
38
38
|
| onWillStartLoadingMap | `func` | `none` | `false` | This event is triggered when the map is about to start loading a new map style. |
|
|
39
39
|
| onDidFinishLoadingMap | `func` | `none` | `false` | This is triggered when the map has successfully loaded a new map style. |
|
|
40
40
|
| onDidFailLoadingMap | `func` | `none` | `false` | This event is triggered when the map has failed to load a new map style. |
|
package/docs/Terrain.md
CHANGED
|
@@ -1,22 +1,77 @@
|
|
|
1
|
-
<!-- This file was autogenerated from Terrain.
|
|
1
|
+
<!-- This file was autogenerated from Terrain.tsx do not modify -->
|
|
2
2
|
# <MapboxGL.Terrain />
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
|
|
5
5
|
## props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :-- | :----- | :------ | :---------- |
|
|
8
|
-
| sourceID | `string` | `
|
|
9
|
-
| exaggeration | `
|
|
8
|
+
| sourceID | `string` | `none` | `true` | Name of a source of raster_dem type to be used for terrain elevation. |
|
|
9
|
+
| exaggeration | `Value` | `none` | `false` | Deprecated, use exaggeration in style instead |
|
|
10
|
+
| style | `TerrainLayerStyleProps` | `none` | `true` | Customizable style attributes |
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## styles
|
|
14
|
+
|
|
15
|
+
* <a href="#source">source</a><br/>
|
|
16
|
+
* <a href="#exaggeration">exaggeration</a><br/>
|
|
17
|
+
|
|
18
|
+
___
|
|
19
|
+
|
|
20
|
+
### source
|
|
21
|
+
Name: `source`
|
|
22
|
+
|
|
23
|
+
### Description
|
|
24
|
+
Name of a source of `raster_dem` type to be used for terrain elevation.
|
|
25
|
+
|
|
26
|
+
### Type
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
___
|
|
32
|
+
|
|
33
|
+
### exaggeration
|
|
34
|
+
Name: `exaggeration`
|
|
35
|
+
|
|
36
|
+
### Description
|
|
37
|
+
Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.
|
|
38
|
+
|
|
39
|
+
### Type
|
|
40
|
+
`number`
|
|
41
|
+
### Default Value
|
|
42
|
+
`1`
|
|
43
|
+
|
|
44
|
+
### Minimum
|
|
45
|
+
`0`
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Maximum
|
|
49
|
+
`1000`
|
|
50
|
+
|
|
51
|
+
### Requires
|
|
52
|
+
`source`
|
|
53
|
+
|
|
54
|
+
### Expression
|
|
55
|
+
|
|
56
|
+
Parameters: `zoom`
|
|
57
|
+
___
|
|
58
|
+
|
|
59
|
+
### Name
|
|
60
|
+
|
|
61
|
+
`exaggerationTransition`
|
|
10
62
|
|
|
11
|
-
|
|
12
|
-
### baseProps()
|
|
63
|
+
### Description
|
|
13
64
|
|
|
65
|
+
The transition affecting any changes to this layer’s exaggeration property.
|
|
14
66
|
|
|
67
|
+
### Type
|
|
15
68
|
|
|
16
|
-
|
|
17
|
-
| Name | Type | Required | Description |
|
|
18
|
-
| ---- | :--: | :------: | :----------: |
|
|
69
|
+
`{ duration, delay }`
|
|
19
70
|
|
|
71
|
+
### Units
|
|
72
|
+
`milliseconds`
|
|
20
73
|
|
|
74
|
+
### Default Value
|
|
75
|
+
`{duration: 300, delay: 0}`
|
|
21
76
|
|
|
22
77
|
|
package/docs/docs.json
CHANGED
|
@@ -696,9 +696,12 @@
|
|
|
696
696
|
{
|
|
697
697
|
"name": "onUserTrackingModeChange",
|
|
698
698
|
"required": false,
|
|
699
|
-
"type":
|
|
699
|
+
"type": {
|
|
700
|
+
"name": "func",
|
|
701
|
+
"funcSignature": "(event:MapboxGLEvent) => void"
|
|
702
|
+
},
|
|
700
703
|
"default": "none",
|
|
701
|
-
"description": "Executes when user tracking mode changes
|
|
704
|
+
"description": "Executes when user tracking mode changes.\n*signature:*`(event:MapboxGLEvent) => void`"
|
|
702
705
|
}
|
|
703
706
|
],
|
|
704
707
|
"fileNameWithExt": "Camera.tsx",
|
|
@@ -3055,34 +3058,14 @@
|
|
|
3055
3058
|
"required": false,
|
|
3056
3059
|
"type": "func",
|
|
3057
3060
|
"default": "none",
|
|
3058
|
-
"description": "iOS, v10 only,
|
|
3059
|
-
"params": [
|
|
3060
|
-
{
|
|
3061
|
-
"name": "region",
|
|
3062
|
-
"description": "A payload containing the map center, bounds, and other properties.",
|
|
3063
|
-
"type": {
|
|
3064
|
-
"name": "MapState"
|
|
3065
|
-
},
|
|
3066
|
-
"optional": false
|
|
3067
|
-
}
|
|
3068
|
-
]
|
|
3061
|
+
"description": "iOS, v10 only, deprecated will be removed in next version - please use onRegionIsChanging."
|
|
3069
3062
|
},
|
|
3070
3063
|
{
|
|
3071
3064
|
"name": "onMapIdle",
|
|
3072
3065
|
"required": false,
|
|
3073
3066
|
"type": "func",
|
|
3074
3067
|
"default": "none",
|
|
3075
|
-
"description": "iOS, v10 only,
|
|
3076
|
-
"params": [
|
|
3077
|
-
{
|
|
3078
|
-
"name": "region",
|
|
3079
|
-
"description": "A payload containing the map center, bounds, and other properties.",
|
|
3080
|
-
"type": {
|
|
3081
|
-
"name": "MapState"
|
|
3082
|
-
},
|
|
3083
|
-
"optional": false
|
|
3084
|
-
}
|
|
3085
|
-
]
|
|
3068
|
+
"description": "iOS, v10 only, deprecated will be removed in next version - please use onRegionDidChange"
|
|
3086
3069
|
},
|
|
3087
3070
|
{
|
|
3088
3071
|
"name": "onWillStartLoadingMap",
|
|
@@ -5795,40 +5778,66 @@
|
|
|
5795
5778
|
]
|
|
5796
5779
|
},
|
|
5797
5780
|
"Terrain": {
|
|
5798
|
-
"description": "
|
|
5781
|
+
"description": "",
|
|
5799
5782
|
"displayName": "Terrain",
|
|
5800
|
-
"methods": [
|
|
5801
|
-
{
|
|
5802
|
-
"name": "baseProps",
|
|
5803
|
-
"docblock": null,
|
|
5804
|
-
"modifiers": [
|
|
5805
|
-
"get"
|
|
5806
|
-
],
|
|
5807
|
-
"params": [],
|
|
5808
|
-
"returns": null
|
|
5809
|
-
}
|
|
5810
|
-
],
|
|
5783
|
+
"methods": [],
|
|
5811
5784
|
"props": [
|
|
5812
5785
|
{
|
|
5813
5786
|
"name": "sourceID",
|
|
5814
|
-
"required":
|
|
5787
|
+
"required": true,
|
|
5815
5788
|
"type": "string",
|
|
5816
|
-
"default": "
|
|
5789
|
+
"default": "none",
|
|
5817
5790
|
"description": "Name of a source of raster_dem type to be used for terrain elevation."
|
|
5818
5791
|
},
|
|
5819
5792
|
{
|
|
5820
5793
|
"name": "exaggeration",
|
|
5821
5794
|
"required": false,
|
|
5822
|
-
"type": "
|
|
5795
|
+
"type": "Value",
|
|
5796
|
+
"default": "none",
|
|
5797
|
+
"description": "Deprecated, use exaggeration in style instead"
|
|
5798
|
+
},
|
|
5799
|
+
{
|
|
5800
|
+
"name": "style",
|
|
5801
|
+
"required": true,
|
|
5802
|
+
"type": "TerrainLayerStyleProps",
|
|
5823
5803
|
"default": "none",
|
|
5824
|
-
"description": "
|
|
5804
|
+
"description": "Customizable style attributes"
|
|
5825
5805
|
}
|
|
5826
5806
|
],
|
|
5827
|
-
"
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5807
|
+
"fileNameWithExt": "Terrain.tsx",
|
|
5808
|
+
"name": "Terrain",
|
|
5809
|
+
"styles": [
|
|
5810
|
+
{
|
|
5811
|
+
"name": "source",
|
|
5812
|
+
"type": "string",
|
|
5813
|
+
"values": [],
|
|
5814
|
+
"description": "Name of a source of `raster_dem` type to be used for terrain elevation.",
|
|
5815
|
+
"requires": [],
|
|
5816
|
+
"disabledBy": [],
|
|
5817
|
+
"allowedFunctionTypes": []
|
|
5818
|
+
},
|
|
5819
|
+
{
|
|
5820
|
+
"name": "exaggeration",
|
|
5821
|
+
"type": "number",
|
|
5822
|
+
"values": [],
|
|
5823
|
+
"minimum": 0,
|
|
5824
|
+
"maximum": 1000,
|
|
5825
|
+
"default": 1,
|
|
5826
|
+
"description": "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
|
|
5827
|
+
"requires": [
|
|
5828
|
+
"source"
|
|
5829
|
+
],
|
|
5830
|
+
"disabledBy": [],
|
|
5831
|
+
"allowedFunctionTypes": [],
|
|
5832
|
+
"expression": {
|
|
5833
|
+
"interpolated": true,
|
|
5834
|
+
"parameters": [
|
|
5835
|
+
"zoom"
|
|
5836
|
+
]
|
|
5837
|
+
},
|
|
5838
|
+
"transition": true
|
|
5839
|
+
}
|
|
5840
|
+
]
|
|
5832
5841
|
},
|
|
5833
5842
|
"UserLocation": {
|
|
5834
5843
|
"description": "",
|