@rnmapbox/maps 10.0.0-beta.41 → 10.0.0-beta.43
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/install.md +20 -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 +22 -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/HeadingIndicator.md +1 -1
- package/docs/MapView.md +2 -2
- package/docs/SymbolLayer.md +4 -3
- package/docs/Terrain.md +64 -9
- package/docs/docs.json +66 -53
- package/index.d.ts +13 -80
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +28 -26
- 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/AbstractLayer.tsx +72 -0
- package/javascript/components/BackgroundLayer.js +1 -1
- package/javascript/components/Camera.tsx +17 -1
- package/javascript/components/CircleLayer.js +1 -1
- package/javascript/components/FillExtrusionLayer.js +1 -1
- package/javascript/components/FillLayer.js +1 -1
- package/javascript/components/{HeadingIndicator.js → HeadingIndicator.tsx} +5 -6
- package/javascript/components/HeatmapLayer.js +1 -1
- package/javascript/components/LineLayer.js +1 -1
- package/javascript/components/MapView.js +8 -12
- package/javascript/components/RasterLayer.js +1 -1
- package/javascript/components/SkyLayer.js +1 -1
- package/javascript/components/SymbolLayer.tsx +113 -0
- package/javascript/components/Terrain.tsx +52 -0
- package/javascript/components/UserLocation.js +1 -1
- package/javascript/global.d.ts +4 -0
- package/javascript/index.js +8 -4
- package/javascript/types/index.ts +0 -14
- package/javascript/utils/MapboxStyles.ts +177 -52
- package/javascript/utils/StyleValue.ts +8 -6
- package/javascript/utils/deprecation.ts +39 -0
- package/javascript/utils/{filterUtils.js → filterUtils.tsx} +1 -1
- package/javascript/utils/styleMap.ts +26 -0
- package/package.json +6 -6
- package/scripts/autogenHelpers/DocJSONBuilder.js +2 -3
- package/scripts/autogenHelpers/globals.js +20 -7
- package/scripts/autogenerate.js +13 -0
- package/scripts/templates/MapboxStyles.ts.ejs +8 -3
- package/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +1 -0
- package/.eslintignore +0 -1
- package/javascript/components/AbstractLayer.js +0 -46
- package/javascript/components/SymbolLayer.js +0 -120
- 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: |
|
package/android/install.md
CHANGED
|
@@ -12,7 +12,7 @@ Add `RNMapboxMapsImpl = "mapbox"` to your gradle file - see bellow for details.
|
|
|
12
12
|
|
|
13
13
|
### Custom versions
|
|
14
14
|
|
|
15
|
-
*Warning*: If you set a
|
|
15
|
+
*Warning*: If you set a custom version, make sure you revisit, any time you update @rnmapbox/maps. Setting it to earlier version than what we exepect will likely result in a build error.
|
|
16
16
|
|
|
17
17
|
Overwrite mapbox dependencies within your `android/build.gradle > buildscript > ext` section
|
|
18
18
|
|
|
@@ -32,6 +32,7 @@ buildscript {
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
If you see `2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs` issue see [possible workaround](#workaround-for-2-files-found-with-path-libarm64-v8alibc_sharedso-from-inputs).
|
|
35
36
|
|
|
36
37
|
## Using MapLibre
|
|
37
38
|
|
|
@@ -138,4 +139,22 @@ Feel free to check out the `/example` projects [`android/build.gradle`](https://
|
|
|
138
139
|
<br>
|
|
139
140
|
|
|
140
141
|
|
|
142
|
+
### Workaround for 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
code android/app/build.gradle
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
add the following
|
|
149
|
+
```gradle
|
|
150
|
+
android {
|
|
151
|
+
packagingOptions {
|
|
152
|
+
pickFirst 'lib/x86/libc++_shared.so'
|
|
153
|
+
pickFirst 'lib/x86_64/libc++_shared.so'
|
|
154
|
+
pickFirst 'lib/arm64-v8a/libc++_shared.so'
|
|
155
|
+
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
141
160
|
|
|
@@ -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,29 @@ 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
|
}
|
|
320
|
+
mQueuedFeatures = null;
|
|
326
321
|
}
|
|
327
322
|
|
|
323
|
+
private fun addAllFeaturesToMap() {
|
|
324
|
+
mQueuedFeatures?.also {
|
|
325
|
+
this.addQueuedFeaturesToMap()
|
|
326
|
+
} ?: run {
|
|
327
|
+
mFeatures.forEach { it.addToMap(this) }
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
328
331
|
private val allTouchableSources: List<RCTSource<*>>
|
|
329
332
|
private get() {
|
|
330
333
|
val sources: MutableList<RCTSource<*>> = ArrayList()
|
|
@@ -380,19 +383,18 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
380
383
|
|
|
381
384
|
fun setReactStyleURL(styleURL: String) {
|
|
382
385
|
if (mMap != null) {
|
|
383
|
-
|
|
386
|
+
removeAllFeaturesFromMap()
|
|
384
387
|
if (isJSONValid(mStyleURL)) {
|
|
385
388
|
mMap.loadStyleJson(styleURL, object : Style.OnStyleLoaded {
|
|
386
389
|
override fun onStyleLoaded(style: Style) {
|
|
387
|
-
|
|
390
|
+
addAllFeaturesToMap()
|
|
388
391
|
}
|
|
389
392
|
})
|
|
390
393
|
} else {
|
|
391
394
|
mMap.loadStyleUri(styleURL, object : Style.OnStyleLoaded {
|
|
392
395
|
override fun onStyleLoaded(style: Style) {
|
|
393
396
|
savedStyle = style
|
|
394
|
-
|
|
395
|
-
addQueuedFeatures()
|
|
397
|
+
addAllFeaturesToMap()
|
|
396
398
|
}
|
|
397
399
|
},
|
|
398
400
|
object : OnMapLoadErrorListener {
|
|
@@ -606,17 +608,6 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
|
|
|
606
608
|
return GeoJSONUtils.toPointFeature(latLng, properties)
|
|
607
609
|
}
|
|
608
610
|
|
|
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
611
|
private fun setupLocalization(style: Style) {
|
|
621
612
|
/*
|
|
622
613
|
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/HeadingIndicator.md
CHANGED
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/SymbolLayer.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- This file was autogenerated from SymbolLayer.
|
|
1
|
+
<!-- This file was autogenerated from SymbolLayer.tsx do not modify -->
|
|
2
2
|
# <MapboxGL.SymbolLayer />
|
|
3
3
|
SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
|
|
4
4
|
|
|
@@ -11,10 +11,11 @@ SymbolLayer is a style layer that renders icon and text labels at points or alon
|
|
|
11
11
|
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
|
|
12
12
|
| belowLayerID | `string` | `none` | `false` | Inserts a layer below belowLayerID |
|
|
13
13
|
| layerIndex | `number` | `none` | `false` | Inserts a layer at a specified index |
|
|
14
|
-
| filter | `
|
|
14
|
+
| filter | `Array` | `none` | `false` | Filter only the features in the source layer that satisfy a condition that you define |
|
|
15
15
|
| minZoomLevel | `number` | `none` | `false` | The minimum zoom level at which the layer gets parsed and appears. |
|
|
16
16
|
| maxZoomLevel | `number` | `none` | `false` | The maximum zoom level at which the layer gets parsed and appears. |
|
|
17
|
-
| style | `
|
|
17
|
+
| style | `SymbolLayerStyleProps` | `none` | `true` | FIX ME NO DESCRIPTION |
|
|
18
|
+
| children | `JSX.Element \| JSX.Element[]` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
## styles
|
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
|
|