@maplibre/maplibre-react-native 8.6.0-beta.2 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +1 -3
  4. package/android/install.md +3 -3
  5. package/android/rctmgl/build.gradle +1 -1
  6. package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +33 -0
  7. package/app.plugin.js +1 -1
  8. package/docs/Annotation.md +1 -1
  9. package/docs/Annotations.md +3 -8
  10. package/docs/BackgroundLayer.md +2 -2
  11. package/docs/Callout.md +1 -1
  12. package/docs/Camera.md +2 -2
  13. package/docs/CircleLayer.md +31 -14
  14. package/docs/CustomHttpHeaders.md +9 -9
  15. package/docs/FillExtrusionLayer.md +2 -2
  16. package/docs/FillLayer.md +27 -10
  17. package/docs/GettingStarted.md +4 -6
  18. package/docs/HeadingIndicator.md +1 -1
  19. package/docs/HeatmapLayer.md +2 -2
  20. package/docs/ImageSource.md +1 -1
  21. package/docs/Images.md +1 -1
  22. package/docs/Light.md +1 -1
  23. package/docs/LineLayer.md +31 -14
  24. package/docs/{MapboxGL.md → MapLibreGL.md} +5 -5
  25. package/docs/MapView.md +5 -5
  26. package/docs/MarkerView.md +1 -1
  27. package/docs/NativeUserLocation.md +1 -1
  28. package/docs/OfflineManager.md +16 -16
  29. package/docs/PointAnnotation.md +1 -1
  30. package/docs/RasterLayer.md +2 -2
  31. package/docs/RasterSource.md +2 -2
  32. package/docs/ShapeSource.md +2 -2
  33. package/docs/Style.md +3 -3
  34. package/docs/StyleSheet.md +93 -72
  35. package/docs/SymbolLayer.md +17 -13
  36. package/docs/UserLocation.md +2 -2
  37. package/docs/VectorSource.md +2 -2
  38. package/docs/docs.json +102 -46
  39. package/docs/snapshotManager.md +7 -7
  40. package/index.d.ts +8 -7
  41. package/ios/RCTMGL/RCTMGLStyle.h +3 -0
  42. package/ios/RCTMGL/RCTMGLStyle.m +23 -2
  43. package/ios/RCTMGL/index.d.ts +24 -5
  44. package/ios/install.md +3 -3
  45. package/javascript/components/BackgroundLayer.js +2 -2
  46. package/javascript/components/Camera.js +6 -6
  47. package/javascript/components/CircleLayer.js +2 -2
  48. package/javascript/components/FillExtrusionLayer.js +2 -2
  49. package/javascript/components/FillLayer.js +2 -2
  50. package/javascript/components/HeatmapLayer.js +2 -2
  51. package/javascript/components/LineLayer.js +2 -2
  52. package/javascript/components/MapView.js +38 -41
  53. package/javascript/components/RasterLayer.js +2 -2
  54. package/javascript/components/RasterSource.js +2 -2
  55. package/javascript/components/ShapeSource.js +2 -2
  56. package/javascript/components/Style.js +3 -3
  57. package/javascript/components/SymbolLayer.js +2 -2
  58. package/javascript/components/UserLocation.js +2 -0
  59. package/javascript/components/VectorSource.js +2 -2
  60. package/javascript/index.js +38 -42
  61. package/javascript/modules/location/locationManager.js +8 -8
  62. package/javascript/modules/offline/OfflinePack.js +4 -4
  63. package/javascript/modules/offline/offlineManager.js +34 -34
  64. package/javascript/modules/snapshot/SnapshotOptions.js +2 -2
  65. package/javascript/modules/snapshot/snapshotManager.js +8 -8
  66. package/javascript/utils/styleMap.js +37 -6
  67. package/maplibre-react-native.podspec +1 -1
  68. package/package.json +5 -5
  69. package/plugin/build/{withMapbox.d.ts → withMapLibre.d.ts} +1 -1
  70. package/plugin/build/{withMapbox.js → withMapLibre.js} +9 -9
  71. package/scripts/download-style-spec.sh +2 -2
  72. package/scripts/templates/component.md.ejs +1 -1
  73. package/scripts/templates/styleMap.js.ejs +1 -1
  74. package/style-spec/v8.json +266 -43
@@ -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 MapboxGL = NativeModules.MGLModule;
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: MapboxGL.StyleSource.DefaultSourceID,
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 MapboxGL = NativeModules.MGLModule;
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: MapboxGL.StyleSource.DefaultSourceID,
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 MapboxGL = NativeModules.MGLModule;
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: MapboxGL.StyleSource.DefaultSourceID,
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 Mapbox GL Style Spec.
197
- * Only [`sources`](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources) & [`layers`](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/) are supported.
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 Mapbox Style Specification , or a URL to such JSON.
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 MapboxGL = NativeModules.MGLModule;
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: MapboxGL.StyleSource.DefaultSourceID,
78
+ sourceID: MapLibreGL.StyleSource.DefaultSourceID,
79
79
  };
80
80
 
81
81
  _shouldSnapshot() {
@@ -104,6 +104,8 @@ class UserLocation extends React.Component {
104
104
 
105
105
  /**
106
106
  * Custom location icon of type mapbox-gl-native components
107
+ *
108
+ * NOTE: Forking maintainer does not understand the above comment.
107
109
  */
108
110
  children: PropTypes.any,
109
111
  };
@@ -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 MapboxGL = NativeModules.MGLModule;
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: MapboxGL.StyleSource.DefaultSourceID,
97
+ id: MapLibreGL.StyleSource.DefaultSourceID,
98
98
  };
99
99
 
100
100
  constructor(props) {
@@ -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 MapboxGL = {...NativeModules.MGLModule};
37
+ const MapLibreGL = {...NativeModules.MGLModule};
42
38
 
43
39
  // static methods
44
- MapboxGL.requestAndroidLocationPermissions = async function () {
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
- MapboxGL.UserTrackingModes = Camera.UserTrackingModes;
64
+ MapLibreGL.UserTrackingModes = Camera.UserTrackingModes;
69
65
 
70
66
  // components
71
- MapboxGL.MapView = MapView;
72
- MapboxGL.Light = Light;
73
- MapboxGL.PointAnnotation = PointAnnotation;
74
- MapboxGL.Callout = Callout;
75
- MapboxGL.UserLocation = UserLocation;
76
- MapboxGL.Camera = Camera;
77
- MapboxGL.Style = Style;
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
- MapboxGL.Annotation = Annotation;
81
- MapboxGL.MarkerView = MarkerView;
76
+ MapLibreGL.Annotation = Annotation;
77
+ MapLibreGL.MarkerView = MarkerView;
82
78
 
83
79
  // sources
84
- MapboxGL.VectorSource = VectorSource;
85
- MapboxGL.ShapeSource = ShapeSource;
86
- MapboxGL.RasterSource = RasterSource;
87
- MapboxGL.ImageSource = ImageSource;
88
- MapboxGL.Images = Images;
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
- MapboxGL.FillLayer = FillLayer;
92
- MapboxGL.FillExtrusionLayer = FillExtrusionLayer;
93
- MapboxGL.HeatmapLayer = HeatmapLayer;
94
- MapboxGL.LineLayer = LineLayer;
95
- MapboxGL.CircleLayer = CircleLayer;
96
- MapboxGL.SymbolLayer = SymbolLayer;
97
- MapboxGL.RasterLayer = RasterLayer;
98
- MapboxGL.BackgroundLayer = BackgroundLayer;
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
- MapboxGL.locationManager = locationManager;
102
- MapboxGL.offlineManager = offlineManager;
103
- MapboxGL.snapshotManager = snapshotManager;
97
+ MapLibreGL.locationManager = locationManager;
98
+ MapLibreGL.offlineManager = offlineManager;
99
+ MapLibreGL.snapshotManager = snapshotManager;
104
100
 
105
101
  // animated
106
- MapboxGL.Animated = Animated;
102
+ MapLibreGL.Animated = Animated;
107
103
 
108
104
  // utils
109
- MapboxGL.AnimatedPoint = AnimatedMapPoint;
110
- MapboxGL.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
111
- MapboxGL.AnimatedExtractCoordinateFromArray =
105
+ MapLibreGL.AnimatedPoint = AnimatedMapPoint;
106
+ MapLibreGL.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
107
+ MapLibreGL.AnimatedExtractCoordinateFromArray =
112
108
  AnimatedExtractCoordinateFromArray;
113
- MapboxGL.AnimatedRouteCoordinatesArray = AnimatedRouteCoordinatesArray;
114
- MapboxGL.AnimatedShape = AnimatedShape;
115
- MapboxGL.Logger = Logger;
109
+ MapLibreGL.AnimatedRouteCoordinatesArray = AnimatedRouteCoordinatesArray;
110
+ MapLibreGL.AnimatedShape = AnimatedShape;
111
+ MapLibreGL.Logger = Logger;
116
112
 
117
- const {LineJoin} = MapboxGL;
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 MapboxGL;
149
+ export default MapLibreGL;
@@ -1,10 +1,10 @@
1
1
  import {NativeModules, NativeEventEmitter} from 'react-native';
2
2
 
3
- const MapboxGL = NativeModules.MGLModule;
4
- const MapboxGLLocationManager = NativeModules.MGLLocationModule;
3
+ const MapLibreGL = NativeModules.MGLModule;
4
+ const MapLibreGLLocationManager = NativeModules.MGLLocationModule;
5
5
 
6
6
  export const LocationModuleEventEmitter = new NativeEventEmitter(
7
- MapboxGLLocationManager,
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 MapboxGLLocationManager.getLastKnownLocation();
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
- MapboxGLLocationManager.start(displacement);
69
+ MapLibreGLLocationManager.start(displacement);
70
70
 
71
71
  this.subscription = LocationModuleEventEmitter.addListener(
72
- MapboxGL.LocationCallbackName.Update,
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
- MapboxGLLocationManager.stop();
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
- MapboxGLLocationManager.setMinDisplacement(minDisplacement);
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 MapboxGLOfflineManager = NativeModules.MGLOfflineModule;
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 MapboxGLOfflineManager.getPackStatus(this.name);
28
+ return MapLibreGLOfflineManager.getPackStatus(this.name);
29
29
  }
30
30
 
31
31
  resume() {
32
- return MapboxGLOfflineManager.resumePackDownload(this.name);
32
+ return MapLibreGLOfflineManager.resumePackDownload(this.name);
33
33
  }
34
34
 
35
35
  pause() {
36
- return MapboxGLOfflineManager.pausePackDownload(this.name);
36
+ return MapLibreGLOfflineManager.pausePackDownload(this.name);
37
37
  }
38
38
  }
39
39
 
@@ -5,10 +5,10 @@ import OfflinePack from './OfflinePack';
5
5
 
6
6
  import {NativeModules, NativeEventEmitter} from 'react-native';
7
7
 
8
- const MapboxGL = NativeModules.MGLModule;
9
- const MapboxGLOfflineManager = NativeModules.MGLOfflineModule;
8
+ const MapLibreGL = NativeModules.MGLModule;
9
+ const MapLibreGLOfflineManager = NativeModules.MGLOfflineModule;
10
10
  export const OfflineModuleEventEmitter = new NativeEventEmitter(
11
- MapboxGLOfflineManager,
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 MapboxGL.offlineManager.createPack({
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 MapboxGLOfflineManager.createPack(
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 MapboxGL.offlineManager.invalidatePack('packName')
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 MapboxGLOfflineManager.invalidatePack(name);
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 MapboxGL.offlineManager.deletePack('packName')
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 MapboxGLOfflineManager.deletePack(name);
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 MapboxGL.offlineManager.invalidateAmbientCache();
127
+ * await MapLibreGL.offlineManager.invalidateAmbientCache();
128
128
  *
129
129
  * @return {void}
130
130
  */
131
131
  async invalidateAmbientCache() {
132
132
  await this._initialize();
133
- await MapboxGLOfflineManager.invalidateAmbientCache();
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 MapboxGL.offlineManager.clearAmbientCache();
141
+ * await MapLibreGL.offlineManager.clearAmbientCache();
142
142
  *
143
143
  * @return {void}
144
144
  */
145
145
  async clearAmbientCache() {
146
146
  await this._initialize();
147
- await MapboxGLOfflineManager.clearAmbientCache();
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 MapboxGL.offlineManager.setMaximumAmbientCacheSize(5000000);
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 MapboxGLOfflineManager.setMaximumAmbientCacheSize(size);
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 MapboxGL.offlineManager.resetDatabase();
169
+ * await MapLibreGL.offlineManager.resetDatabase();
170
170
  *
171
171
  * @return {void}
172
172
  */
173
173
  async resetDatabase() {
174
174
  await this._initialize();
175
- await MapboxGLOfflineManager.resetDatabase();
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 MapboxGL.offlineManager.getPacks();
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 MapboxGL.offlineManager.getPack();
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 MapboxGL.offlineManager.mergeOfflineRegions(path);
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 MapboxGLOfflineManager.mergeOfflineRegions(path);
218
+ return MapLibreGLOfflineManager.mergeOfflineRegions(path);
219
219
  }
220
220
 
221
221
  /**
222
- * Sets the maximum number of Mapbox-hosted tiles that may be downloaded and stored on the current device.
223
- * The Mapbox Terms of Service prohibit changing or bypassing this limit without permission from Mapbox.
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
- * MapboxGL.offlineManager.setTileCountLimit(1000);
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
- MapboxGLOfflineManager.setTileCountLimit(limit);
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
- * MapboxGL.offlineManager.setProgressEventThrottle(500);
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
- MapboxGLOfflineManager.setProgressEventThrottle(throttleValue);
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
- * MapboxGL.offlineManager.subscribe('packName', progressListener, errorListener)
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
- MapboxGL.OfflineCallbackName.Progress,
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
- MapboxGL.OfflineCallbackName.Error,
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 MapboxGLOfflineManager.setPackObserver(packName);
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
- * MapboxGL.offlineManager.unsubscribe('packName')
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 MapboxGLOfflineManager.getPacks();
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 === MapboxGL.OfflinePackDownloadState.Complete) {
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 MapboxGL = NativeModules.MGLModule;
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 || MapboxGL.StyleURL.Street;
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 MapboxGLSnapshotManger = NativeModules.MGLSnapshotModule;
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 MapboxGL.snapshotManager.takeSnap({
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: MapboxGL.StyleURL.Dark,
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 MapboxGL.snapshotManager.takeSnap({
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: MapboxGL.StyleURL.Dark,
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 MapboxGL.snapshotManager.takeSnap({
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: MapboxGL.StyleURL.Dark,
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 MapboxGLSnapshotManger.takeSnap(snapshotOptions);
56
+ const uri = await MapLibreGLSnapshotManger.takeSnap(snapshotOptions);
57
57
  return uri;
58
58
  }
59
59
  }