@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
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
} from 'react-native';
|
|
22
22
|
import {debounce} from 'debounce';
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
25
|
+
if (MapLibreGL == null) {
|
|
26
26
|
console.error(
|
|
27
27
|
'Native part of Mapbox React Native libraries were not registered properly, double check our native installation guides.',
|
|
28
28
|
);
|
|
@@ -36,10 +36,10 @@ const styles = StyleSheet.create({
|
|
|
36
36
|
matchParent: {flex: 1},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const defaultStyleURL =
|
|
39
|
+
const defaultStyleURL = MapLibreGL.StyleURL.Street;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* MapView backed by
|
|
42
|
+
* MapView backed by MapLibre GL Native
|
|
43
43
|
*/
|
|
44
44
|
class MapView extends NativeBridgeComponent(React.Component) {
|
|
45
45
|
static propTypes = {
|
|
@@ -59,7 +59,7 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
59
59
|
style: PropTypes.any,
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Style URL for map - notice, if non is set it _will_ default to `
|
|
62
|
+
* Style URL for map - notice, if non is set it _will_ default to `MapLibreGL.StyleURL.Street`
|
|
63
63
|
*/
|
|
64
64
|
styleURL: PropTypes.string,
|
|
65
65
|
|
|
@@ -106,13 +106,10 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
106
106
|
rotateEnabled: PropTypes.bool,
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
|
|
110
|
-
* [requires](https://www.mapbox.com/help/how-attribution-works/) these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
|
|
111
|
-
* If that applies to this map view, do not hide this view or remove any notices from it.
|
|
112
|
-
*
|
|
113
|
-
* If this view is hidden, you must implement this setting elsewhere in your app. See our website for [Android](https://www.mapbox.com/android-docs/map-sdk/overview/#telemetry-opt-out) and [iOS](https://www.mapbox.com/ios-sdk/#telemetry_opt_out) for implementation details.
|
|
114
|
-
*
|
|
115
109
|
* Enable/Disable attribution on map.
|
|
110
|
+
*
|
|
111
|
+
* This must be enabled for Mapbox-hosted tiles and styles. Please refer to the Mapbox Terms of Service.
|
|
112
|
+
* Other providers do not require this.
|
|
116
113
|
*/
|
|
117
114
|
attributionEnabled: PropTypes.bool,
|
|
118
115
|
|
|
@@ -269,7 +266,7 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
269
266
|
pitchEnabled: true,
|
|
270
267
|
rotateEnabled: true,
|
|
271
268
|
attributionEnabled: true,
|
|
272
|
-
logoEnabled:
|
|
269
|
+
logoEnabled: false,
|
|
273
270
|
surfaceView: false,
|
|
274
271
|
regionWillChangeDebounceTime: 10,
|
|
275
272
|
regionDidChangeDebounceTime: 500,
|
|
@@ -326,46 +323,46 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
326
323
|
const events = [];
|
|
327
324
|
|
|
328
325
|
if (props.onRegionWillChange) {
|
|
329
|
-
events.push(
|
|
326
|
+
events.push(MapLibreGL.EventTypes.RegionWillChange);
|
|
330
327
|
}
|
|
331
328
|
if (props.onRegionIsChanging) {
|
|
332
|
-
events.push(
|
|
329
|
+
events.push(MapLibreGL.EventTypes.RegionIsChanging);
|
|
333
330
|
}
|
|
334
331
|
if (props.onRegionDidChange) {
|
|
335
|
-
events.push(
|
|
332
|
+
events.push(MapLibreGL.EventTypes.RegionDidChange);
|
|
336
333
|
}
|
|
337
334
|
if (props.onUserLocationUpdate) {
|
|
338
|
-
events.push(
|
|
335
|
+
events.push(MapLibreGL.EventTypes.UserLocationUpdated);
|
|
339
336
|
}
|
|
340
337
|
if (props.onWillStartLoadingMap) {
|
|
341
|
-
events.push(
|
|
338
|
+
events.push(MapLibreGL.EventTypes.WillStartLoadingMap);
|
|
342
339
|
}
|
|
343
340
|
if (props.onDidFinishLoadingMap) {
|
|
344
|
-
events.push(
|
|
341
|
+
events.push(MapLibreGL.EventTypes.DidFinishLoadingMap);
|
|
345
342
|
}
|
|
346
343
|
if (props.onDidFailLoadingMap) {
|
|
347
|
-
events.push(
|
|
344
|
+
events.push(MapLibreGL.EventTypes.DidFailLoadingMap);
|
|
348
345
|
}
|
|
349
346
|
if (props.onWillStartRenderingFrame) {
|
|
350
|
-
events.push(
|
|
347
|
+
events.push(MapLibreGL.EventTypes.WillStartRenderingFrame);
|
|
351
348
|
}
|
|
352
349
|
if (props.onDidFinishRenderingFrame) {
|
|
353
|
-
events.push(
|
|
350
|
+
events.push(MapLibreGL.EventTypes.DidFinishRenderingFrame);
|
|
354
351
|
}
|
|
355
352
|
if (props.onDidFinishRenderingFrameFully) {
|
|
356
|
-
events.push(
|
|
353
|
+
events.push(MapLibreGL.EventTypes.DidFinishRenderingFrameFully);
|
|
357
354
|
}
|
|
358
355
|
if (props.onWillStartRenderingMap) {
|
|
359
|
-
events.push(
|
|
356
|
+
events.push(MapLibreGL.EventTypes.WillStartRenderingMap);
|
|
360
357
|
}
|
|
361
358
|
if (props.onDidFinishRenderingMap) {
|
|
362
|
-
events.push(
|
|
359
|
+
events.push(MapLibreGL.EventTypes.DidFinishRenderingMap);
|
|
363
360
|
}
|
|
364
361
|
if (props.onDidFinishRenderingMapFully) {
|
|
365
|
-
events.push(
|
|
362
|
+
events.push(MapLibreGL.EventTypes.DidFinishRenderingMapFully);
|
|
366
363
|
}
|
|
367
364
|
if (props.onDidFinishLoadingStyle) {
|
|
368
|
-
events.push(
|
|
365
|
+
events.push(MapLibreGL.EventTypes.DidFinishLoadingStyle);
|
|
369
366
|
}
|
|
370
367
|
|
|
371
368
|
this._runNativeCommand(
|
|
@@ -564,7 +561,7 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
564
561
|
|
|
565
562
|
_createStopConfig(config = {}) {
|
|
566
563
|
const stopConfig = {
|
|
567
|
-
mode: isNumber(config.mode) ? config.mode :
|
|
564
|
+
mode: isNumber(config.mode) ? config.mode : MapLibreGL.CameraModes.Ease,
|
|
568
565
|
pitch: config.pitch,
|
|
569
566
|
heading: config.heading,
|
|
570
567
|
duration: config.duration || 2000,
|
|
@@ -623,54 +620,54 @@ class MapView extends NativeBridgeComponent(React.Component) {
|
|
|
623
620
|
let propName = '';
|
|
624
621
|
|
|
625
622
|
switch (type) {
|
|
626
|
-
case
|
|
623
|
+
case MapLibreGL.EventTypes.RegionWillChange:
|
|
627
624
|
if (regionWillChangeDebounceTime > 0) {
|
|
628
625
|
this._onDebouncedRegionWillChange(payload);
|
|
629
626
|
} else {
|
|
630
627
|
propName = 'onRegionWillChange';
|
|
631
628
|
}
|
|
632
629
|
break;
|
|
633
|
-
case
|
|
630
|
+
case MapLibreGL.EventTypes.RegionIsChanging:
|
|
634
631
|
propName = 'onRegionIsChanging';
|
|
635
632
|
break;
|
|
636
|
-
case
|
|
633
|
+
case MapLibreGL.EventTypes.RegionDidChange:
|
|
637
634
|
if (regionDidChangeDebounceTime > 0) {
|
|
638
635
|
this._onDebouncedRegionDidChange(payload);
|
|
639
636
|
} else {
|
|
640
637
|
propName = 'onRegionDidChange';
|
|
641
638
|
}
|
|
642
639
|
break;
|
|
643
|
-
case
|
|
640
|
+
case MapLibreGL.EventTypes.UserLocationUpdated:
|
|
644
641
|
propName = 'onUserLocationUpdate';
|
|
645
642
|
break;
|
|
646
|
-
case
|
|
643
|
+
case MapLibreGL.EventTypes.WillStartLoadingMap:
|
|
647
644
|
propName = 'onWillStartLoadingMap';
|
|
648
645
|
break;
|
|
649
|
-
case
|
|
646
|
+
case MapLibreGL.EventTypes.DidFinishLoadingMap:
|
|
650
647
|
propName = 'onDidFinishLoadingMap';
|
|
651
648
|
break;
|
|
652
|
-
case
|
|
649
|
+
case MapLibreGL.EventTypes.DidFailLoadingMap:
|
|
653
650
|
propName = 'onDidFailLoadingMap';
|
|
654
651
|
break;
|
|
655
|
-
case
|
|
652
|
+
case MapLibreGL.EventTypes.WillStartRenderingFrame:
|
|
656
653
|
propName = 'onWillStartRenderingFrame';
|
|
657
654
|
break;
|
|
658
|
-
case
|
|
655
|
+
case MapLibreGL.EventTypes.DidFinishRenderingFrame:
|
|
659
656
|
propName = 'onDidFinishRenderingFrame';
|
|
660
657
|
break;
|
|
661
|
-
case
|
|
658
|
+
case MapLibreGL.EventTypes.DidFinishRenderingFrameFully:
|
|
662
659
|
propName = 'onDidFinishRenderingFrameFully';
|
|
663
660
|
break;
|
|
664
|
-
case
|
|
661
|
+
case MapLibreGL.EventTypes.WillStartRenderingMap:
|
|
665
662
|
propName = 'onWillStartRenderingMap';
|
|
666
663
|
break;
|
|
667
|
-
case
|
|
664
|
+
case MapLibreGL.EventTypes.DidFinishRenderingMap:
|
|
668
665
|
propName = 'onDidFinishRenderingMap';
|
|
669
666
|
break;
|
|
670
|
-
case
|
|
667
|
+
case MapLibreGL.EventTypes.DidFinishRenderingMapFully:
|
|
671
668
|
propName = 'onDidFinishRenderingMapFully';
|
|
672
669
|
break;
|
|
673
|
-
case
|
|
670
|
+
case MapLibreGL.EventTypes.DidFinishLoadingStyle:
|
|
674
671
|
propName = 'onDidFinishLoadingStyle';
|
|
675
672
|
break;
|
|
676
673
|
default:
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
11
11
|
|
|
12
12
|
export const NATIVE_MODULE_NAME = 'RCTMGLRasterLayer';
|
|
13
13
|
|
|
@@ -72,7 +72,7 @@ class RasterLayer extends AbstractLayer {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
static defaultProps = {
|
|
75
|
-
sourceID:
|
|
75
|
+
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
render() {
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
10
10
|
|
|
11
11
|
export const NATIVE_MODULE_NAME = 'RCTMGLRasterSource';
|
|
12
12
|
|
|
@@ -72,7 +72,7 @@ class RasterSource extends AbstractSource {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
static defaultProps = {
|
|
75
|
-
id:
|
|
75
|
+
id: MapLibreGL.StyleSource.DefaultSourceID,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
constructor(props) {
|
|
@@ -15,7 +15,7 @@ import PropTypes from 'prop-types';
|
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
19
19
|
|
|
20
20
|
export const NATIVE_MODULE_NAME = 'RCTMGLShapeSource';
|
|
21
21
|
|
|
@@ -120,7 +120,7 @@ class ShapeSource extends NativeBridgeComponent(AbstractSource) {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
static defaultProps = {
|
|
123
|
-
id:
|
|
123
|
+
id: MapLibreGL.StyleSource.DefaultSourceID,
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
constructor(props) {
|
|
@@ -193,8 +193,8 @@ function asSourceComponent(id, source) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* Style is a component that automatically adds sources / layers to the map using
|
|
197
|
-
* Only [`sources`](https://
|
|
196
|
+
* Style is a component that automatically adds sources / layers to the map using MapLibre Style Spec.
|
|
197
|
+
* Only [`sources`](https://maplibre.org/maplibre-gl-js-docs/style-spec/sources/) & [`layers`](https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/) are supported.
|
|
198
198
|
* Other fields such as `sprites`, `glyphs` etc. will be ignored. Not all layer / source attributes from the style spec are supported, in general the supported attributes will be mentioned under https://github.com/maplibre/maplibre-react-native/tree/main/docs.
|
|
199
199
|
*
|
|
200
200
|
* TODO: Maintainer forking this project does not understand the above comment regarding what is supported.
|
|
@@ -256,7 +256,7 @@ const Style = props => {
|
|
|
256
256
|
|
|
257
257
|
Style.propTypes = {
|
|
258
258
|
/**
|
|
259
|
-
* A JSON object conforming to the schema described in the
|
|
259
|
+
* A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON.
|
|
260
260
|
*/
|
|
261
261
|
json: PropTypes.any,
|
|
262
262
|
};
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {View, NativeModules, requireNativeComponent} from 'react-native';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
11
11
|
|
|
12
12
|
export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer';
|
|
13
13
|
|
|
@@ -75,7 +75,7 @@ class SymbolLayer extends AbstractLayer {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
static defaultProps = {
|
|
78
|
-
sourceID:
|
|
78
|
+
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
_shouldSnapshot() {
|
|
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
|
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
18
18
|
|
|
19
19
|
export const NATIVE_MODULE_NAME = 'RCTMGLVectorSource';
|
|
20
20
|
|
|
@@ -94,7 +94,7 @@ class VectorSource extends NativeBridgeComponent(AbstractSource) {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
static defaultProps = {
|
|
97
|
-
id:
|
|
97
|
+
id: MapLibreGL.StyleSource.DefaultSourceID,
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
constructor(props) {
|
package/javascript/index.js
CHANGED
|
@@ -32,16 +32,12 @@ import AnimatedRouteCoordinatesArray from './utils/animated/AnimatedRouteCoordin
|
|
|
32
32
|
import Style from './components/Style';
|
|
33
33
|
import Logger from './utils/Logger';
|
|
34
34
|
|
|
35
|
-
import {
|
|
36
|
-
Animated as RNAnimated,
|
|
37
|
-
NativeModules,
|
|
38
|
-
PermissionsAndroid,
|
|
39
|
-
} from 'react-native';
|
|
35
|
+
import {NativeModules, PermissionsAndroid} from 'react-native';
|
|
40
36
|
|
|
41
|
-
const
|
|
37
|
+
const MapLibreGL = {...NativeModules.MGLModule};
|
|
42
38
|
|
|
43
39
|
// static methods
|
|
44
|
-
|
|
40
|
+
MapLibreGL.requestAndroidLocationPermissions = async function () {
|
|
45
41
|
if (isAndroid()) {
|
|
46
42
|
const res = await PermissionsAndroid.requestMultiple([
|
|
47
43
|
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
|
@@ -65,56 +61,56 @@ MapboxGL.requestAndroidLocationPermissions = async function () {
|
|
|
65
61
|
throw new Error('You should only call this method on Android!');
|
|
66
62
|
};
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
MapLibreGL.UserTrackingModes = Camera.UserTrackingModes;
|
|
69
65
|
|
|
70
66
|
// components
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
MapLibreGL.MapView = MapView;
|
|
68
|
+
MapLibreGL.Light = Light;
|
|
69
|
+
MapLibreGL.PointAnnotation = PointAnnotation;
|
|
70
|
+
MapLibreGL.Callout = Callout;
|
|
71
|
+
MapLibreGL.UserLocation = UserLocation;
|
|
72
|
+
MapLibreGL.Camera = Camera;
|
|
73
|
+
MapLibreGL.Style = Style;
|
|
78
74
|
|
|
79
75
|
// annotations
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
MapLibreGL.Annotation = Annotation;
|
|
77
|
+
MapLibreGL.MarkerView = MarkerView;
|
|
82
78
|
|
|
83
79
|
// sources
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
MapLibreGL.VectorSource = VectorSource;
|
|
81
|
+
MapLibreGL.ShapeSource = ShapeSource;
|
|
82
|
+
MapLibreGL.RasterSource = RasterSource;
|
|
83
|
+
MapLibreGL.ImageSource = ImageSource;
|
|
84
|
+
MapLibreGL.Images = Images;
|
|
89
85
|
|
|
90
86
|
// layers
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
MapLibreGL.FillLayer = FillLayer;
|
|
88
|
+
MapLibreGL.FillExtrusionLayer = FillExtrusionLayer;
|
|
89
|
+
MapLibreGL.HeatmapLayer = HeatmapLayer;
|
|
90
|
+
MapLibreGL.LineLayer = LineLayer;
|
|
91
|
+
MapLibreGL.CircleLayer = CircleLayer;
|
|
92
|
+
MapLibreGL.SymbolLayer = SymbolLayer;
|
|
93
|
+
MapLibreGL.RasterLayer = RasterLayer;
|
|
94
|
+
MapLibreGL.BackgroundLayer = BackgroundLayer;
|
|
99
95
|
|
|
100
96
|
// modules
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
MapLibreGL.locationManager = locationManager;
|
|
98
|
+
MapLibreGL.offlineManager = offlineManager;
|
|
99
|
+
MapLibreGL.snapshotManager = snapshotManager;
|
|
104
100
|
|
|
105
101
|
// animated
|
|
106
|
-
|
|
102
|
+
MapLibreGL.Animated = Animated;
|
|
107
103
|
|
|
108
104
|
// utils
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
MapLibreGL.AnimatedPoint = AnimatedMapPoint;
|
|
106
|
+
MapLibreGL.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
|
|
107
|
+
MapLibreGL.AnimatedExtractCoordinateFromArray =
|
|
112
108
|
AnimatedExtractCoordinateFromArray;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
MapLibreGL.AnimatedRouteCoordinatesArray = AnimatedRouteCoordinatesArray;
|
|
110
|
+
MapLibreGL.AnimatedShape = AnimatedShape;
|
|
111
|
+
MapLibreGL.Logger = Logger;
|
|
116
112
|
|
|
117
|
-
const {LineJoin} =
|
|
113
|
+
const {LineJoin} = MapLibreGL;
|
|
118
114
|
|
|
119
115
|
export {
|
|
120
116
|
MapView,
|
|
@@ -150,4 +146,4 @@ export {
|
|
|
150
146
|
Style,
|
|
151
147
|
};
|
|
152
148
|
|
|
153
|
-
export default
|
|
149
|
+
export default MapLibreGL;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {NativeModules, NativeEventEmitter} from 'react-native';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const MapLibreGL = NativeModules.MGLModule;
|
|
4
|
+
const MapLibreGLLocationManager = NativeModules.MGLLocationModule;
|
|
5
5
|
|
|
6
6
|
export const LocationModuleEventEmitter = new NativeEventEmitter(
|
|
7
|
-
|
|
7
|
+
MapLibreGLLocationManager,
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
class LocationManager {
|
|
@@ -26,7 +26,7 @@ class LocationManager {
|
|
|
26
26
|
// instead of throwing an exception
|
|
27
27
|
try {
|
|
28
28
|
lastKnownLocation =
|
|
29
|
-
await
|
|
29
|
+
await MapLibreGLLocationManager.getLastKnownLocation();
|
|
30
30
|
} catch (error) {
|
|
31
31
|
console.log('locationManager Error: ', error);
|
|
32
32
|
}
|
|
@@ -66,10 +66,10 @@ class LocationManager {
|
|
|
66
66
|
|
|
67
67
|
start(displacement = 0) {
|
|
68
68
|
if (!this._isListening) {
|
|
69
|
-
|
|
69
|
+
MapLibreGLLocationManager.start(displacement);
|
|
70
70
|
|
|
71
71
|
this.subscription = LocationModuleEventEmitter.addListener(
|
|
72
|
-
|
|
72
|
+
MapLibreGL.LocationCallbackName.Update,
|
|
73
73
|
this.onUpdate,
|
|
74
74
|
);
|
|
75
75
|
|
|
@@ -78,7 +78,7 @@ class LocationManager {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
stop() {
|
|
81
|
-
|
|
81
|
+
MapLibreGLLocationManager.stop();
|
|
82
82
|
|
|
83
83
|
if (this._isListening) {
|
|
84
84
|
this.subscription.remove();
|
|
@@ -88,7 +88,7 @@ class LocationManager {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
setMinDisplacement(minDisplacement) {
|
|
91
|
-
|
|
91
|
+
MapLibreGLLocationManager.setMinDisplacement(minDisplacement);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
onUpdate(location) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {NativeModules} from 'react-native';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const MapLibreGLOfflineManager = NativeModules.MGLOfflineModule;
|
|
4
4
|
|
|
5
5
|
class OfflinePack {
|
|
6
6
|
constructor(pack) {
|
|
@@ -25,15 +25,15 @@ class OfflinePack {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
status() {
|
|
28
|
-
return
|
|
28
|
+
return MapLibreGLOfflineManager.getPackStatus(this.name);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
resume() {
|
|
32
|
-
return
|
|
32
|
+
return MapLibreGLOfflineManager.resumePackDownload(this.name);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
pause() {
|
|
36
|
-
return
|
|
36
|
+
return MapLibreGLOfflineManager.pausePackDownload(this.name);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|