@rnmapbox/maps 10.0.0-beta.43 → 10.0.0-beta.44

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.
Files changed (33) hide show
  1. package/android/install.md +49 -1
  2. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/components/camera/CameraStop.java +4 -4
  3. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.java +3 -3
  4. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/modules/RCTMGLSnapshotModule.java +1 -1
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +6 -6
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/modules/RCTMGLSnapshotModule.java +1 -1
  7. package/docs/ShapeSource.md +13 -9
  8. package/docs/docs.json +29 -59
  9. package/index.d.ts +6 -56
  10. package/ios/RCTMGL-v10/RCTMGLCamera.swift +2 -2
  11. package/ios/install.md +3 -2
  12. package/javascript/components/AbstractLayer.tsx +3 -3
  13. package/javascript/components/AbstractSource.tsx +23 -0
  14. package/javascript/components/HeadingIndicator.tsx +1 -1
  15. package/javascript/components/Images.js +1 -1
  16. package/javascript/components/MapView.js +5 -2
  17. package/javascript/components/MarkerView.tsx +1 -0
  18. package/javascript/components/NativeBridgeComponent.tsx +20 -14
  19. package/javascript/components/PointAnnotation.tsx +2 -1
  20. package/javascript/components/RasterSource.js +1 -1
  21. package/javascript/components/ShapeSource.tsx +412 -0
  22. package/javascript/components/Style.js +2 -2
  23. package/javascript/components/SymbolLayer.tsx +1 -3
  24. package/javascript/components/VectorSource.js +6 -3
  25. package/javascript/components/annotations/Annotation.js +1 -1
  26. package/javascript/index.js +2 -2
  27. package/javascript/utils/animated/Animated.js +2 -2
  28. package/javascript/utils/deprecation.ts +7 -4
  29. package/javascript/utils/filterUtils.tsx +1 -1
  30. package/javascript/utils/index.d.ts +16 -3
  31. package/package.json +1 -1
  32. package/javascript/components/AbstractSource.js +0 -15
  33. package/javascript/components/ShapeSource.js +0 -373
@@ -10,7 +10,7 @@
10
10
 
11
11
  Add `RNMapboxMapsImpl = "mapbox"` to your gradle file - see bellow for details.
12
12
 
13
- ### Custom versions
13
+ ### Setting RNMapboxMapsImpl to v10
14
14
 
15
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
 
@@ -22,6 +22,53 @@ buildscript {
22
22
  ext {
23
23
  // ...
24
24
  RNMapboxMapsImpl = "mapbox" // required for v10
25
+ }
26
+ }
27
+ ```
28
+
29
+ ### Adding mapbox maven repo
30
+
31
+ You will need to authorize your download of the Maps SDK via a secret access token with the `DOWNLOADS:READ` scope.
32
+ This [guide](https://docs.mapbox.com/android/maps/guides/install/#configure-credentials) explains how to `Configure credentials` and `Configure your secret token`.
33
+
34
+ Then under section `allprojects/repositories` add your data:
35
+
36
+ ```groovy
37
+ // android/build.gradle
38
+
39
+ allprojects {
40
+ repositories {
41
+ // ...other repos
42
+ maven {
43
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
44
+ authentication {
45
+ basic(BasicAuthentication)
46
+ }
47
+ credentials {
48
+ // Do not change the username below.
49
+ // This should always be `mapbox` (not your username).
50
+ username = 'mapbox'
51
+ // Use the secret token you stored in gradle.properties as the password
52
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
53
+ }
54
+ }
55
+ // ...even more repos?
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### Using non default mapbox version
61
+
62
+ *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.
63
+
64
+ Set `RNMapboxMapsLibs` in `android/build.gradle > buildscript > ext` section
65
+
66
+
67
+ ```groovy
68
+ buildscript {
69
+ ext {
70
+ // ...
71
+ RNMapboxMapsImpl = "mapbox"
25
72
 
26
73
  RNMapboxMapsLibs = { // optional - only required if you want to customize it
27
74
  implementation 'com.mapbox.maps:android:10.6.0'
@@ -32,6 +79,7 @@ buildscript {
32
79
  ```
33
80
 
34
81
 
82
+
35
83
  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).
36
84
 
37
85
  ## Using MapLibre
@@ -162,10 +162,10 @@ public class CameraStop {
162
162
 
163
163
  // scale padding by pixel ratio
164
164
  DisplayMetrics metrics = context.getResources().getDisplayMetrics();
165
- paddingTop = Float.valueOf(paddingTop * metrics.scaledDensity).intValue();
166
- paddingRight = Float.valueOf(paddingRight * metrics.scaledDensity).intValue();
167
- paddingBottom = Float.valueOf(paddingBottom * metrics.scaledDensity).intValue();
168
- paddingLeft = Float.valueOf(paddingLeft * metrics.scaledDensity).intValue();
165
+ paddingTop = Float.valueOf(paddingTop * metrics.density).intValue();
166
+ paddingRight = Float.valueOf(paddingRight * metrics.density).intValue();
167
+ paddingBottom = Float.valueOf(paddingBottom * metrics.density).intValue();
168
+ paddingLeft = Float.valueOf(paddingLeft * metrics.density).intValue();
169
169
 
170
170
  stop.setPadding(
171
171
  paddingLeft,
@@ -326,9 +326,9 @@ public class RCTMGLMapView extends MapView implements OnMapReadyCallback, Mapbox
326
326
  int[] contentPadding = mMap.getPadding();
327
327
 
328
328
  int mapWidth = (int) ((mMap.getWidth() * 0.75 - (contentPadding[0] + contentPadding[2]))
329
- / metrics.scaledDensity);
329
+ / metrics.density);
330
330
  int mapHeight = (int) ((mMap.getHeight() * 0.75 - (contentPadding[1] + contentPadding[3]))
331
- / metrics.scaledDensity);
331
+ / metrics.density);
332
332
  VisibleRegion region = GeoViewport.getRegion(center, (int) zoomLevel, mapWidth, mapHeight);
333
333
  return region;
334
334
  }
@@ -1246,7 +1246,7 @@ public class RCTMGLMapView extends MapView implements OnMapReadyCallback, Mapbox
1246
1246
 
1247
1247
  final DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
1248
1248
 
1249
- double[] result = {left * metrics.scaledDensity, top * metrics.scaledDensity, right * metrics.scaledDensity, bottom * metrics.scaledDensity};
1249
+ double[] result = {left * metrics.density, top * metrics.density, right * metrics.density, bottom * metrics.density};
1250
1250
  return result;
1251
1251
  }
1252
1252
 
@@ -107,7 +107,7 @@ public class RCTMGLSnapshotModule extends ReactContextBaseJavaModule {
107
107
 
108
108
  options.withLogo(jsOptions.getBoolean("withLogo"));
109
109
  options.withStyle(jsOptions.getString("styleURL"));
110
- options.withPixelRatio(Float.valueOf(mContext.getResources().getDisplayMetrics().scaledDensity).intValue());
110
+ options.withPixelRatio(Float.valueOf(mContext.getResources().getDisplayMetrics().density).intValue());
111
111
 
112
112
  if (jsOptions.hasKey("bounds")) {
113
113
  FeatureCollection bounds = FeatureCollection.fromJson(jsOptions.getString("bounds"));
@@ -162,10 +162,10 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
162
162
  }
163
163
  if (readableMap.hasKey("bounds")) {
164
164
  val metrics = context.resources.displayMetrics
165
- var paddingTop = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingTop")
166
- var paddingRight = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingRight")
167
- var paddingBottom = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingBottom")
168
- var paddingLeft = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingLeft")
165
+ var paddingTop = getBoundsPaddingByKey(readableMap, metrics.density, "paddingTop")
166
+ var paddingRight = getBoundsPaddingByKey(readableMap, metrics.density, "paddingRight")
167
+ var paddingBottom = getBoundsPaddingByKey(readableMap, metrics.density, "paddingBottom")
168
+ var paddingLeft = getBoundsPaddingByKey(readableMap, metrics.density, "paddingLeft")
169
169
 
170
170
  val collection = FeatureCollection.fromJson(readableMap.getString("bounds")!!)
171
171
  stop.setBounds(
@@ -213,9 +213,9 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
213
213
  return intArrayOf(resultLeft, resultTop, resultRight, resultBottom)
214
214
  }
215
215
 
216
- private fun getBoundsPaddingByKey(map: ReadableMap, scaledDensity: Float, key: String): Int? {
216
+ private fun getBoundsPaddingByKey(map: ReadableMap, density: Float, key: String): Int? {
217
217
  if (map.hasKey(key)) {
218
- return (map.getInt(key) * scaledDensity).toInt()
218
+ return (map.getInt(key) * density).toInt()
219
219
  } else {
220
220
  return null;
221
221
  }
@@ -132,7 +132,7 @@ public class RCTMGLSnapshotModule extends ReactContextBaseJavaModule {
132
132
  (int) jsOptions.getDouble("height")
133
133
  )
134
134
  );
135
- builder.pixelRatio(Float.valueOf(mContext.getResources().getDisplayMetrics().scaledDensity).intValue());
135
+ builder.pixelRatio(Float.valueOf(mContext.getResources().getDisplayMetrics().density).intValue());
136
136
 
137
137
  builder.resourceOptions(new ResourceOptions.Builder().accessToken(RCTMGLModule.getAccessToken(mContext)).build());
138
138
  return builder.build();
@@ -1,4 +1,4 @@
1
- <!-- This file was autogenerated from ShapeSource.js do not modify -->
1
+ <!-- This file was autogenerated from ShapeSource.tsx do not modify -->
2
2
  # <MapboxGL.ShapeSource />
3
3
  ShapeSource is a map content source that supplies vector shapes to be shown on the map.
4
4
  The shape may be an url or a GeoJSON object
@@ -8,19 +8,23 @@ The shape may be an url or a GeoJSON object
8
8
  | ---- | :-- | :----- | :------ | :---------- |
9
9
  | id | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | A string that uniquely identifies the source. |
10
10
  | url | `string` | `none` | `false` | An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle. |
11
- | shape | `object` | `none` | `false` | The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature collection. |
12
- | cluster | `bool` | `none` | `false` | Enables clustering on the source for point shapes. |
11
+ | shape | `\| GeoJSON.GeometryCollection
12
+ \| GeoJSON.Feature
13
+ \| GeoJSON.FeatureCollection
14
+ \| GeoJSON.Geometry` | `none` | `false` | The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature collection. |
15
+ | cluster | `boolean` | `none` | `false` | Enables clustering on the source for point shapes. |
13
16
  | clusterRadius | `number` | `none` | `false` | Specifies the radius of each cluster if clustering is enabled.<br/>A value of 512 produces a radius equal to the width of a tile.<br/>The default value is 50. |
14
17
  | clusterMaxZoomLevel | `number` | `none` | `false` | Specifies the maximum zoom level at which to cluster points if clustering is enabled.<br/>Defaults to one zoom level less than the value of maxZoomLevel so that, at the maximum zoom level,<br/>the shapes are not clustered. |
15
18
  | clusterProperties | `object` | `none` | `false` | [`mapbox-gl` (v8) implementation only]<br/>Specifies custom properties on the generated clusters if clustering<br/>is enabled, aggregating values from clustered points.<br/><br/>Has the form `{ "property_name": [operator, map_expression]}`, where<br/> `operator` is a custom reduce expression that references a special `["accumulated"]` value -<br/> it accumulates the property value from clusters/points the cluster contains<br/> `map_expression` produces the value of a single point<br/><br/>Example: `{ "resultingSum": [["+", ["accumulated"], ["get", "resultingSum"]], ["get", "scalerank"]] }` |
16
19
  | maxZoomLevel | `number` | `none` | `false` | Specifies the maximum zoom level at which to create vector tiles.<br/>A greater value produces greater detail at high zoom levels.<br/>The default value is 18. |
17
20
  | buffer | `number` | `none` | `false` | Specifies the size of the tile buffer on each side.<br/>A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself.<br/>Larger values produce fewer rendering artifacts near tile edges and slower performance.<br/>The default value is 128. |
18
21
  | tolerance | `number` | `none` | `false` | Specifies the Douglas-Peucker simplification tolerance.<br/>A greater value produces simpler geometries and improves performance.<br/>The default value is 0.375. |
19
- | lineMetrics | `bool` | `none` | `false` | Whether to calculate line distance metrics.<br/>This is required for line layers that specify lineGradient values.<br/>The default value is false. |
20
- | onPress | `func` | `none` | `false` | Source press listener, gets called when a user presses one of the children layers only<br/>if that layer has a higher z-index than another source layers |
22
+ | lineMetrics | `boolean` | `none` | `false` | Whether to calculate line distance metrics.<br/>This is required for line layers that specify lineGradient values.<br/>The default value is false. |
23
+ | onPress | `func` | `none` | `false` | Source press listener, gets called when a user presses one of the children layers only<br/>if that layer has a higher z-index than another source layers<br/><br/>@param {Object} event<br/>@param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)<br/>@param {Object} event.coordinates - the coordinates of the click<br/>@param {Object} event.point - the point of the click<br/>@return void<br/>*signature:*`(event:{features: Array, coordinates: {latitude: number, longitude: number}, point: {x: number, y: number}}) => void` |
21
24
  | hitbox | `shape` | `none` | `false` | Overrides the default touch hitbox(44x44 pixels) for the source layers |
22
25
  | &nbsp;&nbsp;width | `number` | `none` | `true` | `width` of hitbox |
23
26
  | &nbsp;&nbsp;height | `number` | `none` | `true` | `height` of hitbox |
27
+ | children | `React.ReactElement \| React.ReactElement[]` | `none` | `true` | FIX ME NO DESCRIPTION |
24
28
 
25
29
  ## methods
26
30
  ### features([filter])
@@ -46,7 +50,7 @@ Returns the zoom needed to expand the cluster.
46
50
  #### arguments
47
51
  | Name | Type | Required | Description |
48
52
  | ---- | :--: | :------: | :----------: |
49
- | `feature` | `Feature` | `Yes` | The feature cluster to expand. |
53
+ | `feature` | `string \| GeoJSON.Feature` | `Yes` | The feature cluster to expand. |
50
54
 
51
55
 
52
56
 
@@ -62,7 +66,7 @@ Returns the FeatureCollection from the cluster.
62
66
  #### arguments
63
67
  | Name | Type | Required | Description |
64
68
  | ---- | :--: | :------: | :----------: |
65
- | `feature` | `Feature` | `Yes` | The feature cluster to expand. |
69
+ | `feature` | `number \| GeoJSON.Feature` | `Yes` | The feature cluster to expand. |
66
70
  | `limit` | `number` | `Yes` | The number of points to return. |
67
71
  | `offset` | `number` | `Yes` | The amount of points to skip (for pagination). |
68
72
 
@@ -80,7 +84,7 @@ Returns the FeatureCollection from the cluster (on the next zoom level).
80
84
  #### arguments
81
85
  | Name | Type | Required | Description |
82
86
  | ---- | :--: | :------: | :----------: |
83
- | `feature` | `Feature` | `Yes` | The feature cluster to expand. |
87
+ | `feature` | `number \| GeoJSON.Feature` | `Yes` | The feature cluster to expand. |
84
88
 
85
89
 
86
90
 
@@ -96,7 +100,7 @@ const collection = await shapeSource.getClusterChildren(clusterId);
96
100
  #### arguments
97
101
  | Name | Type | Required | Description |
98
102
  | ---- | :--: | :------: | :----------: |
99
- | `event` | `n/a` | `Yes` | undefined |
103
+ | `event` | `NativeSyntheticEvent` | `Yes` | undefined |
100
104
 
101
105
 
102
106
 
package/docs/docs.json CHANGED
@@ -3820,7 +3820,7 @@
3820
3820
  "name": "feature",
3821
3821
  "description": "The feature cluster to expand.",
3822
3822
  "type": {
3823
- "name": "Feature"
3823
+ "name": "string \\| GeoJSON.Feature"
3824
3824
  },
3825
3825
  "optional": false
3826
3826
  }
@@ -3828,7 +3828,13 @@
3828
3828
  "returns": {
3829
3829
  "description": null,
3830
3830
  "type": {
3831
- "name": "number"
3831
+ "name": "Promise",
3832
+ "elements": [
3833
+ {
3834
+ "name": "string"
3835
+ }
3836
+ ],
3837
+ "raw": "Promise<string>"
3832
3838
  }
3833
3839
  },
3834
3840
  "description": "Returns the zoom needed to expand the cluster.",
@@ -3838,7 +3844,7 @@
3838
3844
  },
3839
3845
  {
3840
3846
  "name": "getClusterLeaves",
3841
- "docblock": "Returns the FeatureCollection from the cluster.\n\n@example\nconst collection = await shapeSource.getClusterLeaves(clusterId, limit, offset);\n\n@param {Feature} feature - The feature cluster to expand.\n@param {number} limit - The number of points to return.\n@param {number} offset - The amount of points to skip (for pagination).\n@return {FeatureCollection}",
3847
+ "docblock": "Returns the FeatureCollection from the cluster.\n\n@example\nconst collection = await shapeSource.getClusterLeaves(clusterId, limit, offset);\n\n@param {GeoJSON.Feature} feature - The feature cluster to expand.\n@param {number} limit - The number of points to return.\n@param {number} offset - The amount of points to skip (for pagination).\n@return {FeatureCollection}",
3842
3848
  "modifiers": [
3843
3849
  "async"
3844
3850
  ],
@@ -3847,7 +3853,7 @@
3847
3853
  "name": "feature",
3848
3854
  "description": "The feature cluster to expand.",
3849
3855
  "type": {
3850
- "name": "Feature"
3856
+ "name": "number \\| GeoJSON.Feature"
3851
3857
  },
3852
3858
  "optional": false
3853
3859
  },
@@ -3881,7 +3887,7 @@
3881
3887
  },
3882
3888
  {
3883
3889
  "name": "getClusterChildren",
3884
- "docblock": "Returns the FeatureCollection from the cluster (on the next zoom level).\n\n@example\nconst collection = await shapeSource.getClusterChildren(clusterId);\n\n@param {Feature} feature - The feature cluster to expand.\n@return {FeatureCollection}",
3890
+ "docblock": "Returns the FeatureCollection from the cluster (on the next zoom level).\n\n@example\nconst collection = await shapeSource.getClusterChildren(clusterId);\n\n@param {GeoJSON.Feature} feature - The feature cluster to expand.\n@return {FeatureCollection}",
3885
3891
  "modifiers": [
3886
3892
  "async"
3887
3893
  ],
@@ -3890,7 +3896,7 @@
3890
3896
  "name": "feature",
3891
3897
  "description": "The feature cluster to expand.",
3892
3898
  "type": {
3893
- "name": "Feature"
3899
+ "name": "number \\| GeoJSON.Feature"
3894
3900
  },
3895
3901
  "optional": false
3896
3902
  }
@@ -3915,7 +3921,7 @@
3915
3921
  "name": "event",
3916
3922
  "optional": false,
3917
3923
  "type": {
3918
- "name": null
3924
+ "name": "NativeSyntheticEvent"
3919
3925
  }
3920
3926
  }
3921
3927
  ],
@@ -3940,14 +3946,14 @@
3940
3946
  {
3941
3947
  "name": "shape",
3942
3948
  "required": false,
3943
- "type": "object",
3949
+ "type": "\\| GeoJSON.GeometryCollection\n\\| GeoJSON.Feature\n\\| GeoJSON.FeatureCollection\n\\| GeoJSON.Geometry",
3944
3950
  "default": "none",
3945
3951
  "description": "The contents of the source. A shape can represent a GeoJSON geometry, a feature, or a feature collection."
3946
3952
  },
3947
3953
  {
3948
3954
  "name": "cluster",
3949
3955
  "required": false,
3950
- "type": "bool",
3956
+ "type": "boolean",
3951
3957
  "default": "none",
3952
3958
  "description": "Enables clustering on the source for point shapes."
3953
3959
  },
@@ -3996,59 +4002,19 @@
3996
4002
  {
3997
4003
  "name": "lineMetrics",
3998
4004
  "required": false,
3999
- "type": "bool",
4005
+ "type": "boolean",
4000
4006
  "default": "none",
4001
4007
  "description": "Whether to calculate line distance metrics.\nThis is required for line layers that specify lineGradient values.\nThe default value is false."
4002
4008
  },
4003
4009
  {
4004
4010
  "name": "onPress",
4005
4011
  "required": false,
4006
- "type": "func",
4012
+ "type": {
4013
+ "name": "func",
4014
+ "funcSignature": "(event:{features: Array, coordinates: {latitude: number, longitude: number}, point: {x: number, y: number}}) => void"
4015
+ },
4007
4016
  "default": "none",
4008
- "description": "Source press listener, gets called when a user presses one of the children layers only\nif that layer has a higher z-index than another source layers",
4009
- "params": [
4010
- {
4011
- "name": "event",
4012
- "description": null,
4013
- "type": {
4014
- "name": "Object"
4015
- },
4016
- "optional": false
4017
- },
4018
- {
4019
- "name": "event.features",
4020
- "description": "the geojson features that have hit by the press (might be multiple)",
4021
- "type": {
4022
- "name": "Array",
4023
- "elements": [
4024
- {
4025
- "name": "Object"
4026
- }
4027
- ]
4028
- },
4029
- "optional": false
4030
- },
4031
- {
4032
- "name": "event.coordinates",
4033
- "description": "the coordinates of the click",
4034
- "type": {
4035
- "name": "Object"
4036
- },
4037
- "optional": false
4038
- },
4039
- {
4040
- "name": "event.point",
4041
- "description": "the point of the click",
4042
- "type": {
4043
- "name": "Object"
4044
- },
4045
- "optional": false
4046
- }
4047
- ],
4048
- "returns": {
4049
- "description": "void",
4050
- "type": null
4051
- }
4017
+ "description": "Source press listener, gets called when a user presses one of the children layers only\nif that layer has a higher z-index than another source layers\n\n@param {Object} event\n@param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)\n@param {Object} event.coordinates - the coordinates of the click\n@param {Object} event.point - the point of the click\n@return void\n*signature:*`(event:{features: Array, coordinates: {latitude: number, longitude: number}, point: {x: number, y: number}}) => void`"
4052
4018
  },
4053
4019
  {
4054
4020
  "name": "hitbox",
@@ -4074,12 +4040,16 @@
4074
4040
  },
4075
4041
  "default": "none",
4076
4042
  "description": "Overrides the default touch hitbox(44x44 pixels) for the source layers"
4043
+ },
4044
+ {
4045
+ "name": "children",
4046
+ "required": true,
4047
+ "type": "React.ReactElement \\| React.ReactElement[]",
4048
+ "default": "none",
4049
+ "description": "FIX ME NO DESCRIPTION"
4077
4050
  }
4078
4051
  ],
4079
- "composes": [
4080
- "../utils"
4081
- ],
4082
- "fileNameWithExt": "ShapeSource.js",
4052
+ "fileNameWithExt": "ShapeSource.tsx",
4083
4053
  "name": "ShapeSource"
4084
4054
  },
4085
4055
  "SkyLayer": {
package/index.d.ts CHANGED
@@ -43,6 +43,10 @@ import {
43
43
  SymbolLayer as _SymbolLayer,
44
44
  Props as _SymbolLayerProps,
45
45
  } from './javascript/components/SymbolLayer';
46
+ import {
47
+ ShapeSource as _ShapeSource,
48
+ Props as _ShapeSourceProps,
49
+ } from './javascript/components/ShapeSource';
46
50
  import type {
47
51
  MapboxGLEvent as _MapboxGLEvent,
48
52
  AnimatedPoint as _AnimatedPoint,
@@ -148,6 +152,7 @@ declare namespace MapboxGL {
148
152
  const MarkerView = _MarkerView;
149
153
  const PointAnnotation = _PointAnnotation;
150
154
  const SymbolLayer = _SymbolLayer;
155
+ const ShapeSource = _ShapeSource;
151
156
 
152
157
  type MapboxGLEvent = _MapboxGLEvent;
153
158
  type UserTrackingMode = _UserTrackingMode;
@@ -244,7 +249,7 @@ declare namespace MapboxGL {
244
249
 
245
250
  namespace Animated {
246
251
  // sources
247
- class ShapeSource extends Component<ShapeSourceProps> {}
252
+ class ShapeSource extends Component<_ShapeSourceProps> {}
248
253
  class ImageSource extends Component<ImageSourceProps> {}
249
254
 
250
255
  // layers
@@ -364,33 +369,6 @@ declare namespace MapboxGL {
364
369
  * Sources
365
370
  */
366
371
  class VectorSource extends Component<VectorSourceProps> {}
367
- class ShapeSource extends Component<ShapeSourceProps> {
368
- features(
369
- filter?: Expression,
370
- ): Promise<FeatureCollection<Geometry, Properties>>;
371
-
372
- getClusterExpansionZoom(
373
- feature: Feature<Geometry, Properties> | number,
374
- ): Promise<number>;
375
- /**
376
- * Returns all the leaves of a cluster with pagination support.
377
- * @param cluster feature cluster
378
- * @param limit the number of leaves to return
379
- * @param offset the amount of points to skip (for pagination)
380
- */
381
- getClusterLeaves: (
382
- feature: Feature<Geometry, Properties> | number,
383
- limit: number,
384
- offset: number,
385
- ) => Promise<FeatureCollection<Geometry, Properties>>;
386
- /**
387
- * Returns the children of a cluster (on the next zoom level).
388
- * @param cluster feature cluster
389
- */
390
- getClusterChildren: (
391
- feature: Feature<Geometry, Properties> | number,
392
- ) => Promise<FeatureCollection<Geometry, Properties>>;
393
- }
394
372
  class RasterSource extends Component<RasterSourceProps> {}
395
373
  class RasterDemSource extends Component<RasterSourceProps> {}
396
374
 
@@ -810,30 +788,6 @@ export interface VectorSourceProps extends TileSourceProps {
810
788
  };
811
789
  }
812
790
 
813
- export interface ShapeSourceProps extends ViewProps {
814
- id: string;
815
- url?: string;
816
- shape?:
817
- | GeoJSON.GeometryCollection
818
- | GeoJSON.Feature
819
- | GeoJSON.FeatureCollection
820
- | GeoJSON.Geometry;
821
- cluster?: boolean;
822
- clusterRadius?: number;
823
- clusterMaxZoomLevel?: number;
824
- clusterProperties?: object;
825
- maxZoomLevel?: number;
826
- buffer?: number;
827
- tolerance?: number;
828
- lineMetrics?: boolean;
829
- images?: { assets?: string[] } & { [key: string]: ImageSourcePropType };
830
- onPress?: (event: OnPressEvent) => void;
831
- hitbox?: {
832
- width: number;
833
- height: number;
834
- };
835
- }
836
-
837
791
  export interface RasterSourceProps extends TileSourceProps {
838
792
  tileSize?: number;
839
793
  }
@@ -875,10 +829,6 @@ export interface RasterLayerProps extends LayerBaseProps {
875
829
  style?: StyleProp<RasterLayerStyle>;
876
830
  }
877
831
 
878
- export interface SymbolLayerProps extends LayerBaseProps {
879
- style?: SymbolLayerStyleProps;
880
- }
881
-
882
832
  export interface HeatmapLayerProps extends LayerBaseProps {
883
833
  style?: StyleProp<HeatmapLayerStyle>;
884
834
  }
@@ -14,7 +14,7 @@ enum CameraMode: String, CaseIterable {
14
14
  }
15
15
 
16
16
  enum UserTrackingMode: String {
17
- case none,compass, course, normal
17
+ case none, compass, course, normal
18
18
  }
19
19
 
20
20
  struct CameraUpdateItem {
@@ -188,7 +188,7 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
188
188
 
189
189
  func _updateCameraFromTrackingMode() {
190
190
  withMapView { map in
191
- let userTrackingMode = UserTrackingMode(rawValue: self.followUserMode ?? "none")
191
+ let userTrackingMode = UserTrackingMode(rawValue: self.followUserMode ?? UserTrackingMode.normal.rawValue)
192
192
  guard let userTrackingMode = userTrackingMode else {
193
193
  Logger.error("RCTMGLCamera: Unexpected followUserMode \(optional: self.followUserMode)")
194
194
  self._disableUsetTracking(map)
package/ios/install.md CHANGED
@@ -56,10 +56,11 @@ Add the following to the beginning of your podfile
56
56
  $RNMapboxMapsImpl = 'mapbox'
57
57
  ```
58
58
 
59
- You can also specify the version to use. *Warning:* if you set a version, then later update, the `rnamapbox/maps` library it's possible that you'll end up using Mapbox older version than supported. Make sure you revise this value with `rnmapbox/maps` updates.
59
+ You can also override the version to use. *Warning:* if you set a version, then later update, the `rnamapbox/maps` library it's possible that you'll end up using Mapbox older version than supported. Make sure you revise this value with `rnmapbox/maps` updates.
60
60
 
61
61
  ```ruby
62
- $RNMapboxMapsVersion = '~> 10.9.0'
62
+ # Warning: only for advanced use cases, only do this if you know what you're doing.
63
+ # $RNMapboxMapsVersion = '~> 10.9.0'
63
64
  ```
64
65
 
65
66
  You will need to authorize your download of the Maps SDK with a secret access token with the `DOWNLOADS:READ` scope. This [guide](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials) explains how to configure the secret token under section `Configure your secret token`.
@@ -42,11 +42,11 @@ class AbstractLayer<
42
42
  | (React.Component<NativePropsType> & Readonly<NativeMethods>)
43
43
  | undefined = undefined;
44
44
 
45
- setNativeLayer(
45
+ setNativeLayer = (
46
46
  instance: React.Component<NativePropsType> & Readonly<NativeMethods>,
47
- ) {
47
+ ) => {
48
48
  this.nativeLayer = instance;
49
- }
49
+ };
50
50
 
51
51
  getStyleTypeFormatter(styleType: string) {
52
52
  if (styleType === 'color') {
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { NativeMethods } from 'react-native';
3
+
4
+ class AbstractSource<
5
+ PropsType,
6
+ NativePropsType extends object,
7
+ > extends React.PureComponent<PropsType> {
8
+ _nativeRef?: React.Component<NativePropsType> & Readonly<NativeMethods>;
9
+
10
+ setNativeProps(props: NativePropsType) {
11
+ if (this._nativeRef) {
12
+ this._nativeRef.setNativeProps(props);
13
+ }
14
+ }
15
+
16
+ setNativeRef: (
17
+ instance: React.Component<NativePropsType> & Readonly<NativeMethods>,
18
+ ) => void = (instance) => {
19
+ this._nativeRef = instance;
20
+ };
21
+ }
22
+
23
+ export default AbstractSource;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import headingIcon from '../../assets/heading.png';
4
4
 
5
- import SymbolLayer from './SymbolLayer';
5
+ import { SymbolLayer } from './SymbolLayer';
6
6
 
7
7
  const style = {
8
8
  iconImage: headingIcon,
@@ -4,7 +4,7 @@ import { requireNativeComponent, Image } from 'react-native';
4
4
 
5
5
  import { viewPropTypes } from '../utils';
6
6
 
7
- import ShapeSource from './ShapeSource';
7
+ import { ShapeSource } from './ShapeSource';
8
8
 
9
9
  export const NATIVE_MODULE_NAME = 'RCTMGLImages';
10
10
 
@@ -42,7 +42,10 @@ const defaultStyleURL = MapboxGL.StyleURL.Street;
42
42
  /**
43
43
  * MapView backed by Mapbox Native GL
44
44
  */
45
- class MapView extends NativeBridgeComponent(React.Component) {
45
+ class MapView extends NativeBridgeComponent(
46
+ React.Component,
47
+ NATIVE_MODULE_NAME,
48
+ ) {
46
49
  static propTypes = {
47
50
  ...viewPropTypes,
48
51
 
@@ -306,7 +309,7 @@ class MapView extends NativeBridgeComponent(React.Component) {
306
309
  };
307
310
 
308
311
  constructor(props) {
309
- super(props, NATIVE_MODULE_NAME);
312
+ super(props);
310
313
 
311
314
  this.logger = Logger.sharedInstance();
312
315
  this.logger.start();
@@ -97,6 +97,7 @@ class MarkerView extends React.PureComponent<{
97
97
  <RCTMGLMarkerViewWrapper
98
98
  style={{
99
99
  alignSelf: 'flex-start',
100
+ position: 'absolute',
100
101
  }}
101
102
  >
102
103
  {child}