@maplibre/maplibre-react-native 10.0.0-alpha.8 → 10.0.0-alpha.9
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/Camera.md +1 -1
- package/docs/MapView.md +9 -9
- package/docs/MarkerView.md +1 -1
- package/docs/NativeUserLocation.md +1 -1
- package/docs/PointAnnotation.md +2 -2
- package/docs/UserLocation.md +2 -2
- package/docs/docs.json +12 -12
- package/javascript/@types/assets.d.ts +1 -1
- package/javascript/MLNModule.ts +2 -2
- package/javascript/Maplibre.ts +37 -42
- package/javascript/components/BackgroundLayer.tsx +9 -9
- package/javascript/components/Callout.tsx +19 -19
- package/javascript/components/Camera.tsx +29 -29
- package/javascript/components/CircleLayer.tsx +9 -9
- package/javascript/components/FillExtrusionLayer.tsx +9 -9
- package/javascript/components/FillLayer.tsx +9 -9
- package/javascript/components/HeadingIndicator.tsx +7 -8
- package/javascript/components/HeatmapLayer.tsx +10 -10
- package/javascript/components/ImageSource.tsx +8 -8
- package/javascript/components/Images.tsx +19 -20
- package/javascript/components/Light.tsx +15 -15
- package/javascript/components/LineLayer.tsx +9 -9
- package/javascript/components/MapView.tsx +74 -70
- package/javascript/components/MarkerView.tsx +9 -10
- package/javascript/components/NativeUserLocation.tsx +4 -4
- package/javascript/components/PointAnnotation.tsx +17 -17
- package/javascript/components/RasterLayer.tsx +9 -9
- package/javascript/components/RasterSource.tsx +10 -10
- package/javascript/components/ShapeSource.tsx +63 -61
- package/javascript/components/Style.tsx +69 -59
- package/javascript/components/SymbolLayer.tsx +10 -10
- package/javascript/components/UserLocation.tsx +23 -23
- package/javascript/components/VectorSource.tsx +19 -19
- package/javascript/components/annotations/Annotation.tsx +16 -15
- package/javascript/hooks/useAbstractLayer.ts +15 -12
- package/javascript/hooks/useAbstractSource.ts +2 -2
- package/javascript/hooks/useNativeBridge.ts +7 -7
- package/javascript/hooks/useNativeRef.ts +2 -2
- package/javascript/hooks/useOnce.ts +1 -1
- package/javascript/index.ts +2 -2
- package/javascript/modules/location/locationManager.ts +4 -4
- package/javascript/modules/offline/OfflineCreatePackOptions.ts +5 -5
- package/javascript/modules/offline/OfflinePack.ts +3 -3
- package/javascript/modules/offline/offlineManager.ts +11 -12
- package/javascript/modules/snapshot/SnapshotOptions.ts +4 -4
- package/javascript/modules/snapshot/snapshotManager.ts +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +3 -3
- package/javascript/types/OnPressEvent.ts +1 -1
- package/javascript/types/index.ts +6 -2
- package/javascript/utils/BridgeValue.ts +20 -20
- package/javascript/utils/Logger.ts +14 -14
- package/javascript/utils/MaplibreStyles.d.ts +359 -359
- package/javascript/utils/StyleValue.ts +12 -12
- package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +6 -6
- package/javascript/utils/animated/Animated.ts +38 -16
- package/javascript/utils/animated/AnimatedCoordinatesArray.ts +7 -11
- package/javascript/utils/animated/AnimatedExtractCoordinateFromArray.ts +3 -3
- package/javascript/utils/animated/AnimatedPoint.ts +7 -7
- package/javascript/utils/animated/AnimatedRouteCoordinatesArray.ts +16 -20
- package/javascript/utils/animated/AnimatedShape.ts +15 -15
- package/javascript/utils/deprecation.ts +6 -3
- package/javascript/utils/filterUtils.ts +1 -1
- package/javascript/utils/geoUtils.ts +8 -8
- package/javascript/utils/index.ts +14 -14
- package/javascript/utils/styleMap.ts +18 -18
- package/package.json +28 -15
- package/plugin/build/withMapLibre.d.ts +2 -2
- package/plugin/build/withMapLibre.js +24 -24
- package/scripts/autogenerate.js +1 -1
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -169
- package/.prettierrc.js +0 -7
- package/.yarn/sdks/eslint/bin/eslint.js +0 -27
- package/.yarn/sdks/eslint/lib/api.js +0 -27
- package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -27
- package/.yarn/sdks/eslint/package.json +0 -14
- package/.yarn/sdks/integrations.yml +0 -5
- package/.yarn/sdks/prettier/bin/prettier.cjs +0 -27
- package/.yarn/sdks/prettier/index.cjs +0 -27
- package/.yarn/sdks/prettier/package.json +0 -7
- package/.yarn/sdks/typescript/bin/tsc +0 -27
- package/.yarn/sdks/typescript/bin/tsserver +0 -27
- package/.yarn/sdks/typescript/lib/tsc.js +0 -27
- package/.yarn/sdks/typescript/lib/tsserver.js +0 -239
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -239
- package/.yarn/sdks/typescript/lib/typescript.js +0 -27
- package/.yarn/sdks/typescript/package.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
```
|
|
4
4
|
Please add unreleased changes in the following style:
|
|
5
5
|
PR Title ([#123](link to my pr))
|
|
6
|
+
|
|
6
7
|
```
|
|
7
8
|
|
|
9
|
+
## 10.0.0-alpha.9
|
|
10
|
+
|
|
11
|
+
fix: [fix: yarn, eslint and prettier implementation #419](https://github.com/maplibre/maplibre-react-native/pull/419)
|
|
12
|
+
fix: [typescript errors and add typescript:check to Github CI (#418)](https://github.com/maplibre/maplibre-react-native/pull/418)
|
|
13
|
+
|
|
8
14
|
## 10.0.0-alpha.8
|
|
9
15
|
feat: [Updated Android SDK from 10.2.0 to 11.0.1 #412](https://github.com/maplibre/maplibre-react-native/pull/412)
|
|
10
16
|
|
package/README.md
CHANGED
|
@@ -83,4 +83,4 @@ set up your local dev environment.
|
|
|
83
83
|
|
|
84
84
|
## Community
|
|
85
85
|
|
|
86
|
-
Join the #maplibre-native Slack
|
|
86
|
+
Join the #maplibre-react-native or #maplibre Slack channels at OSMUS: get an invite at https://slack.openstreetmap.us/
|
package/docs/Camera.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| zoomLevel | `number` | `none` | `false` | The zoom level of the map. |
|
|
13
13
|
| padding | `CameraPadding` | `none` | `false` | The viewport padding in points. |
|
|
14
14
|
| animationDuration | `number` | `2000` | `false` | The duration the map takes to animate to a new configuration. |
|
|
15
|
-
| animationMode | `
|
|
15
|
+
| animationMode | `"flyTo" \| "easeTo" \| "linearTo" \| "moveTo"` | `"easeTo"` | `false` | The easing or path the camera uses to animate to a new configuration. |
|
|
16
16
|
| allowUpdates | `boolean` | `true` | `false` | If false, the camera will not send any props to the native module. Intended to be used to prevent unnecessary tile fetching and improve performance when the map is not visible. Defaults to true. |
|
|
17
17
|
| defaultSettings | `CameraStop` | `none` | `false` | Default view settings applied on camera |
|
|
18
18
|
| minZoomLevel | `number` | `none` | `false` | The minimun zoom level of the map |
|
package/docs/MapView.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| contentInset | `number[] \| number` | `none` | `false` | The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. |
|
|
9
|
-
| style | `ViewProps[
|
|
9
|
+
| style | `ViewProps["style"]` | `none` | `false` | Style for wrapping React Native View |
|
|
10
10
|
| styleURL | `string` | `none` | `false` | Style URL for map - notice, if non is set it _will_ default to `MapLibreGL.StyleURL.Default` |
|
|
11
11
|
| styleJSON | `string` | `none` | `false` | StyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec |
|
|
12
12
|
| preferredFramesPerSecond | `number` | `none` | `false` | iOS: The preferred frame rate at which the map view is rendered.<br/>The default value for this property is MLNMapViewPreferredFramesPerSecondDefault,<br/>which will adaptively set the preferred frame rate based on the capability of<br/>the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.<br/><br/>Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.<br/>This property can be set to arbitrary integer values. |
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
| pitchEnabled | `boolean` | `true` | `false` | Enable/Disable pitch on map |
|
|
17
17
|
| rotateEnabled | `boolean` | `true` | `false` | Enable/Disable rotation on map |
|
|
18
18
|
| attributionEnabled | `boolean` | `true` | `false` | Enable/Disable attribution on map.<br/><br/>This must be enabled for Mapbox-hosted tiles and styles. Please refer to the Mapbox Terms of Service.<br/>Other providers do not require this. |
|
|
19
|
-
| attributionPosition | `\| {top?: number; left?: number}
|
|
20
|
-
\| {top?: number; right?: number}
|
|
21
|
-
\| {bottom?: number; left?: number}
|
|
22
|
-
\| {bottom?: number; right?: number}` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
|
|
19
|
+
| attributionPosition | `\| { top?: number; left?: number }
|
|
20
|
+
\| { top?: number; right?: number }
|
|
21
|
+
\| { bottom?: number; left?: number }
|
|
22
|
+
\| { bottom?: number; right?: number }` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
|
|
23
23
|
| tintColor | `string \| unknown[]` | `none` | `false` | MapView's tintColor |
|
|
24
24
|
| logoEnabled | `boolean` | `false` | `false` | Enable/Disable the logo on the map. |
|
|
25
|
-
| logoPosition | `\| {top?: number; left?: number}
|
|
26
|
-
\| {top?: number; right?: number}
|
|
27
|
-
\| {bottom?: number; left?: number}
|
|
28
|
-
\| {bottom?: number; right?: number}` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
|
|
25
|
+
| logoPosition | `\| { top?: number; left?: number }
|
|
26
|
+
\| { top?: number; right?: number }
|
|
27
|
+
\| { bottom?: number; left?: number }
|
|
28
|
+
\| { bottom?: number; right?: number }` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
|
|
29
29
|
| compassEnabled | `boolean` | `none` | `false` | Enable/Disable the compass from appearing on the map |
|
|
30
30
|
| compassViewPosition | `number` | `none` | `false` | Change corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight |
|
|
31
31
|
| compassViewMargins | `object` | `none` | `false` | Add margins to the compass with x and y values |
|
package/docs/MarkerView.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| coordinate | `Array` | `none` | `true` | The center point (specified as a map coordinate) of the marker.<br/>See also #anchor. |
|
|
9
|
-
| anchor | `shape` | `{x: 0.5, y: 0.5}` | `false` | Specifies the anchor being set on a particular point of the annotation.<br/>The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],<br/>where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.<br/>Note this is only for custom annotations not the default pin view.<br/>Defaults to the center of the view. |
|
|
9
|
+
| anchor | `shape` | `{ x: 0.5, y: 0.5 }` | `false` | Specifies the anchor being set on a particular point of the annotation.<br/>The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],<br/>where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.<br/>Note this is only for custom annotations not the default pin view.<br/>Defaults to the center of the view. |
|
|
10
10
|
| x | `number` | `none` | `true` | `x` of anchor |
|
|
11
11
|
| y | `number` | `none` | `true` | `y` of anchor |
|
|
12
12
|
| allowOverlap | `boolean` | `false` | `false` | FIX ME NO DESCRIPTION |
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
|
-
| androidRenderMode | `
|
|
8
|
+
| androidRenderMode | `"normal" \| "compass" \| "gps"` | `none` | `false` | Android render mode.<br/><br/> - normal: just a circle<br/> - compass: triangle with heading<br/> - gps: large arrow<br/><br/>@platform android |
|
|
9
9
|
| iosShowsUserHeadingIndicator | `boolean` | `none` | `false` | iOS only. A Boolean value indicating whether the user location annotation may display a permanent heading indicator.<br/><br/>@platform ios |
|
|
10
10
|
|
|
11
11
|
|
package/docs/PointAnnotation.md
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
| selected | `boolean` | `none` | `false` | Manually selects/deselects annotation<br/>@type {[type]} |
|
|
12
12
|
| draggable | `boolean` | `false` | `false` | Enable or disable dragging. Defaults to false. |
|
|
13
13
|
| coordinate | `Array` | `none` | `true` | The center point (specified as a map coordinate) of the annotation. |
|
|
14
|
-
| anchor | `shape` | `{x: 0.5, y: 0.5}` | `false` | Specifies the anchor being set on a particular point of the annotation.<br/>The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],<br/>where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.<br/>Note this is only for custom annotations not the default pin view.<br/>Defaults to the center of the view. |
|
|
14
|
+
| anchor | `shape` | `{ x: 0.5, y: 0.5 }` | `false` | Specifies the anchor being set on a particular point of the annotation.<br/>The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],<br/>where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.<br/>Note this is only for custom annotations not the default pin view.<br/>Defaults to the center of the view. |
|
|
15
15
|
| x | `number` | `none` | `true` | See anchor |
|
|
16
16
|
| y | `number` | `none` | `true` | See anchor |
|
|
17
17
|
| children | `React.ReactElement \| [React.ReactElement, React.ReactElement]` | `none` | `true` | Expects one child, and an optional callout can be added as well |
|
|
18
|
-
| style | `ViewProps[
|
|
18
|
+
| style | `ViewProps["style"]` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
19
19
|
|
|
20
20
|
### methods
|
|
21
21
|
#### refresh()
|
package/docs/UserLocation.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| animated | `boolean` | `true` | `false` | Whether location icon is animated between updates |
|
|
9
|
-
| renderMode | `
|
|
10
|
-
| androidRenderMode | `
|
|
9
|
+
| renderMode | `"normal" \| "native"` | `"normal"` | `false` | Which render mode to use.<br/>Can either be `normal` or `native` |
|
|
10
|
+
| androidRenderMode | `"normal" \| "compass" \| "gps"` | `none` | `false` | native/android only render mode<br/><br/> - normal: just a circle<br/> - compass: triangle with heading<br/> - gps: large arrow<br/><br/>@platform android |
|
|
11
11
|
| visible | `boolean` | `true` | `false` | Whether location icon is visible |
|
|
12
12
|
| showsUserHeadingIndicator | `boolean` | `false` | `false` | Show or hide small arrow which indicates direction the device is pointing relative to north. |
|
|
13
13
|
| minDisplacement | `number` | `0` | `false` | Minimum amount of movement before GPS location is updated in meters |
|
package/docs/docs.json
CHANGED
|
@@ -477,8 +477,8 @@
|
|
|
477
477
|
{
|
|
478
478
|
"name": "animationMode",
|
|
479
479
|
"required": false,
|
|
480
|
-
"type": "
|
|
481
|
-
"default": "
|
|
480
|
+
"type": "\"flyTo\" \\| \"easeTo\" \\| \"linearTo\" \\| \"moveTo\"",
|
|
481
|
+
"default": "\"easeTo\"",
|
|
482
482
|
"description": "The easing or path the camera uses to animate to a new configuration."
|
|
483
483
|
},
|
|
484
484
|
{
|
|
@@ -2415,7 +2415,7 @@
|
|
|
2415
2415
|
{
|
|
2416
2416
|
"name": "style",
|
|
2417
2417
|
"required": false,
|
|
2418
|
-
"type": "ViewProps[
|
|
2418
|
+
"type": "ViewProps[\"style\"]",
|
|
2419
2419
|
"default": "none",
|
|
2420
2420
|
"description": "Style for wrapping React Native View"
|
|
2421
2421
|
},
|
|
@@ -2485,7 +2485,7 @@
|
|
|
2485
2485
|
{
|
|
2486
2486
|
"name": "attributionPosition",
|
|
2487
2487
|
"required": false,
|
|
2488
|
-
"type": "\\| {top?: number; left?: number}\n\\| {top?: number; right?: number}\n\\| {bottom?: number; left?: number}\n\\| {bottom?: number; right?: number}",
|
|
2488
|
+
"type": "\\| { top?: number; left?: number }\n\\| { top?: number; right?: number }\n\\| { bottom?: number; left?: number }\n\\| { bottom?: number; right?: number }",
|
|
2489
2489
|
"default": "none",
|
|
2490
2490
|
"description": "Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map"
|
|
2491
2491
|
},
|
|
@@ -2506,7 +2506,7 @@
|
|
|
2506
2506
|
{
|
|
2507
2507
|
"name": "logoPosition",
|
|
2508
2508
|
"required": false,
|
|
2509
|
-
"type": "\\| {top?: number; left?: number}\n\\| {top?: number; right?: number}\n\\| {bottom?: number; left?: number}\n\\| {bottom?: number; right?: number}",
|
|
2509
|
+
"type": "\\| { top?: number; left?: number }\n\\| { top?: number; right?: number }\n\\| { bottom?: number; left?: number }\n\\| { bottom?: number; right?: number }",
|
|
2510
2510
|
"default": "none",
|
|
2511
2511
|
"description": "Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map"
|
|
2512
2512
|
},
|
|
@@ -2610,7 +2610,7 @@
|
|
|
2610
2610
|
}
|
|
2611
2611
|
]
|
|
2612
2612
|
},
|
|
2613
|
-
"default": "{x: 0.5, y: 0.5}",
|
|
2613
|
+
"default": "{ x: 0.5, y: 0.5 }",
|
|
2614
2614
|
"description": "Specifies the anchor being set on a particular point of the annotation.\nThe anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],\nwhere (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.\nNote this is only for custom annotations not the default pin view.\nDefaults to the center of the view."
|
|
2615
2615
|
},
|
|
2616
2616
|
{
|
|
@@ -2649,7 +2649,7 @@
|
|
|
2649
2649
|
{
|
|
2650
2650
|
"name": "androidRenderMode",
|
|
2651
2651
|
"required": false,
|
|
2652
|
-
"type": "
|
|
2652
|
+
"type": "\"normal\" \\| \"compass\" \\| \"gps\"",
|
|
2653
2653
|
"default": "none",
|
|
2654
2654
|
"description": "Android render mode.\n\n - normal: just a circle\n - compass: triangle with heading\n - gps: large arrow\n\n@platform android"
|
|
2655
2655
|
},
|
|
@@ -2747,7 +2747,7 @@
|
|
|
2747
2747
|
}
|
|
2748
2748
|
]
|
|
2749
2749
|
},
|
|
2750
|
-
"default": "{x: 0.5, y: 0.5}",
|
|
2750
|
+
"default": "{ x: 0.5, y: 0.5 }",
|
|
2751
2751
|
"description": "Specifies the anchor being set on a particular point of the annotation.\nThe anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],\nwhere (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.\nNote this is only for custom annotations not the default pin view.\nDefaults to the center of the view."
|
|
2752
2752
|
},
|
|
2753
2753
|
{
|
|
@@ -2760,7 +2760,7 @@
|
|
|
2760
2760
|
{
|
|
2761
2761
|
"name": "style",
|
|
2762
2762
|
"required": false,
|
|
2763
|
-
"type": "ViewProps[
|
|
2763
|
+
"type": "ViewProps[\"style\"]",
|
|
2764
2764
|
"default": "none",
|
|
2765
2765
|
"description": "FIX ME NO DESCRIPTION"
|
|
2766
2766
|
}
|
|
@@ -4811,14 +4811,14 @@
|
|
|
4811
4811
|
{
|
|
4812
4812
|
"name": "renderMode",
|
|
4813
4813
|
"required": false,
|
|
4814
|
-
"type": "
|
|
4815
|
-
"default": "
|
|
4814
|
+
"type": "\"normal\" \\| \"native\"",
|
|
4815
|
+
"default": "\"normal\"",
|
|
4816
4816
|
"description": "Which render mode to use.\nCan either be `normal` or `native`"
|
|
4817
4817
|
},
|
|
4818
4818
|
{
|
|
4819
4819
|
"name": "androidRenderMode",
|
|
4820
4820
|
"required": false,
|
|
4821
|
-
"type": "
|
|
4821
|
+
"type": "\"normal\" \\| \"compass\" \\| \"gps\"",
|
|
4822
4822
|
"default": "none",
|
|
4823
4823
|
"description": "native/android only render mode\n\n - normal: just a circle\n - compass: triangle with heading\n - gps: large arrow\n\n@platform android"
|
|
4824
4824
|
},
|
package/javascript/MLNModule.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {NativeModules} from
|
|
1
|
+
import { NativeModules } from "react-native";
|
|
2
2
|
|
|
3
3
|
interface IMLNModule {
|
|
4
4
|
StyleURL: {
|
|
@@ -24,7 +24,7 @@ interface IMLNModule {
|
|
|
24
24
|
setConnected(connected: boolean): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const MLNModule: IMLNModule = {...NativeModules.MLNModule};
|
|
27
|
+
const MLNModule: IMLNModule = { ...NativeModules.MLNModule };
|
|
28
28
|
|
|
29
29
|
export const {
|
|
30
30
|
StyleURL,
|
package/javascript/Maplibre.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { UserTrackingMode } from "./components/Camera";
|
|
2
|
+
|
|
3
|
+
export * from "./MLNModule";
|
|
2
4
|
export {
|
|
3
5
|
default as Camera,
|
|
4
6
|
UserTrackingMode,
|
|
@@ -6,45 +8,45 @@ export {
|
|
|
6
8
|
type CameraAnimationMode,
|
|
7
9
|
type CameraBounds,
|
|
8
10
|
type CameraRef,
|
|
9
|
-
} from
|
|
10
|
-
export {default as MapView, type MapViewRef} from
|
|
11
|
-
export {default as Light} from
|
|
12
|
-
export {default as PointAnnotation} from
|
|
13
|
-
export type {PointAnnotationRef} from
|
|
14
|
-
export {default as Annotation} from
|
|
15
|
-
export {default as Callout} from
|
|
16
|
-
export {requestAndroidLocationPermissions} from
|
|
11
|
+
} from "./components/Camera";
|
|
12
|
+
export { default as MapView, type MapViewRef } from "./components/MapView";
|
|
13
|
+
export { default as Light } from "./components/Light";
|
|
14
|
+
export { default as PointAnnotation } from "./components/PointAnnotation";
|
|
15
|
+
export type { PointAnnotationRef } from "./components/PointAnnotation";
|
|
16
|
+
export { default as Annotation } from "./components/annotations/Annotation";
|
|
17
|
+
export { default as Callout } from "./components/Callout";
|
|
18
|
+
export { requestAndroidLocationPermissions } from "./requestAndroidLocationPermissions";
|
|
17
19
|
export {
|
|
18
20
|
default as UserLocation,
|
|
19
21
|
UserLocationRenderMode,
|
|
20
|
-
} from
|
|
21
|
-
export type {UserLocationRef} from
|
|
22
|
-
export {default as VectorSource} from
|
|
23
|
-
export {default as ShapeSource} from
|
|
24
|
-
export type {ShapeSourceRef} from
|
|
25
|
-
export {default as RasterSource} from
|
|
26
|
-
export {default as ImageSource} from
|
|
27
|
-
export {default as Images} from
|
|
28
|
-
export {default as FillLayer} from
|
|
29
|
-
export {default as FillExtrusionLayer} from
|
|
30
|
-
export {default as HeatmapLayer} from
|
|
31
|
-
export {default as LineLayer} from
|
|
32
|
-
export {default as CircleLayer} from
|
|
33
|
-
export {default as SymbolLayer} from
|
|
34
|
-
export {default as RasterLayer} from
|
|
35
|
-
export {default as BackgroundLayer} from
|
|
22
|
+
} from "./components/UserLocation";
|
|
23
|
+
export type { UserLocationRef } from "./components/UserLocation";
|
|
24
|
+
export { default as VectorSource } from "./components/VectorSource";
|
|
25
|
+
export { default as ShapeSource } from "./components/ShapeSource";
|
|
26
|
+
export type { ShapeSourceRef } from "./components/ShapeSource";
|
|
27
|
+
export { default as RasterSource } from "./components/RasterSource";
|
|
28
|
+
export { default as ImageSource } from "./components/ImageSource";
|
|
29
|
+
export { default as Images } from "./components/Images";
|
|
30
|
+
export { default as FillLayer } from "./components/FillLayer";
|
|
31
|
+
export { default as FillExtrusionLayer } from "./components/FillExtrusionLayer";
|
|
32
|
+
export { default as HeatmapLayer } from "./components/HeatmapLayer";
|
|
33
|
+
export { default as LineLayer } from "./components/LineLayer";
|
|
34
|
+
export { default as CircleLayer } from "./components/CircleLayer";
|
|
35
|
+
export { default as SymbolLayer } from "./components/SymbolLayer";
|
|
36
|
+
export { default as RasterLayer } from "./components/RasterLayer";
|
|
37
|
+
export { default as BackgroundLayer } from "./components/BackgroundLayer";
|
|
36
38
|
export {
|
|
37
39
|
default as locationManager,
|
|
38
40
|
type Location,
|
|
39
|
-
} from
|
|
40
|
-
export {default as offlineManager} from
|
|
41
|
-
export {default as OfflineCreatePackOptions} from
|
|
42
|
-
export {default as snapshotManager} from
|
|
43
|
-
export type {SnapshotInputOptions} from
|
|
44
|
-
export {default as MarkerView} from
|
|
45
|
-
export {default as Animated} from
|
|
46
|
-
export {default as Style} from
|
|
47
|
-
export {default as Logger, type LogLevel} from
|
|
41
|
+
} from "./modules/location/locationManager";
|
|
42
|
+
export { default as offlineManager } from "./modules/offline/offlineManager";
|
|
43
|
+
export { default as OfflineCreatePackOptions } from "./modules/offline/OfflineCreatePackOptions";
|
|
44
|
+
export { default as snapshotManager } from "./modules/snapshot/snapshotManager";
|
|
45
|
+
export type { SnapshotInputOptions } from "./modules/snapshot/SnapshotOptions";
|
|
46
|
+
export { default as MarkerView } from "./components/MarkerView";
|
|
47
|
+
export { default as Animated } from "./utils/animated/Animated";
|
|
48
|
+
export { default as Style } from "./components/Style";
|
|
49
|
+
export { default as Logger, type LogLevel } from "./utils/Logger";
|
|
48
50
|
export type {
|
|
49
51
|
FillLayerStyleProps as FillLayerStyle,
|
|
50
52
|
LineLayerStyleProps as LineLayerStyle,
|
|
@@ -56,14 +58,7 @@ export type {
|
|
|
56
58
|
HillshadeLayerStyleProps as HillshadeLayerStyle,
|
|
57
59
|
BackgroundLayerStyleProps as BackgroundLayerStyle,
|
|
58
60
|
LightLayerStyleProps as LightLayerStyle,
|
|
59
|
-
} from
|
|
60
|
-
|
|
61
|
-
import {UserTrackingMode} from './components/Camera';
|
|
62
|
-
|
|
63
|
-
// types:
|
|
64
|
-
export enum StyleURL {
|
|
65
|
-
Default = 'https://demotiles.maplibre.org/style.json',
|
|
66
|
-
}
|
|
61
|
+
} from "./utils/MaplibreStyles";
|
|
67
62
|
|
|
68
63
|
/** @deprecated UserTrackingModes is deprecated use UserTrackingMode */
|
|
69
64
|
export const UserTrackingModes = UserTrackingMode;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { BackgroundLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNBackgroundLayer";
|
|
14
14
|
|
|
15
15
|
export interface BackgroundLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface BackgroundLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<BackgroundLayerProps,
|
|
23
|
+
extends Omit<BackgroundLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNBackgroundLayer =
|
|
@@ -30,7 +30,7 @@ const BackgroundLayer: React.FC<BackgroundLayerProps> = ({
|
|
|
30
30
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
31
31
|
...props
|
|
32
32
|
}: BackgroundLayerProps) => {
|
|
33
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
33
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
34
34
|
BackgroundLayerProps,
|
|
35
35
|
NativeProps
|
|
36
36
|
>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {ReactElement} from
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -8,47 +8,47 @@ import {
|
|
|
8
8
|
ViewStyle,
|
|
9
9
|
ViewProps,
|
|
10
10
|
StyleProp,
|
|
11
|
-
} from
|
|
11
|
+
} from "react-native";
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCallout";
|
|
14
14
|
|
|
15
15
|
const styles = StyleSheet.create({
|
|
16
16
|
container: {
|
|
17
|
-
alignItems:
|
|
18
|
-
justifyContent:
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
19
|
width: 180,
|
|
20
20
|
zIndex: 9999999,
|
|
21
21
|
},
|
|
22
22
|
content: {
|
|
23
|
-
backgroundColor:
|
|
24
|
-
borderColor:
|
|
23
|
+
backgroundColor: "white",
|
|
24
|
+
borderColor: "rgba(0, 0, 0, 0.2)",
|
|
25
25
|
borderRadius: 3,
|
|
26
26
|
borderWidth: 1,
|
|
27
27
|
flex: 1,
|
|
28
28
|
padding: 8,
|
|
29
|
-
position:
|
|
29
|
+
position: "relative",
|
|
30
30
|
},
|
|
31
31
|
tip: {
|
|
32
|
-
backgroundColor:
|
|
33
|
-
borderBottomColor:
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
borderBottomColor: "transparent",
|
|
34
34
|
borderBottomWidth: 0,
|
|
35
|
-
borderLeftColor:
|
|
35
|
+
borderLeftColor: "transparent",
|
|
36
36
|
borderLeftWidth: 8,
|
|
37
|
-
borderRightColor:
|
|
37
|
+
borderRightColor: "transparent",
|
|
38
38
|
borderRightWidth: 8,
|
|
39
|
-
borderTopColor:
|
|
39
|
+
borderTopColor: "white",
|
|
40
40
|
borderTopWidth: 16,
|
|
41
41
|
elevation: 0,
|
|
42
42
|
marginTop: -2,
|
|
43
43
|
zIndex: 1000,
|
|
44
44
|
},
|
|
45
45
|
title: {
|
|
46
|
-
color:
|
|
47
|
-
textAlign:
|
|
46
|
+
color: "black",
|
|
47
|
+
textAlign: "center",
|
|
48
48
|
},
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
interface CalloutProps extends Omit<ViewProps,
|
|
51
|
+
interface CalloutProps extends Omit<ViewProps, "style"> {
|
|
52
52
|
/**
|
|
53
53
|
* String that get's displayed in the default callout.
|
|
54
54
|
*/
|
|
@@ -75,7 +75,7 @@ interface CalloutProps extends Omit<ViewProps, 'style'> {
|
|
|
75
75
|
textStyle?: ViewStyle;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
interface NativeProps extends Omit<CalloutProps,
|
|
78
|
+
interface NativeProps extends Omit<CalloutProps, "style"> {
|
|
79
79
|
style: StyleProp<ViewStyle>;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -95,9 +95,9 @@ const Callout = (props: CalloutProps): ReactElement => {
|
|
|
95
95
|
|
|
96
96
|
const _containerStyle: ViewStyle[] = [
|
|
97
97
|
{
|
|
98
|
-
position:
|
|
98
|
+
position: "absolute",
|
|
99
99
|
zIndex: 999,
|
|
100
|
-
backgroundColor:
|
|
100
|
+
backgroundColor: "transparent",
|
|
101
101
|
...containerStyle,
|
|
102
102
|
} as ViewStyle,
|
|
103
103
|
];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {toJSONString} from '../utils';
|
|
2
|
-
import * as geoUtils from '../utils/geoUtils';
|
|
3
|
-
import {MaplibreGLEvent} from '../types';
|
|
4
|
-
import {useNativeRef} from '../hooks/useNativeRef';
|
|
5
|
-
|
|
6
|
-
import {NativeModules, requireNativeComponent, ViewProps} from 'react-native';
|
|
7
1
|
import React, {
|
|
8
2
|
memo,
|
|
9
3
|
RefObject,
|
|
@@ -12,21 +6,27 @@ import React, {
|
|
|
12
6
|
useMemo,
|
|
13
7
|
useRef,
|
|
14
8
|
useCallback,
|
|
15
|
-
} from
|
|
9
|
+
} from "react";
|
|
10
|
+
import { NativeModules, requireNativeComponent, ViewProps } from "react-native";
|
|
11
|
+
|
|
12
|
+
import { useNativeRef } from "../hooks/useNativeRef";
|
|
13
|
+
import { MaplibreGLEvent } from "../types";
|
|
14
|
+
import { toJSONString } from "../utils";
|
|
15
|
+
import * as geoUtils from "../utils/geoUtils";
|
|
16
16
|
|
|
17
17
|
const MapLibreGL = NativeModules.MLNModule;
|
|
18
18
|
|
|
19
|
-
export const NATIVE_MODULE_NAME =
|
|
19
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCamera";
|
|
20
20
|
|
|
21
21
|
export enum UserTrackingMode {
|
|
22
|
-
Follow =
|
|
23
|
-
FollowWithHeading =
|
|
24
|
-
FollowWithCourse =
|
|
22
|
+
Follow = "normal",
|
|
23
|
+
FollowWithHeading = "compass",
|
|
24
|
+
FollowWithCourse = "course",
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export type UserTrackingModeChangeCallback = (
|
|
28
28
|
event: MaplibreGLEvent<
|
|
29
|
-
|
|
29
|
+
"usertrackingmodechange",
|
|
30
30
|
{
|
|
31
31
|
followUserLocation: boolean;
|
|
32
32
|
followUserMode: UserTrackingMode | null;
|
|
@@ -96,8 +96,8 @@ interface CameraBoundsWithPadding
|
|
|
96
96
|
extends CameraBounds,
|
|
97
97
|
Partial<CameraPadding> {}
|
|
98
98
|
|
|
99
|
-
type NativeAnimationMode =
|
|
100
|
-
export type CameraAnimationMode =
|
|
99
|
+
type NativeAnimationMode = "flight" | "ease" | "linear" | "none" | "move";
|
|
100
|
+
export type CameraAnimationMode = "flyTo" | "easeTo" | "linearTo" | "moveTo";
|
|
101
101
|
|
|
102
102
|
export interface NativeCameraStop extends Required<CameraPadding> {
|
|
103
103
|
mode: NativeAnimationMode;
|
|
@@ -133,7 +133,7 @@ export type CameraStops = {
|
|
|
133
133
|
stops: CameraStop[];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
interface CameraProps extends Omit<ViewProps,
|
|
136
|
+
interface CameraProps extends Omit<ViewProps, "style">, CameraStop {
|
|
137
137
|
/**
|
|
138
138
|
* If false, the camera will not send any props to the native module. Intended to be used to prevent unnecessary tile fetching and improve performance when the map is not visible. Defaults to true.
|
|
139
139
|
*/
|
|
@@ -193,7 +193,7 @@ interface CameraProps extends Omit<ViewProps, 'style'>, CameraStop {
|
|
|
193
193
|
onUserTrackingModeChange?: UserTrackingModeChangeCallback;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
interface NativeProps extends Omit<CameraProps,
|
|
196
|
+
interface NativeProps extends Omit<CameraProps, "maxBounds"> {
|
|
197
197
|
maxBounds: string | null;
|
|
198
198
|
stop: NativeCameraStop | null;
|
|
199
199
|
defaultStop: NativeCameraStop | null;
|
|
@@ -204,7 +204,7 @@ const Camera = memo(
|
|
|
204
204
|
(
|
|
205
205
|
{
|
|
206
206
|
allowUpdates = true,
|
|
207
|
-
animationMode =
|
|
207
|
+
animationMode = "easeTo",
|
|
208
208
|
animationDuration = 2000,
|
|
209
209
|
...rest
|
|
210
210
|
}: CameraProps,
|
|
@@ -340,7 +340,7 @@ const Camera = memo(
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
if (config.bounds && config.bounds.ne && config.bounds.sw) {
|
|
343
|
-
const {ne, sw} = config.bounds;
|
|
343
|
+
const { ne, sw } = config.bounds;
|
|
344
344
|
stopConfig.bounds = toJSONString(geoUtils.makeLatLngBounds(ne, sw));
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -351,7 +351,7 @@ const Camera = memo(
|
|
|
351
351
|
|
|
352
352
|
const _setCamera = useCallback(
|
|
353
353
|
(config: CameraStop | CameraStops = {}): void => {
|
|
354
|
-
if (
|
|
354
|
+
if ("stops" in config) {
|
|
355
355
|
let nativeStops: NativeCameraStop[] = [];
|
|
356
356
|
|
|
357
357
|
for (const stop of config.stops) {
|
|
@@ -360,12 +360,12 @@ const Camera = memo(
|
|
|
360
360
|
nativeStops = [...nativeStops, nativeStop];
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
cameraRef.current?.setNativeProps({stop: {stops: nativeStops}});
|
|
363
|
+
cameraRef.current?.setNativeProps({ stop: { stops: nativeStops } });
|
|
364
364
|
} else {
|
|
365
365
|
const nativeStop = _createStopConfig(config);
|
|
366
366
|
|
|
367
367
|
if (nativeStop) {
|
|
368
|
-
cameraRef.current?.setNativeProps({stop: nativeStop});
|
|
368
|
+
cameraRef.current?.setNativeProps({ stop: nativeStop });
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
},
|
|
@@ -520,8 +520,8 @@ const Camera = memo(
|
|
|
520
520
|
sw: southWestCoordinates,
|
|
521
521
|
},
|
|
522
522
|
padding: pad,
|
|
523
|
-
animationDuration
|
|
524
|
-
animationMode:
|
|
523
|
+
animationDuration,
|
|
524
|
+
animationMode: "easeTo",
|
|
525
525
|
});
|
|
526
526
|
};
|
|
527
527
|
|
|
@@ -532,7 +532,7 @@ const Camera = memo(
|
|
|
532
532
|
setCamera({
|
|
533
533
|
centerCoordinate: coordinates,
|
|
534
534
|
animationDuration,
|
|
535
|
-
animationMode:
|
|
535
|
+
animationMode: "flyTo",
|
|
536
536
|
});
|
|
537
537
|
};
|
|
538
538
|
|
|
@@ -550,7 +550,7 @@ const Camera = memo(
|
|
|
550
550
|
setCamera({
|
|
551
551
|
zoomLevel,
|
|
552
552
|
animationDuration,
|
|
553
|
-
animationMode:
|
|
553
|
+
animationMode: "flyTo",
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
556
|
|
|
@@ -569,7 +569,7 @@ const Camera = memo(
|
|
|
569
569
|
_defaultCamera.current = _createStopConfig(
|
|
570
570
|
{
|
|
571
571
|
...props.defaultSettings,
|
|
572
|
-
animationMode:
|
|
572
|
+
animationMode: "moveTo",
|
|
573
573
|
},
|
|
574
574
|
true,
|
|
575
575
|
);
|
|
@@ -580,11 +580,11 @@ const Camera = memo(
|
|
|
580
580
|
config: CameraStop,
|
|
581
581
|
): NativeAnimationMode => {
|
|
582
582
|
switch (config.animationMode) {
|
|
583
|
-
case
|
|
583
|
+
case "flyTo":
|
|
584
584
|
return MapLibreGL.CameraModes.Flight;
|
|
585
|
-
case
|
|
585
|
+
case "moveTo":
|
|
586
586
|
return MapLibreGL.CameraModes.None;
|
|
587
|
-
case
|
|
587
|
+
case "linearTo":
|
|
588
588
|
return MapLibreGL.CameraModes.Linear;
|
|
589
589
|
default:
|
|
590
590
|
return MapLibreGL.CameraModes.Ease;
|