@maplibre/maplibre-react-native 10.0.0-alpha.5 → 10.0.0-alpha.6
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 +53 -48
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/annotation/MarkerViewManager.java +5 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNMapView.java +7 -7
- package/docs/Camera.md +1 -1
- package/docs/docs.json +3 -3
- package/docs/offlineManager.md +246 -0
- package/javascript/components/Camera.tsx +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,17 @@ Please add unreleased changes in the following style:
|
|
|
5
5
|
PR Title ([#123](link to my pr))
|
|
6
6
|
```
|
|
7
7
|
|
|
8
|
+
## 10.0.0-alpha.6
|
|
9
|
+
fix: [cameraRef?.current?.setCamera causing markerpoint get detached from maps-base](https://github.com/maplibre/maplibre-react-native/issues/409)
|
|
10
|
+
fix: round compass margins and attribution position to nearest integers [android] ([#294](https://github.com/maplibre/maplibre-react-native/pull/294))
|
|
11
|
+
|
|
8
12
|
## 10.0.0-alpha.5
|
|
9
13
|
Fix: [remove AbortController test mock](https://github.com/maplibre/maplibre-react-native/pull/403)
|
|
10
14
|
Fix: [ExpoPlugin after Class renaming](thttps://github.com/maplibre/maplibre-react-native/pull/405)
|
|
11
15
|
Fix: [android example crashing](https://github.com/maplibre/maplibre-react-native/pull/372) on launch
|
|
12
16
|
|
|
13
17
|
## 10.0.0-alpha.4
|
|
18
|
+
|
|
14
19
|
Update maplibre-native to use [new metal renderer on iOS](https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.4.0)
|
|
15
20
|
|
|
16
21
|
## 10.0.0-alpha.3
|
|
@@ -62,54 +67,54 @@ fix(iOS): correct import of UIView+React.h header ([#1672](https://github.com/rn
|
|
|
62
67
|
|
|
63
68
|
## 8.5.0
|
|
64
69
|
|
|
65
|
-
build: update install guide and `/example` project for android dependencies ([#1640](https://github.com/rnmapbox/maps/pull/1640))
|
|
66
|
-
build(turf): update to version 6.5.0 ([#1638](https://github.com/rnmapbox/maps/pull/1638))
|
|
67
|
-
fix(Camera) fix `zoomTo` method and expand Fit example ([#1631](https://github.com/rnmapbox/maps/pull/1631))
|
|
68
|
-
ci: two scripts for linting with and without fix ([#1630](https://github.com/rnmapbox/maps/pull/1630))
|
|
69
|
-
feat(Camera) add an optional `allowUpdates` boolean prop ([#1619](https://github.com/rnmapbox/maps/pull/1619))
|
|
70
|
-
refactor(example): remove unused modules and scripts ([#1618](https://github.com/rnmapbox/maps/pull/1618))
|
|
71
|
-
fix(react-native): update api to get rid of EventEmitter warnings ([#1615](https://github.com/rnmapbox/maps/pull/1615))
|
|
72
|
-
fix(Camera) persist zoom when changing from `bounds` to `centerCoordinate`, fix zero padding not causing map to update, create unified example showcasing bounds/centerCoordinate/zoom/padding ([#1614](https://github.com/rnmapbox/maps/pull/1614))
|
|
73
|
-
Update MapLibre to 5.12.1 on iOS ([#1596](https://github.com/rnmapbox/maps/pull/1596))
|
|
70
|
+
build: update install guide and `/example` project for android dependencies ([#1640](https://github.com/rnmapbox/maps/pull/1640))
|
|
71
|
+
build(turf): update to version 6.5.0 ([#1638](https://github.com/rnmapbox/maps/pull/1638))
|
|
72
|
+
fix(Camera) fix `zoomTo` method and expand Fit example ([#1631](https://github.com/rnmapbox/maps/pull/1631))
|
|
73
|
+
ci: two scripts for linting with and without fix ([#1630](https://github.com/rnmapbox/maps/pull/1630))
|
|
74
|
+
feat(Camera) add an optional `allowUpdates` boolean prop ([#1619](https://github.com/rnmapbox/maps/pull/1619))
|
|
75
|
+
refactor(example): remove unused modules and scripts ([#1618](https://github.com/rnmapbox/maps/pull/1618))
|
|
76
|
+
fix(react-native): update api to get rid of EventEmitter warnings ([#1615](https://github.com/rnmapbox/maps/pull/1615))
|
|
77
|
+
fix(Camera) persist zoom when changing from `bounds` to `centerCoordinate`, fix zero padding not causing map to update, create unified example showcasing bounds/centerCoordinate/zoom/padding ([#1614](https://github.com/rnmapbox/maps/pull/1614))
|
|
78
|
+
Update MapLibre to 5.12.1 on iOS ([#1596](https://github.com/rnmapbox/maps/pull/1596))
|
|
74
79
|
Update ShapeSource methods to make it usable with any cluster ( Use cluster itself instead of cluster_id as first argument for getClusterExpansionZoom/getClusterLeaves/getClusterChildren methods. Version < 9 methods still supports passing cluster_id as a first argument but a deprecation warning will be shown. ) ([#1499](https://github.com/rnmapbox/maps/pull/1499))
|
|
75
80
|
|
|
76
81
|
---
|
|
77
82
|
|
|
78
83
|
## 8.4.0
|
|
79
84
|
|
|
80
|
-
fix(iOS): pin mapLibre back to `5.12.0` ([#1589](https://github.com/rnmapbox/maps/pull/1589))
|
|
81
|
-
chore: improve GH workflows ([#1588](https://github.com/rnmapbox/maps/pull/1588))
|
|
82
|
-
build(deps): bump @expo/config-plugins from 3.1.0 to 4.0.3 ([#1585](https://github.com/rnmapbox/maps/pull/1585))
|
|
83
|
-
chore(pre-commit): run lint on TS files, change PR template ([#1584](https://github.com/rnmapbox/maps/pull/1584))
|
|
84
|
-
feat(example): update vertical alignment example ([#1579](https://github.com/rnmapbox/maps/pull/1579))
|
|
85
|
-
fix incorrect anchor calculation for PointAnnotation on iOS ([#1576](https://github.com/rnmapbox/maps/pull/1576))
|
|
86
|
-
style(eslint): align root and example with the same configuration ([#1575](https://github.com/rnmapbox/maps/pull/1575))
|
|
87
|
-
fix(mapLibre): support version `5.12.0` upwards ([#1571](https://github.com/rnmapbox/maps/pull/1571))
|
|
88
|
-
build: upgrade to RN `0.66` ([#1570](https://github.com/rnmapbox/maps/pull/1570))
|
|
89
|
-
build(android): add telemetry dependency to default build setup ([#1550](https://github.com/rnmapbox/maps/pull/1550))
|
|
90
|
-
feat(camera): Enable `padding` as a root-level prop on the camera, with `bounds.padding*` as fallbacks ([#1538](https://github.com/rnmapbox/maps/pull/1538/files))
|
|
85
|
+
fix(iOS): pin mapLibre back to `5.12.0` ([#1589](https://github.com/rnmapbox/maps/pull/1589))
|
|
86
|
+
chore: improve GH workflows ([#1588](https://github.com/rnmapbox/maps/pull/1588))
|
|
87
|
+
build(deps): bump @expo/config-plugins from 3.1.0 to 4.0.3 ([#1585](https://github.com/rnmapbox/maps/pull/1585))
|
|
88
|
+
chore(pre-commit): run lint on TS files, change PR template ([#1584](https://github.com/rnmapbox/maps/pull/1584))
|
|
89
|
+
feat(example): update vertical alignment example ([#1579](https://github.com/rnmapbox/maps/pull/1579))
|
|
90
|
+
fix incorrect anchor calculation for PointAnnotation on iOS ([#1576](https://github.com/rnmapbox/maps/pull/1576))
|
|
91
|
+
style(eslint): align root and example with the same configuration ([#1575](https://github.com/rnmapbox/maps/pull/1575))
|
|
92
|
+
fix(mapLibre): support version `5.12.0` upwards ([#1571](https://github.com/rnmapbox/maps/pull/1571))
|
|
93
|
+
build: upgrade to RN `0.66` ([#1570](https://github.com/rnmapbox/maps/pull/1570))
|
|
94
|
+
build(android): add telemetry dependency to default build setup ([#1550](https://github.com/rnmapbox/maps/pull/1550))
|
|
95
|
+
feat(camera): Enable `padding` as a root-level prop on the camera, with `bounds.padding*` as fallbacks ([#1538](https://github.com/rnmapbox/maps/pull/1538/files))
|
|
91
96
|
fix: revert pinned mapLibre version to `5.11.0` ([8a2b00e67ba6398f3f6e6f52e98b0f0cea437e4d](https://github.com/rnmapbox/maps/commit/8a2b00e67ba6398f3f6e6f52e98b0f0cea437e4d))
|
|
92
97
|
|
|
93
98
|
---
|
|
94
99
|
|
|
95
100
|
## 8.3.0
|
|
96
101
|
|
|
97
|
-
Fix TypeScript type for Callout's textStyle prop ([#1450](https://github.com/rnmapbox/maps/pull/1450))
|
|
98
|
-
Build(ios): pin maplibre version to 5.12.0 ([#1454](https://github.com/rnmapbox/maps/pull/1454))
|
|
99
|
-
Update geoUtils helpers types to correspond with `turf/helpers` ([#1455](https://github.com/rnmapbox/maps/pull/1455))
|
|
100
|
-
Fix crash with missing okhttp dependency ([#1452](https://github.com/rnmapbox/maps/pull/1452))
|
|
101
|
-
Move from react-native-testing-library => @testing-library/react-native ([#1453](https://github.com/rnmapbox/maps/pull/1453))
|
|
102
|
-
Feat(camera): maxBounds/(min|max)ZoomLevel can be updated dynamically ([#1462](https://github.com/rnmapbox/maps/pull/1462))
|
|
103
|
-
Refactor(example): clean up folder structure ([#1464](https://github.com/rnmapbox/maps/pull/1464))
|
|
104
|
-
Fix lineGradient showing wrong colors ([#1471](https://github.com/rnmapbox/maps/pull/1471))
|
|
105
|
-
Support tintColor on Android ([#1465](https://github.com/rnmapbox/maps/pull/1465))
|
|
106
|
-
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469)
|
|
107
|
-
Examples: align install steps with yarn, ignore created env files ([#1484](https://github.com/rnmapbox/maps/pull/1484)
|
|
108
|
-
Fix(plugin): Exclude arm64 architectures for simulator builds ([#1490](https://github.com/rnmapbox/maps/pull/1490)
|
|
109
|
-
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469))
|
|
110
|
-
Docs: make background in example pngs transparent ([#1483](https://github.com/rnmapbox/maps/pull/1483))
|
|
111
|
-
Style: run yarn lint ([#1486](https://github.com/rnmapbox/maps/pull/1486))
|
|
112
|
-
Test: add unit tests for component light ([#1489](https://github.com/rnmapbox/maps/pull/1489))
|
|
102
|
+
Fix TypeScript type for Callout's textStyle prop ([#1450](https://github.com/rnmapbox/maps/pull/1450))
|
|
103
|
+
Build(ios): pin maplibre version to 5.12.0 ([#1454](https://github.com/rnmapbox/maps/pull/1454))
|
|
104
|
+
Update geoUtils helpers types to correspond with `turf/helpers` ([#1455](https://github.com/rnmapbox/maps/pull/1455))
|
|
105
|
+
Fix crash with missing okhttp dependency ([#1452](https://github.com/rnmapbox/maps/pull/1452))
|
|
106
|
+
Move from react-native-testing-library => @testing-library/react-native ([#1453](https://github.com/rnmapbox/maps/pull/1453))
|
|
107
|
+
Feat(camera): maxBounds/(min|max)ZoomLevel can be updated dynamically ([#1462](https://github.com/rnmapbox/maps/pull/1462))
|
|
108
|
+
Refactor(example): clean up folder structure ([#1464](https://github.com/rnmapbox/maps/pull/1464))
|
|
109
|
+
Fix lineGradient showing wrong colors ([#1471](https://github.com/rnmapbox/maps/pull/1471))
|
|
110
|
+
Support tintColor on Android ([#1465](https://github.com/rnmapbox/maps/pull/1465))
|
|
111
|
+
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469)
|
|
112
|
+
Examples: align install steps with yarn, ignore created env files ([#1484](https://github.com/rnmapbox/maps/pull/1484)
|
|
113
|
+
Fix(plugin): Exclude arm64 architectures for simulator builds ([#1490](https://github.com/rnmapbox/maps/pull/1490)
|
|
114
|
+
Feat(android): dynamically update tintColor & add example ([#1469](https://github.com/rnmapbox/maps/pull/1469))
|
|
115
|
+
Docs: make background in example pngs transparent ([#1483](https://github.com/rnmapbox/maps/pull/1483))
|
|
116
|
+
Style: run yarn lint ([#1486](https://github.com/rnmapbox/maps/pull/1486))
|
|
117
|
+
Test: add unit tests for component light ([#1489](https://github.com/rnmapbox/maps/pull/1489))
|
|
113
118
|
Feat: add Adds getClusterChildren method to ShapeSource ([#1495](https://github.com/rnmapbox/maps/pull/1495))
|
|
114
119
|
|
|
115
120
|
## 8.2.1
|
|
@@ -118,22 +123,22 @@ fix issue when publishing to npm with `prepare` script
|
|
|
118
123
|
|
|
119
124
|
## 8.2.0
|
|
120
125
|
|
|
121
|
-
getClusterLeaves method for ShapeSource ([#1411](https://github.com/rnmapbox/maps/pull/1411))
|
|
122
|
-
Add logoPosition props to `MapView` to position the mapbox logo ([#1396](https://github.com/rnmapbox/maps/pull/1396))
|
|
123
|
-
Add compatibility with React 17/ npm7 ([#1387](https://github.com/rnmapbox/maps/pull/1387))
|
|
124
|
-
Add Expo config plugin ([#1388](https://github.com/rnmapbox/maps/pull/1388))
|
|
125
|
-
Android: Bump `okhttp` to `4.9.0` ([#1390](https://github.com/rnmapbox/maps/pull/1390))
|
|
126
|
-
Support dynamically changing local JSON in styleURL ([#1399](https://github.com/rnmapbox/maps/pull/1399))
|
|
127
|
-
Add missing types to `SymbolLayerStyle` & `ImagesProps` ([#1360](https://github.com/rnmapbox/maps/pull/1360))
|
|
126
|
+
getClusterLeaves method for ShapeSource ([#1411](https://github.com/rnmapbox/maps/pull/1411))
|
|
127
|
+
Add logoPosition props to `MapView` to position the mapbox logo ([#1396](https://github.com/rnmapbox/maps/pull/1396))
|
|
128
|
+
Add compatibility with React 17/ npm7 ([#1387](https://github.com/rnmapbox/maps/pull/1387))
|
|
129
|
+
Add Expo config plugin ([#1388](https://github.com/rnmapbox/maps/pull/1388))
|
|
130
|
+
Android: Bump `okhttp` to `4.9.0` ([#1390](https://github.com/rnmapbox/maps/pull/1390))
|
|
131
|
+
Support dynamically changing local JSON in styleURL ([#1399](https://github.com/rnmapbox/maps/pull/1399))
|
|
132
|
+
Add missing types to `SymbolLayerStyle` & `ImagesProps` ([#1360](https://github.com/rnmapbox/maps/pull/1360))
|
|
128
133
|
Fix error while updating coordinates of RCTMGLImageSource ([#1310](https://github.com/rnmapbox/maps/pull/1310))
|
|
129
134
|
|
|
130
135
|
## 8.2.0-beta2
|
|
131
136
|
|
|
132
|
-
Add types for `Logger` class ([#1316](https://github.com/rnmapbox/maps/pull/1316))
|
|
133
|
-
Enable linear easing on map camera ([#1281](https://github.com/rnmapbox/maps/pull/1281))
|
|
134
|
-
Allow MapLibre as an option ([#1311](https://github.com/rnmapbox/maps/pull/1311))
|
|
135
|
-
Fix native UserLocation on Android ([#1284](https://github.com/rnmapbox/maps/pull/1284))
|
|
136
|
-
Add getClusterExpansionZoom to ShapeSource ([#1279](https://github.com/rnmapbox/maps/pull/1279))
|
|
137
|
+
Add types for `Logger` class ([#1316](https://github.com/rnmapbox/maps/pull/1316))
|
|
138
|
+
Enable linear easing on map camera ([#1281](https://github.com/rnmapbox/maps/pull/1281))
|
|
139
|
+
Allow MapLibre as an option ([#1311](https://github.com/rnmapbox/maps/pull/1311))
|
|
140
|
+
Fix native UserLocation on Android ([#1284](https://github.com/rnmapbox/maps/pull/1284))
|
|
141
|
+
Add getClusterExpansionZoom to ShapeSource ([#1279](https://github.com/rnmapbox/maps/pull/1279))
|
|
137
142
|
Add type definition for AnimatedPoint ([#1280](https://github.com/rnmapbox/maps/pull/1280))
|
|
138
143
|
|
|
139
144
|
## 8.2.0-beta1
|
|
@@ -54,9 +54,11 @@ public class MarkerViewManager extends com.mapbox.mapboxsdk.plugins.markerview.M
|
|
|
54
54
|
|
|
55
55
|
public void updateMarkers(){
|
|
56
56
|
|
|
57
|
-
try {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
try {
|
|
58
|
+
if (markerUpdate != null) {
|
|
59
|
+
for( int i = 0; i < markers.size(); i++ ){
|
|
60
|
+
markerUpdate.invoke(markers.get(i));
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
catch (IllegalArgumentException e) { System.out.println(e.toString()); }
|
package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNMapView.java
CHANGED
|
@@ -925,10 +925,10 @@ public class RCTMLNMapView extends MapView implements OnMapReadyCallback, Mapbox
|
|
|
925
925
|
}
|
|
926
926
|
float density = getDisplayDensity();
|
|
927
927
|
mAttributionMargin = new int[]{
|
|
928
|
-
position.hasKey("left") ? (
|
|
929
|
-
position.hasKey("top") ? (
|
|
930
|
-
position.hasKey("right") ? (
|
|
931
|
-
position.hasKey("bottom") ? (
|
|
928
|
+
position.hasKey("left") ? Math.round(density * position.getInt("left")) : 0,
|
|
929
|
+
position.hasKey("top") ? Math.round(density * position.getInt("top")) : 0,
|
|
930
|
+
position.hasKey("right") ? Math.round(density * position.getInt("right")) : 0,
|
|
931
|
+
position.hasKey("bottom") ? Math.round(density * position.getInt("bottom")) : 0
|
|
932
932
|
};
|
|
933
933
|
updateUISettings();
|
|
934
934
|
}
|
|
@@ -1181,10 +1181,10 @@ public class RCTMLNMapView extends MapView implements OnMapReadyCallback, Mapbox
|
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
1183
|
if (mCompassViewMargins != null && uiSettings.isCompassEnabled()) {
|
|
1184
|
-
|
|
1184
|
+
float pixelDensity = getResources().getDisplayMetrics().density;
|
|
1185
1185
|
|
|
1186
|
-
int x = mCompassViewMargins.getInt("x") * pixelDensity;
|
|
1187
|
-
int y = mCompassViewMargins.getInt("y") * pixelDensity;
|
|
1186
|
+
int x = Math.round(mCompassViewMargins.getInt("x") * pixelDensity);
|
|
1187
|
+
int y = Math.round(mCompassViewMargins.getInt("y") * pixelDensity);
|
|
1188
1188
|
|
|
1189
1189
|
switch (uiSettings.getCompassGravity()) {
|
|
1190
1190
|
case Gravity.TOP | Gravity.START:
|
package/docs/Camera.md
CHANGED
|
@@ -36,7 +36,7 @@ Map camera transitions to fit provided bounds
|
|
|
36
36
|
| ---- | :--: | :------: | :----------: |
|
|
37
37
|
| `northEastCoordinates` | `Array` | `Yes` | North east coordinate of bound |
|
|
38
38
|
| `southWestCoordinates` | `Array` | `Yes` | South west coordinate of bound |
|
|
39
|
-
| `padding` | `
|
|
39
|
+
| `padding` | `n/a` | `No` | Padding for the bounds |
|
|
40
40
|
| `animationDuration` | `Number` | `No` | Duration of camera animation |
|
|
41
41
|
|
|
42
42
|
|
package/docs/docs.json
CHANGED
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
"methods": [
|
|
269
269
|
{
|
|
270
270
|
"name": "fitBounds",
|
|
271
|
-
"docblock": "Map camera transitions to fit provided bounds\n\n@example\nthis.camera.fitBounds([lng, lat], [lng, lat])\nthis.camera.fitBounds([lng, lat], [lng, lat], 20, 1000) // padding for all sides\nthis.camera.fitBounds([lng, lat], [lng, lat], [verticalPadding, horizontalPadding], 1000)\nthis.camera.fitBounds([lng, lat], [lng, lat], [top, right, bottom, left], 1000)\n\n@param {Array<Number>} northEastCoordinates - North east coordinate of bound\n@param {Array<Number>} southWestCoordinates - South west coordinate of bound\n@param {Number
|
|
271
|
+
"docblock": "Map camera transitions to fit provided bounds\n\n@example\nthis.camera.fitBounds([lng, lat], [lng, lat])\nthis.camera.fitBounds([lng, lat], [lng, lat], 20, 1000) // padding for all sides\nthis.camera.fitBounds([lng, lat], [lng, lat], [verticalPadding, horizontalPadding], 1000)\nthis.camera.fitBounds([lng, lat], [lng, lat], [top, right, bottom, left], 1000)\n\n@param {Array<Number>} northEastCoordinates - North east coordinate of bound\n@param {Array<Number>} southWestCoordinates - South west coordinate of bound\n@param {Number|Array<Number>=} padding - Padding for the bounds\n@param {Number=} animationDuration - Duration of camera animation\n@return {void}",
|
|
272
272
|
"modifiers": [],
|
|
273
273
|
"params": [
|
|
274
274
|
{
|
|
@@ -289,9 +289,9 @@
|
|
|
289
289
|
},
|
|
290
290
|
{
|
|
291
291
|
"name": "padding",
|
|
292
|
-
"description": "
|
|
292
|
+
"description": "Padding for the bounds",
|
|
293
293
|
"type": {
|
|
294
|
-
"name":
|
|
294
|
+
"name": null
|
|
295
295
|
},
|
|
296
296
|
"optional": true
|
|
297
297
|
},
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<!-- This file was autogenerated from offlineManager.js do not modify -->
|
|
2
|
+
## <MapLibreGL.offlineManager />
|
|
3
|
+
### OfflineManager implements a singleton (shared object) that manages offline packs.<br/>All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database.<br/>The shared object maintains a canonical collection of offline packs.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### methods
|
|
7
|
+
#### createPack(options[, progressListener][, errorListener])
|
|
8
|
+
|
|
9
|
+
Creates and registers an offline pack that downloads the resources needed to use the given region offline.
|
|
10
|
+
|
|
11
|
+
##### arguments
|
|
12
|
+
| Name | Type | Required | Description |
|
|
13
|
+
| ---- | :--: | :------: | :----------: |
|
|
14
|
+
| `options` | `OfflineCreatePackOptions` | `Yes` | Create options for a offline pack that specifices zoom levels, style url, and the region to download. |
|
|
15
|
+
| `progressListener` | `Callback` | `No` | Callback that listens for status events while downloading the offline resource. |
|
|
16
|
+
| `errorListener` | `Callback` | `No` | Callback that listens for status events while downloading the offline resource. |
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
const progressListener = (offlineRegion, status) => console.log(offlineRegion, status);
|
|
22
|
+
const errorListener = (offlineRegion, err) => console.log(offlineRegion, err);
|
|
23
|
+
|
|
24
|
+
await MapLibreGL.offlineManager.createPack({
|
|
25
|
+
name: 'offlinePack',
|
|
26
|
+
styleURL: 'mapbox://...',
|
|
27
|
+
minZoom: 14,
|
|
28
|
+
maxZoom: 20,
|
|
29
|
+
bounds: [[neLng, neLat], [swLng, swLat]]
|
|
30
|
+
}, progressListener, errorListener)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#### invalidatePack(name)
|
|
35
|
+
|
|
36
|
+
Invalidates the specified offline pack. This method checks that the tiles in the specified offline pack match those from the server. Local tiles that do not match the latest version on the server are updated.This is more efficient than deleting the offline pack and downloading it again. If the data stored locally matches that on the server, new data will not be downloaded.
|
|
37
|
+
|
|
38
|
+
##### arguments
|
|
39
|
+
| Name | Type | Required | Description |
|
|
40
|
+
| ---- | :--: | :------: | :----------: |
|
|
41
|
+
| `name` | `String` | `Yes` | Name of the offline pack. |
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
await MapLibreGL.offlineManager.invalidatePack('packName')
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#### deletePack(name)
|
|
51
|
+
|
|
52
|
+
Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed.
|
|
53
|
+
|
|
54
|
+
##### arguments
|
|
55
|
+
| Name | Type | Required | Description |
|
|
56
|
+
| ---- | :--: | :------: | :----------: |
|
|
57
|
+
| `name` | `String` | `Yes` | Name of the offline pack. |
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
await MapLibreGL.offlineManager.deletePack('packName')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
#### invalidateAmbientCache()
|
|
67
|
+
|
|
68
|
+
Forces a revalidation of the tiles in the ambient cache and downloads a fresh version of the tiles from the tile server.<br/>This is the recommend method for clearing the cache.<br/>This is the most efficient method because tiles in the ambient cache are re-downloaded to remove outdated data from a device.<br/>It does not erase resources from the ambient cache or delete the database, which can be computationally expensive operations that may carry unintended side effects.
|
|
69
|
+
|
|
70
|
+
##### arguments
|
|
71
|
+
| Name | Type | Required | Description |
|
|
72
|
+
| ---- | :--: | :------: | :----------: |
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
await MapLibreGL.offlineManager.invalidateAmbientCache();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
#### clearAmbientCache()
|
|
83
|
+
|
|
84
|
+
Erases resources from the ambient cache.<br/>This method clears the cache and decreases the amount of space that map resources take up on the device.
|
|
85
|
+
|
|
86
|
+
##### arguments
|
|
87
|
+
| Name | Type | Required | Description |
|
|
88
|
+
| ---- | :--: | :------: | :----------: |
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
await MapLibreGL.offlineManager.clearAmbientCache();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
#### setMaximumAmbientCacheSize(size)
|
|
99
|
+
|
|
100
|
+
Sets the maximum size of the ambient cache in bytes. Disables the ambient cache if set to 0.<br/>This method may be computationally expensive because it will erase resources from the ambient cache if its size is decreased.
|
|
101
|
+
|
|
102
|
+
##### arguments
|
|
103
|
+
| Name | Type | Required | Description |
|
|
104
|
+
| ---- | :--: | :------: | :----------: |
|
|
105
|
+
| `size` | `Number` | `Yes` | Size of ambient cache. |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
await MapLibreGL.offlineManager.setMaximumAmbientCacheSize(5000000);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
#### resetDatabase()
|
|
115
|
+
|
|
116
|
+
Deletes the existing database, which includes both the ambient cache and offline packs, then reinitializes it.
|
|
117
|
+
|
|
118
|
+
##### arguments
|
|
119
|
+
| Name | Type | Required | Description |
|
|
120
|
+
| ---- | :--: | :------: | :----------: |
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
await MapLibreGL.offlineManager.resetDatabase();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
#### getPacks()
|
|
131
|
+
|
|
132
|
+
Retrieves all the current offline packs that are stored in the database.
|
|
133
|
+
|
|
134
|
+
##### arguments
|
|
135
|
+
| Name | Type | Required | Description |
|
|
136
|
+
| ---- | :--: | :------: | :----------: |
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
const offlinePacks = await MapLibreGL.offlineManager.getPacks();
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
#### getPack(name)
|
|
147
|
+
|
|
148
|
+
Retrieves an offline pack that is stored in the database by name.
|
|
149
|
+
|
|
150
|
+
##### arguments
|
|
151
|
+
| Name | Type | Required | Description |
|
|
152
|
+
| ---- | :--: | :------: | :----------: |
|
|
153
|
+
| `name` | `String` | `Yes` | Name of the offline pack. |
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
const offlinePack = await MapLibreGL.offlineManager.getPack();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
#### mergeOfflineRegions(path)
|
|
163
|
+
|
|
164
|
+
Sideloads offline db
|
|
165
|
+
|
|
166
|
+
##### arguments
|
|
167
|
+
| Name | Type | Required | Description |
|
|
168
|
+
| ---- | :--: | :------: | :----------: |
|
|
169
|
+
| `path` | `String` | `Yes` | Path to offline tile db on file system. |
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
await MapLibreGL.offlineManager.mergeOfflineRegions(path);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
#### setTileCountLimit(limit)
|
|
179
|
+
|
|
180
|
+
Sets the maximum number of tiles that may be downloaded and stored on the current device.<br/>Consult the Terms of Service for your map tile host before changing this value.
|
|
181
|
+
|
|
182
|
+
##### arguments
|
|
183
|
+
| Name | Type | Required | Description |
|
|
184
|
+
| ---- | :--: | :------: | :----------: |
|
|
185
|
+
| `limit` | `Number` | `Yes` | Map tile limit count. |
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
MapLibreGL.offlineManager.setTileCountLimit(1000);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
#### setProgressEventThrottle(throttleValue)
|
|
195
|
+
|
|
196
|
+
Sets the period at which download status events will be sent over the React Native bridge.<br/>The default is 500ms.
|
|
197
|
+
|
|
198
|
+
##### arguments
|
|
199
|
+
| Name | Type | Required | Description |
|
|
200
|
+
| ---- | :--: | :------: | :----------: |
|
|
201
|
+
| `throttleValue` | `Number` | `Yes` | event throttle value in ms. |
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
MapLibreGL.offlineManager.setProgressEventThrottle(500);
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
#### subscribe(packName, progressListener, errorListener)
|
|
211
|
+
|
|
212
|
+
Subscribe to download status/error events for the requested offline pack.<br/>Note that createPack calls this internally if listeners are provided.
|
|
213
|
+
|
|
214
|
+
##### arguments
|
|
215
|
+
| Name | Type | Required | Description |
|
|
216
|
+
| ---- | :--: | :------: | :----------: |
|
|
217
|
+
| `packName` | `String` | `Yes` | Name of the offline pack. |
|
|
218
|
+
| `progressListener` | `Callback` | `Yes` | Callback that listens for status events while downloading the offline resource. |
|
|
219
|
+
| `errorListener` | `Callback` | `Yes` | Callback that listens for status events while downloading the offline resource. |
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
const progressListener = (offlinePack, status) => console.log(offlinePack, status)
|
|
225
|
+
const errorListener = (offlinePack, err) => console.log(offlinePack, err)
|
|
226
|
+
MapLibreGL.offlineManager.subscribe('packName', progressListener, errorListener)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
#### unsubscribe(packName)
|
|
231
|
+
|
|
232
|
+
Unsubscribes any listeners associated with the offline pack.<br/>It's a good idea to call this on componentWillUnmount.
|
|
233
|
+
|
|
234
|
+
##### arguments
|
|
235
|
+
| Name | Type | Required | Description |
|
|
236
|
+
| ---- | :--: | :------: | :----------: |
|
|
237
|
+
| `packName` | `String` | `Yes` | Name of the offline pack. |
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
```javascript
|
|
242
|
+
MapLibreGL.offlineManager.unsubscribe('packName')
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
@@ -427,15 +427,15 @@ class Camera extends React.Component<CameraProps> {
|
|
|
427
427
|
*
|
|
428
428
|
* @param {Array<Number>} northEastCoordinates - North east coordinate of bound
|
|
429
429
|
* @param {Array<Number>} southWestCoordinates - South west coordinate of bound
|
|
430
|
-
* @param {Number
|
|
430
|
+
* @param {Number|Array<Number>=} padding - Padding for the bounds
|
|
431
431
|
* @param {Number=} animationDuration - Duration of camera animation
|
|
432
432
|
* @return {void}
|
|
433
433
|
*/
|
|
434
434
|
fitBounds(
|
|
435
435
|
northEastCoordinates: number[],
|
|
436
436
|
southWestCoordinates: number[],
|
|
437
|
-
padding = 0,
|
|
438
|
-
animationDuration = 0.0,
|
|
437
|
+
padding: number | number[] | null | undefined = 0,
|
|
438
|
+
animationDuration: number | null | undefined = 0.0,
|
|
439
439
|
): void {
|
|
440
440
|
const pad = {
|
|
441
441
|
paddingLeft: 0,
|
package/package.json
CHANGED