@maplibre/maplibre-react-native 8.6.0-beta.1 → 9.0.0
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 +7 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +1 -7
- package/android/install.md +3 -3
- package/android/rctmgl/build.gradle +1 -1
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +33 -0
- package/app.plugin.js +1 -1
- package/docs/Annotation.md +1 -1
- package/docs/Annotations.md +3 -8
- package/docs/BackgroundLayer.md +2 -2
- package/docs/Callout.md +1 -1
- package/docs/Camera.md +2 -2
- package/docs/CircleLayer.md +31 -14
- package/docs/CustomHttpHeaders.md +9 -9
- package/docs/FillExtrusionLayer.md +2 -2
- package/docs/FillLayer.md +27 -10
- package/docs/GettingStarted.md +6 -8
- package/docs/HeadingIndicator.md +1 -1
- package/docs/HeatmapLayer.md +2 -2
- package/docs/ImageSource.md +1 -1
- package/docs/Images.md +1 -1
- package/docs/Light.md +1 -1
- package/docs/LineLayer.md +31 -14
- package/docs/{MapboxGL.md → MapLibreGL.md} +5 -5
- package/docs/MapView.md +5 -5
- package/docs/MarkerView.md +1 -1
- package/docs/NativeUserLocation.md +1 -1
- package/docs/OfflineManager.md +16 -16
- package/docs/PointAnnotation.md +1 -1
- package/docs/RasterLayer.md +2 -2
- package/docs/RasterSource.md +2 -2
- package/docs/ShapeSource.md +2 -2
- package/docs/Style.md +3 -3
- package/docs/StyleSheet.md +93 -72
- package/docs/SymbolLayer.md +17 -13
- package/docs/UserLocation.md +2 -2
- package/docs/VectorSource.md +2 -2
- package/docs/docs.json +102 -46
- package/docs/snapshotManager.md +7 -7
- package/index.d.ts +8 -7
- package/ios/RCTMGL/RCTMGLStyle.h +3 -0
- package/ios/RCTMGL/RCTMGLStyle.m +23 -2
- package/ios/RCTMGL/index.d.ts +24 -5
- package/ios/install.md +12 -4
- package/javascript/components/BackgroundLayer.js +2 -2
- package/javascript/components/Camera.js +6 -6
- package/javascript/components/CircleLayer.js +2 -2
- package/javascript/components/FillExtrusionLayer.js +2 -2
- package/javascript/components/FillLayer.js +2 -2
- package/javascript/components/HeatmapLayer.js +2 -2
- package/javascript/components/LineLayer.js +2 -2
- package/javascript/components/MapView.js +38 -41
- package/javascript/components/RasterLayer.js +2 -2
- package/javascript/components/RasterSource.js +2 -2
- package/javascript/components/ShapeSource.js +2 -2
- package/javascript/components/Style.js +3 -3
- package/javascript/components/SymbolLayer.js +2 -2
- package/javascript/components/UserLocation.js +2 -0
- package/javascript/components/VectorSource.js +2 -2
- package/javascript/index.js +38 -42
- package/javascript/modules/location/locationManager.js +8 -8
- package/javascript/modules/offline/OfflinePack.js +4 -4
- package/javascript/modules/offline/offlineManager.js +34 -34
- package/javascript/modules/snapshot/SnapshotOptions.js +2 -2
- package/javascript/modules/snapshot/snapshotManager.js +8 -8
- package/javascript/utils/styleMap.js +37 -6
- package/maplibre-react-native.podspec +1 -1
- package/package.json +5 -5
- package/plugin/build/{withMapbox.d.ts → withMapLibre.d.ts} +1 -1
- package/plugin/build/{withMapbox.js → withMapLibre.js} +7 -7
- package/plugin/install.md +1 -1
- package/scripts/download-style-spec.sh +2 -2
- package/scripts/templates/component.md.ejs +1 -1
- package/scripts/templates/styleMap.js.ejs +1 -1
- package/style-spec/v8.json +266 -43
|
@@ -5,10 +5,10 @@ import OfflinePack from './OfflinePack';
|
|
|
5
5
|
|
|
6
6
|
import {NativeModules, NativeEventEmitter} from 'react-native';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
9
|
+
const MapLibreGLOfflineManager = NativeModules.MGLOfflineModule;
|
|
10
10
|
export const OfflineModuleEventEmitter = new NativeEventEmitter(
|
|
11
|
-
|
|
11
|
+
MapLibreGLOfflineManager,
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -39,7 +39,7 @@ class OfflineManager {
|
|
|
39
39
|
* const progressListener = (offlineRegion, status) => console.log(offlineRegion, status);
|
|
40
40
|
* const errorListener = (offlineRegion, err) => console.log(offlineRegion, err);
|
|
41
41
|
*
|
|
42
|
-
* await
|
|
42
|
+
* await MapLibreGL.offlineManager.createPack({
|
|
43
43
|
* name: 'offlinePack',
|
|
44
44
|
* styleURL: 'mapbox://...',
|
|
45
45
|
* minZoom: 14,
|
|
@@ -64,7 +64,7 @@ class OfflineManager {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
this.subscribe(packOptions.name, progressListener, errorListener);
|
|
67
|
-
const nativeOfflinePack = await
|
|
67
|
+
const nativeOfflinePack = await MapLibreGLOfflineManager.createPack(
|
|
68
68
|
packOptions,
|
|
69
69
|
);
|
|
70
70
|
this._offlinePacks[packOptions.name] = new OfflinePack(nativeOfflinePack);
|
|
@@ -76,7 +76,7 @@ class OfflineManager {
|
|
|
76
76
|
* 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.
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
79
|
-
* await
|
|
79
|
+
* await MapLibreGL.offlineManager.invalidatePack('packName')
|
|
80
80
|
*
|
|
81
81
|
* @param {String} name Name of the offline pack.
|
|
82
82
|
* @return {void}
|
|
@@ -90,7 +90,7 @@ class OfflineManager {
|
|
|
90
90
|
|
|
91
91
|
const offlinePack = this._offlinePacks[name];
|
|
92
92
|
if (offlinePack) {
|
|
93
|
-
await
|
|
93
|
+
await MapLibreGLOfflineManager.invalidatePack(name);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -98,7 +98,7 @@ class OfflineManager {
|
|
|
98
98
|
* Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed.
|
|
99
99
|
*
|
|
100
100
|
* @example
|
|
101
|
-
* await
|
|
101
|
+
* await MapLibreGL.offlineManager.deletePack('packName')
|
|
102
102
|
*
|
|
103
103
|
* @param {String} name Name of the offline pack.
|
|
104
104
|
* @return {void}
|
|
@@ -112,7 +112,7 @@ class OfflineManager {
|
|
|
112
112
|
|
|
113
113
|
const offlinePack = this._offlinePacks[name];
|
|
114
114
|
if (offlinePack) {
|
|
115
|
-
await
|
|
115
|
+
await MapLibreGLOfflineManager.deletePack(name);
|
|
116
116
|
delete this._offlinePacks[name];
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -124,13 +124,13 @@ class OfflineManager {
|
|
|
124
124
|
* 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.
|
|
125
125
|
*
|
|
126
126
|
* @example
|
|
127
|
-
* await
|
|
127
|
+
* await MapLibreGL.offlineManager.invalidateAmbientCache();
|
|
128
128
|
*
|
|
129
129
|
* @return {void}
|
|
130
130
|
*/
|
|
131
131
|
async invalidateAmbientCache() {
|
|
132
132
|
await this._initialize();
|
|
133
|
-
await
|
|
133
|
+
await MapLibreGLOfflineManager.invalidateAmbientCache();
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
@@ -138,13 +138,13 @@ class OfflineManager {
|
|
|
138
138
|
* This method clears the cache and decreases the amount of space that map resources take up on the device.
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
|
-
* await
|
|
141
|
+
* await MapLibreGL.offlineManager.clearAmbientCache();
|
|
142
142
|
*
|
|
143
143
|
* @return {void}
|
|
144
144
|
*/
|
|
145
145
|
async clearAmbientCache() {
|
|
146
146
|
await this._initialize();
|
|
147
|
-
await
|
|
147
|
+
await MapLibreGLOfflineManager.clearAmbientCache();
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
@@ -152,34 +152,34 @@ class OfflineManager {
|
|
|
152
152
|
* This method may be computationally expensive because it will erase resources from the ambient cache if its size is decreased.
|
|
153
153
|
*
|
|
154
154
|
* @example
|
|
155
|
-
* await
|
|
155
|
+
* await MapLibreGL.offlineManager.setMaximumAmbientCacheSize(5000000);
|
|
156
156
|
*
|
|
157
157
|
* @param {Number} size Size of ambient cache.
|
|
158
158
|
* @return {void}
|
|
159
159
|
*/
|
|
160
160
|
async setMaximumAmbientCacheSize(size) {
|
|
161
161
|
await this._initialize();
|
|
162
|
-
await
|
|
162
|
+
await MapLibreGLOfflineManager.setMaximumAmbientCacheSize(size);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Deletes the existing database, which includes both the ambient cache and offline packs, then reinitializes it.
|
|
167
167
|
*
|
|
168
168
|
* @example
|
|
169
|
-
* await
|
|
169
|
+
* await MapLibreGL.offlineManager.resetDatabase();
|
|
170
170
|
*
|
|
171
171
|
* @return {void}
|
|
172
172
|
*/
|
|
173
173
|
async resetDatabase() {
|
|
174
174
|
await this._initialize();
|
|
175
|
-
await
|
|
175
|
+
await MapLibreGLOfflineManager.resetDatabase();
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* Retrieves all the current offline packs that are stored in the database.
|
|
180
180
|
*
|
|
181
181
|
* @example
|
|
182
|
-
* const offlinePacks = await
|
|
182
|
+
* const offlinePacks = await MapLibreGL.offlineManager.getPacks();
|
|
183
183
|
*
|
|
184
184
|
* @return {Array<OfflinePack>}
|
|
185
185
|
*/
|
|
@@ -194,7 +194,7 @@ class OfflineManager {
|
|
|
194
194
|
* Retrieves an offline pack that is stored in the database by name.
|
|
195
195
|
*
|
|
196
196
|
* @example
|
|
197
|
-
* const offlinePack = await
|
|
197
|
+
* const offlinePack = await MapLibreGL.offlineManager.getPack();
|
|
198
198
|
*
|
|
199
199
|
* @param {String} name Name of the offline pack.
|
|
200
200
|
* @return {OfflinePack}
|
|
@@ -208,28 +208,28 @@ class OfflineManager {
|
|
|
208
208
|
* Sideloads offline db
|
|
209
209
|
*
|
|
210
210
|
* @example
|
|
211
|
-
* await
|
|
211
|
+
* await MapLibreGL.offlineManager.mergeOfflineRegions(path);
|
|
212
212
|
*
|
|
213
213
|
* @param {String} path Path to offline tile db on file system.
|
|
214
214
|
* @return {void}
|
|
215
215
|
*/
|
|
216
216
|
async mergeOfflineRegions(path) {
|
|
217
217
|
await this._initialize();
|
|
218
|
-
return
|
|
218
|
+
return MapLibreGLOfflineManager.mergeOfflineRegions(path);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
* Sets the maximum number of
|
|
223
|
-
*
|
|
222
|
+
* Sets the maximum number of tiles that may be downloaded and stored on the current device.
|
|
223
|
+
* Consult the Terms of Service for your map tile host before changing this value.
|
|
224
224
|
*
|
|
225
225
|
* @example
|
|
226
|
-
*
|
|
226
|
+
* MapLibreGL.offlineManager.setTileCountLimit(1000);
|
|
227
227
|
*
|
|
228
228
|
* @param {Number} limit Map tile limit count.
|
|
229
229
|
* @return {void}
|
|
230
230
|
*/
|
|
231
231
|
setTileCountLimit(limit) {
|
|
232
|
-
|
|
232
|
+
MapLibreGLOfflineManager.setTileCountLimit(limit);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
/**
|
|
@@ -237,13 +237,13 @@ class OfflineManager {
|
|
|
237
237
|
* The default is 500ms.
|
|
238
238
|
*
|
|
239
239
|
* @example
|
|
240
|
-
*
|
|
240
|
+
* MapLibreGL.offlineManager.setProgressEventThrottle(500);
|
|
241
241
|
*
|
|
242
242
|
* @param {Number} throttleValue event throttle value in ms.
|
|
243
243
|
* @return {void}
|
|
244
244
|
*/
|
|
245
245
|
setProgressEventThrottle(throttleValue) {
|
|
246
|
-
|
|
246
|
+
MapLibreGLOfflineManager.setProgressEventThrottle(throttleValue);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/**
|
|
@@ -253,7 +253,7 @@ class OfflineManager {
|
|
|
253
253
|
* @example
|
|
254
254
|
* const progressListener = (offlinePack, status) => console.log(offlinePack, status)
|
|
255
255
|
* const errorListener = (offlinePack, err) => console.log(offlinePack, err)
|
|
256
|
-
*
|
|
256
|
+
* MapLibreGL.offlineManager.subscribe('packName', progressListener, errorListener)
|
|
257
257
|
*
|
|
258
258
|
* @param {String} packName Name of the offline pack.
|
|
259
259
|
* @param {Callback} progressListener Callback that listens for status events while downloading the offline resource.
|
|
@@ -265,7 +265,7 @@ class OfflineManager {
|
|
|
265
265
|
if (isFunction(progressListener)) {
|
|
266
266
|
if (totalProgressListeners === 0) {
|
|
267
267
|
this.subscriptionProgress = OfflineModuleEventEmitter.addListener(
|
|
268
|
-
|
|
268
|
+
MapLibreGL.OfflineCallbackName.Progress,
|
|
269
269
|
this._onProgress,
|
|
270
270
|
);
|
|
271
271
|
}
|
|
@@ -276,7 +276,7 @@ class OfflineManager {
|
|
|
276
276
|
if (isFunction(errorListener)) {
|
|
277
277
|
if (totalErrorListeners === 0) {
|
|
278
278
|
this.subscriptionError = OfflineModuleEventEmitter.addListener(
|
|
279
|
-
|
|
279
|
+
MapLibreGL.OfflineCallbackName.Error,
|
|
280
280
|
this._onError,
|
|
281
281
|
);
|
|
282
282
|
}
|
|
@@ -288,7 +288,7 @@ class OfflineManager {
|
|
|
288
288
|
if (isAndroid() && this._offlinePacks[packName]) {
|
|
289
289
|
try {
|
|
290
290
|
// manually set a listener, since listeners are only set on create flow
|
|
291
|
-
await
|
|
291
|
+
await MapLibreGLOfflineManager.setPackObserver(packName);
|
|
292
292
|
} catch (e) {
|
|
293
293
|
console.log('Unable to set pack observer', e);
|
|
294
294
|
}
|
|
@@ -300,7 +300,7 @@ class OfflineManager {
|
|
|
300
300
|
* It's a good idea to call this on componentWillUnmount.
|
|
301
301
|
*
|
|
302
302
|
* @example
|
|
303
|
-
*
|
|
303
|
+
* MapLibreGL.offlineManager.unsubscribe('packName')
|
|
304
304
|
*
|
|
305
305
|
* @param {String} packName Name of the offline pack.
|
|
306
306
|
* @return {void}
|
|
@@ -329,7 +329,7 @@ class OfflineManager {
|
|
|
329
329
|
return true;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
const nativeOfflinePacks = await
|
|
332
|
+
const nativeOfflinePacks = await MapLibreGLOfflineManager.getPacks();
|
|
333
333
|
|
|
334
334
|
for (const nativeOfflinePack of nativeOfflinePacks) {
|
|
335
335
|
const offlinePack = new OfflinePack(nativeOfflinePack);
|
|
@@ -351,7 +351,7 @@ class OfflineManager {
|
|
|
351
351
|
this._progressListeners[name](pack, e.payload);
|
|
352
352
|
|
|
353
353
|
// cleanup listeners now that they are no longer needed
|
|
354
|
-
if (state ===
|
|
354
|
+
if (state === MapLibreGL.OfflinePackDownloadState.Complete) {
|
|
355
355
|
this.unsubscribe(name);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -3,7 +3,7 @@ import {makePoint, makeFeatureCollection} from '../../utils/geoUtils';
|
|
|
3
3
|
|
|
4
4
|
import {NativeModules} from 'react-native';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
7
7
|
|
|
8
8
|
class SnapshotOptions {
|
|
9
9
|
constructor(options = {}) {
|
|
@@ -13,7 +13,7 @@ class SnapshotOptions {
|
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
this.styleURL = options.styleURL ||
|
|
16
|
+
this.styleURL = options.styleURL || MapLibreGL.StyleURL.Street;
|
|
17
17
|
this.heading = options.heading || 0.0;
|
|
18
18
|
this.pitch = options.pitch || 0.0;
|
|
19
19
|
this.zoomLevel = options.zoomLevel || 16.0;
|
|
@@ -2,7 +2,7 @@ import SnapshotOptions from './SnapshotOptions';
|
|
|
2
2
|
|
|
3
3
|
import {NativeModules} from 'react-native';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const MapLibreGLSnapshotManger = NativeModules.MGLSnapshotModule;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The snapshotManager generates static raster images of the map.
|
|
@@ -16,35 +16,35 @@ class SnapshotManager {
|
|
|
16
16
|
* @example
|
|
17
17
|
*
|
|
18
18
|
* // creates a temp file png of base map
|
|
19
|
-
* const uri = await
|
|
19
|
+
* const uri = await MapLibreGL.snapshotManager.takeSnap({
|
|
20
20
|
* centerCoordinate: [-74.126410, 40.797968],
|
|
21
21
|
* width: width,
|
|
22
22
|
* height: height,
|
|
23
23
|
* zoomLevel: 12,
|
|
24
24
|
* pitch: 30,
|
|
25
25
|
* heading: 20,
|
|
26
|
-
* styleURL:
|
|
26
|
+
* styleURL: MapLibreGL.StyleURL.Dark,
|
|
27
27
|
* writeToDisk: true, // Create a temporary file
|
|
28
28
|
* });
|
|
29
29
|
*
|
|
30
30
|
* // creates base64 png of base map without logo
|
|
31
|
-
* const uri = await
|
|
31
|
+
* const uri = await MapLibreGL.snapshotManager.takeSnap({
|
|
32
32
|
* centerCoordinate: [-74.126410, 40.797968],
|
|
33
33
|
* width: width,
|
|
34
34
|
* height: height,
|
|
35
35
|
* zoomLevel: 12,
|
|
36
36
|
* pitch: 30,
|
|
37
37
|
* heading: 20,
|
|
38
|
-
* styleURL:
|
|
38
|
+
* styleURL: MapLibreGL.StyleURL.Dark,
|
|
39
39
|
* withLogo: false, // Disable Mapbox logo (Android only)
|
|
40
40
|
* });
|
|
41
41
|
*
|
|
42
42
|
* // creates snapshot with bounds
|
|
43
|
-
* const uri = await
|
|
43
|
+
* const uri = await MapLibreGL.snapshotManager.takeSnap({
|
|
44
44
|
* bounds: [[-74.126410, 40.797968], [-74.143727, 40.772177]],
|
|
45
45
|
* width: width,
|
|
46
46
|
* height: height,
|
|
47
|
-
* styleURL:
|
|
47
|
+
* styleURL: MapLibreGL.StyleURL.Dark,
|
|
48
48
|
* });
|
|
49
49
|
*
|
|
50
50
|
* @param {SnapshotOptions} options Snapshot options for create a static image of the base map
|
|
@@ -53,7 +53,7 @@ class SnapshotManager {
|
|
|
53
53
|
async takeSnap(options = {}) {
|
|
54
54
|
const snapshotOptions = new SnapshotOptions(options);
|
|
55
55
|
|
|
56
|
-
const uri = await
|
|
56
|
+
const uri = await MapLibreGLSnapshotManger.takeSnap(snapshotOptions);
|
|
57
57
|
return uri;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -24,11 +24,19 @@ export function getStyleType(styleProp) {
|
|
|
24
24
|
return styleMap[styleProp];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
throw new Error(`${styleProp} is not a valid
|
|
27
|
+
throw new Error(`${styleProp} is not a valid MapLibre layer style`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const FillLayerStyleProp = PropTypes.shape({
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
|
|
34
|
+
*/
|
|
35
|
+
fillSortKey: PropTypes.oneOfType([
|
|
36
|
+
PropTypes.number,
|
|
37
|
+
PropTypes.array,
|
|
38
|
+
]),
|
|
39
|
+
|
|
32
40
|
/**
|
|
33
41
|
* Whether this layer is displayed.
|
|
34
42
|
*/
|
|
@@ -172,6 +180,14 @@ export const LineLayerStyleProp = PropTypes.shape({
|
|
|
172
180
|
PropTypes.array,
|
|
173
181
|
]),
|
|
174
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
|
|
185
|
+
*/
|
|
186
|
+
lineSortKey: PropTypes.oneOfType([
|
|
187
|
+
PropTypes.number,
|
|
188
|
+
PropTypes.array,
|
|
189
|
+
]),
|
|
190
|
+
|
|
175
191
|
/**
|
|
176
192
|
* Whether this layer is displayed.
|
|
177
193
|
*/
|
|
@@ -366,7 +382,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
366
382
|
]),
|
|
367
383
|
|
|
368
384
|
/**
|
|
369
|
-
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like
|
|
385
|
+
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.
|
|
370
386
|
*/
|
|
371
387
|
symbolAvoidEdges: PropTypes.oneOfType([
|
|
372
388
|
PropTypes.bool,
|
|
@@ -374,7 +390,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
374
390
|
]),
|
|
375
391
|
|
|
376
392
|
/**
|
|
377
|
-
* Sorts features in ascending order based on this value. Features with
|
|
393
|
+
* Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `iconAllowOverlap` or `textAllowOverlap` is `false`, features with a lower sort key will have priority during placement. When `iconAllowOverlap` or `textAllowOverlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key.
|
|
378
394
|
*/
|
|
379
395
|
symbolSortKey: PropTypes.oneOfType([
|
|
380
396
|
PropTypes.number,
|
|
@@ -382,7 +398,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
382
398
|
]),
|
|
383
399
|
|
|
384
400
|
/**
|
|
385
|
-
*
|
|
401
|
+
* Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their yPosition relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbolSortKey`.
|
|
386
402
|
*/
|
|
387
403
|
symbolZOrder: PropTypes.oneOfType([
|
|
388
404
|
PropTypes.oneOf(['auto', 'viewport-y', 'source']),
|
|
@@ -393,6 +409,8 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
393
409
|
* If true, the icon will be visible even if it collides with other previously drawn symbols.
|
|
394
410
|
*
|
|
395
411
|
* @requires iconImage
|
|
412
|
+
*
|
|
413
|
+
* @disabledBy iconOverlap
|
|
396
414
|
*/
|
|
397
415
|
iconAllowOverlap: PropTypes.oneOfType([
|
|
398
416
|
PropTypes.bool,
|
|
@@ -479,7 +497,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
479
497
|
]),
|
|
480
498
|
|
|
481
499
|
/**
|
|
482
|
-
* Size of
|
|
500
|
+
* Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides.
|
|
483
501
|
*
|
|
484
502
|
* @requires iconImage
|
|
485
503
|
*/
|
|
@@ -544,7 +562,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
544
562
|
* @requires textField
|
|
545
563
|
*/
|
|
546
564
|
textRotationAlignment: PropTypes.oneOfType([
|
|
547
|
-
PropTypes.oneOf(['map', 'viewport', 'auto']),
|
|
565
|
+
PropTypes.oneOf(['map', 'viewport', 'viewport-glyph', 'auto']),
|
|
548
566
|
PropTypes.array,
|
|
549
567
|
]),
|
|
550
568
|
|
|
@@ -718,6 +736,8 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
718
736
|
* If true, the text will be visible even if it collides with other previously drawn symbols.
|
|
719
737
|
*
|
|
720
738
|
* @requires textField
|
|
739
|
+
*
|
|
740
|
+
* @disabledBy textOverlap
|
|
721
741
|
*/
|
|
722
742
|
textAllowOverlap: PropTypes.oneOfType([
|
|
723
743
|
PropTypes.bool,
|
|
@@ -988,6 +1008,14 @@ export const SymbolLayerStyleProp = PropTypes.shape({
|
|
|
988
1008
|
|
|
989
1009
|
export const CircleLayerStyleProp = PropTypes.shape({
|
|
990
1010
|
|
|
1011
|
+
/**
|
|
1012
|
+
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
|
|
1013
|
+
*/
|
|
1014
|
+
circleSortKey: PropTypes.oneOfType([
|
|
1015
|
+
PropTypes.number,
|
|
1016
|
+
PropTypes.array,
|
|
1017
|
+
]),
|
|
1018
|
+
|
|
991
1019
|
/**
|
|
992
1020
|
* Whether this layer is displayed.
|
|
993
1021
|
*/
|
|
@@ -1667,6 +1695,7 @@ export const LightLayerStyleProp = PropTypes.shape({
|
|
|
1667
1695
|
|
|
1668
1696
|
|
|
1669
1697
|
const styleMap = {
|
|
1698
|
+
fillSortKey: StyleTypes.Constant,
|
|
1670
1699
|
fillAntialias: StyleTypes.Constant,
|
|
1671
1700
|
fillOpacity: StyleTypes.Constant,
|
|
1672
1701
|
fillOpacityTransition: StyleTypes.Transition,
|
|
@@ -1684,6 +1713,7 @@ const styleMap = {
|
|
|
1684
1713
|
lineJoin: StyleTypes.Enum,
|
|
1685
1714
|
lineMiterLimit: StyleTypes.Constant,
|
|
1686
1715
|
lineRoundLimit: StyleTypes.Constant,
|
|
1716
|
+
lineSortKey: StyleTypes.Constant,
|
|
1687
1717
|
lineOpacity: StyleTypes.Constant,
|
|
1688
1718
|
lineOpacityTransition: StyleTypes.Transition,
|
|
1689
1719
|
lineColor: StyleTypes.Color,
|
|
@@ -1773,6 +1803,7 @@ const styleMap = {
|
|
|
1773
1803
|
textTranslateTransition: StyleTypes.Transition,
|
|
1774
1804
|
textTranslateAnchor: StyleTypes.Enum,
|
|
1775
1805
|
|
|
1806
|
+
circleSortKey: StyleTypes.Constant,
|
|
1776
1807
|
circleRadius: StyleTypes.Constant,
|
|
1777
1808
|
circleRadiusTransition: StyleTypes.Transition,
|
|
1778
1809
|
circleColor: StyleTypes.Color,
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "A MapLibre GL Native plugin for creating maps in React Native",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"author": "MapLibre",
|
|
9
9
|
"main": "./javascript/index.js",
|
|
10
10
|
"keywords": [
|
|
11
|
-
"
|
|
11
|
+
"maps",
|
|
12
12
|
"ios",
|
|
13
13
|
"android",
|
|
14
|
-
"mapbox",
|
|
15
14
|
"maplibre",
|
|
16
|
-
"react-native"
|
|
15
|
+
"react-native",
|
|
16
|
+
"mapbox"
|
|
17
17
|
],
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/maplibre/maplibre-react-native"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"fetch:style:spec": "
|
|
24
|
+
"fetch:style:spec": "./scripts/download-style-spec.sh",
|
|
25
25
|
"generate": "yarn node ./scripts/autogenerate",
|
|
26
26
|
"test": "npm run lint && npm run unittest",
|
|
27
27
|
"unittest": "jest",
|
|
@@ -2,7 +2,7 @@ import { ConfigPlugin, XcodeProject } from '@expo/config-plugins';
|
|
|
2
2
|
type InstallerBlockName = 'pre' | 'post';
|
|
3
3
|
export declare function applyCocoaPodsModifications(contents: string): string;
|
|
4
4
|
export declare function addInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function addMapLibreInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
6
6
|
/**
|
|
7
7
|
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
8
8
|
* Without this, production builds targeting simulators will fail.
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setExcludedArchitectures = exports.
|
|
6
|
+
exports.setExcludedArchitectures = exports.addMapLibreInstallerBlock = exports.addInstallerBlock = exports.applyCocoaPodsModifications = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
@@ -43,8 +43,8 @@ function applyCocoaPodsModifications(contents) {
|
|
|
43
43
|
// Ensure installer blocks exist
|
|
44
44
|
let src = addInstallerBlock(contents, 'pre');
|
|
45
45
|
// src = addInstallerBlock(src, "post");
|
|
46
|
-
src =
|
|
47
|
-
// src =
|
|
46
|
+
src = addMapLibreInstallerBlock(src, 'pre');
|
|
47
|
+
// src = addMapLibreInstallerBlock(src, "post");
|
|
48
48
|
return src;
|
|
49
49
|
}
|
|
50
50
|
exports.applyCocoaPodsModifications = applyCocoaPodsModifications;
|
|
@@ -77,7 +77,7 @@ function addInstallerBlock(src, blockName) {
|
|
|
77
77
|
}).contents;
|
|
78
78
|
}
|
|
79
79
|
exports.addInstallerBlock = addInstallerBlock;
|
|
80
|
-
function
|
|
80
|
+
function addMapLibreInstallerBlock(src, blockName) {
|
|
81
81
|
return (0, generateCode_1.mergeContents)({
|
|
82
82
|
tag: `@maplibre/maplibre-react-native-${blockName}_installer`,
|
|
83
83
|
src,
|
|
@@ -87,7 +87,7 @@ function addMapboxInstallerBlock(src, blockName) {
|
|
|
87
87
|
comment: '#',
|
|
88
88
|
}).contents;
|
|
89
89
|
}
|
|
90
|
-
exports.
|
|
90
|
+
exports.addMapLibreInstallerBlock = addMapLibreInstallerBlock;
|
|
91
91
|
/**
|
|
92
92
|
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
93
93
|
* Without this, production builds targeting simulators will fail.
|
|
@@ -112,8 +112,8 @@ const withExcludedSimulatorArchitectures = c => {
|
|
|
112
112
|
return config;
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
|
-
const
|
|
115
|
+
const withMapLibre = config => {
|
|
116
116
|
config = withExcludedSimulatorArchitectures(config);
|
|
117
117
|
return withCocoaPodsInstallerBlocks(config);
|
|
118
118
|
};
|
|
119
|
-
exports.default = (0, config_plugins_1.createRunOncePlugin)(
|
|
119
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withMapLibre, pkg.name, pkg.version);
|
package/plugin/install.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Expo installation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
NOTE: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).
|
|
4
4
|
|
|
5
5
|
First install the package with `yarn`, `npm`, or [`expo install`](https://docs.expo.io/workflow/expo-cli/#expo-install).
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
echo "Downloading
|
|
3
|
+
echo "Downloading MapLibre Style Spec"
|
|
4
4
|
cd style-spec/
|
|
5
5
|
|
|
6
6
|
FILENAME=v8.json
|
|
@@ -11,5 +11,5 @@ if [ -e "./${FILENAME}" ]; then
|
|
|
11
11
|
fi
|
|
12
12
|
|
|
13
13
|
echo "Fetching new style spec ${FILENAME}"
|
|
14
|
-
curl -sS https://raw.githubusercontent.com/
|
|
14
|
+
curl -sS https://raw.githubusercontent.com/maplibre/maplibre-gl-js/master/src/style-spec/reference/${FILENAME} -o ${FILENAME}
|
|
15
15
|
cd ..
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const component = locals.component;
|
|
3
3
|
-%>
|
|
4
4
|
<!-- This file was autogenerated from <%- component.name %>.js do not modify -->
|
|
5
|
-
## <
|
|
5
|
+
## <MapLibreGL.<%- component.name %> />
|
|
6
6
|
### <%- replaceNewLine(component.description) %>
|
|
7
7
|
|
|
8
8
|
<%_ if (component.props && component.props.length) { _%>
|
|
@@ -27,7 +27,7 @@ export function getStyleType(styleProp) {
|
|
|
27
27
|
return styleMap[styleProp];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
throw new Error(`${styleProp} is not a valid
|
|
30
|
+
throw new Error(`${styleProp} is not a valid MapLibre layer style`);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
<%_ for (let layer of layers) { _%>
|