@rnmapbox/maps 10.1.2 → 10.1.3

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 (53) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +11 -0
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +46 -8
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +7 -0
  4. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXTileStoreModule.kt +68 -0
  5. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMapViewManagerDelegate.java +3 -0
  6. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMapViewManagerInterface.java +1 -0
  7. package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXTileStoreModuleSpec.java +45 -0
  8. package/ios/RNMBX/{RNMBXOfflineModule.swift → Offline/RNMBXOfflineModule.swift} +5 -5
  9. package/ios/RNMBX/Offline/RNMBXTileStoreModule.m +9 -0
  10. package/ios/RNMBX/Offline/RNMBXTileStoreModule.swift +69 -0
  11. package/ios/RNMBX/RNMBXMapView.swift +49 -9
  12. package/ios/RNMBX/RNMBXViewportComponentView.mm +1 -0
  13. package/lib/commonjs/Mapbox.js +8 -0
  14. package/lib/commonjs/Mapbox.js.map +1 -1
  15. package/lib/commonjs/components/MapView.js.map +1 -1
  16. package/lib/commonjs/modules/offline/TileStore.js +46 -0
  17. package/lib/commonjs/modules/offline/TileStore.js.map +1 -0
  18. package/lib/commonjs/modules/offline/offlineManager.js +2 -2
  19. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  20. package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js +11 -0
  21. package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js.map +1 -0
  22. package/lib/commonjs/specs/RNMBXMapViewNativeComponent.js.map +1 -1
  23. package/lib/module/Mapbox.js +1 -0
  24. package/lib/module/Mapbox.js.map +1 -1
  25. package/lib/module/components/MapView.js.map +1 -1
  26. package/lib/module/modules/offline/TileStore.js +38 -0
  27. package/lib/module/modules/offline/TileStore.js.map +1 -0
  28. package/lib/module/modules/offline/offlineManager.js +2 -2
  29. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  30. package/lib/module/specs/NativeRNMBXTileStoreModule.js +8 -0
  31. package/lib/module/specs/NativeRNMBXTileStoreModule.js.map +1 -0
  32. package/lib/module/specs/RNMBXMapViewNativeComponent.js.map +1 -1
  33. package/lib/typescript/src/Mapbox.d.ts +1 -0
  34. package/lib/typescript/src/Mapbox.d.ts.map +1 -1
  35. package/lib/typescript/src/components/MapView.d.ts +4 -0
  36. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  37. package/lib/typescript/src/modules/offline/TileStore.d.ts +30 -0
  38. package/lib/typescript/src/modules/offline/TileStore.d.ts.map +1 -0
  39. package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts +16 -0
  40. package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts.map +1 -0
  41. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +1 -0
  42. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/setup-jest.js +5 -0
  45. package/src/Mapbox.ts +1 -0
  46. package/src/components/MapView.tsx +5 -0
  47. package/src/modules/offline/TileStore.ts +47 -0
  48. package/src/modules/offline/offlineManager.ts +2 -2
  49. package/src/specs/NativeRNMBXTileStoreModule.ts +27 -0
  50. package/src/specs/RNMBXMapViewNativeComponent.ts +2 -0
  51. /package/ios/RNMBX/{RNMBXOfflineModule.m → Offline/RNMBXOfflineModule.m} +0 -0
  52. /package/ios/RNMBX/{RNMBXOfflineModuleLegacy.m → Offline/RNMBXOfflineModuleLegacy.m} +0 -0
  53. /package/ios/RNMBX/{RNMBXOfflineModuleLegacy.swift → Offline/RNMBXOfflineModuleLegacy.swift} +0 -0
@@ -0,0 +1,47 @@
1
+ import NativeRNMBXTileStoreModule from '../../specs/NativeRNMBXTileStoreModule';
2
+
3
+ type TileDataDomain = 'Maps' | 'Navigation' | 'Search' | 'ADAS';
4
+ type TileDataValue = string | number;
5
+
6
+ /**
7
+ * TileStore manages downloads and storage for requests to tile-related API endpoints,
8
+ * enforcing a disk usage quota: tiles available on disk may be deleted to make room for a new download.
9
+ * This interface can be used by an app developer to set the disk quota.
10
+ */
11
+
12
+ export default class TileStore {
13
+ __nativeTag: number;
14
+ /**
15
+ * Creates a TileStore instance for the given storage path. The returned instance exists as long as it is retained by the client.
16
+ * If the tile store instance already exists for the given path this method will return it without creating a new instance,
17
+ * thus making sure that there is only one tile store instance for a path at a time. If the given path is empty, the tile
18
+ * store at the default location is returned. On iOS, this storage path is excluded from automatic cloud backup. On Android,
19
+ * please exclude the storage path in your Manifest.
20
+ * Please refer to the [Android Documentation](https://developer.android.com/guide/topics/data/autobackup.html#IncludingFiles) for detailed information.
21
+ *
22
+ * @param path The path on disk where tiles and metadata will be stored
23
+ */
24
+ static async shared(path?: string): Promise<TileStore> {
25
+ const __nativeTag = await NativeRNMBXTileStoreModule.shared(path);
26
+ return new TileStore(__nativeTag);
27
+ }
28
+
29
+ private constructor(__nativeTag: number) {
30
+ this.__nativeTag = __nativeTag;
31
+ }
32
+
33
+ /**
34
+ * Sets additional options for this instance that are specific to a data type.
35
+ Params:
36
+ key – The configuration option that should be changed. Valid keys are listed in \c TileStoreOptions. domain – The data type this setting should be applied for. value – The value for the configuration option, or null if it should be reset.
37
+ */
38
+ async setOption(
39
+ key: string,
40
+ domain: TileDataDomain,
41
+ value: TileDataValue,
42
+ ): Promise<void> {
43
+ await NativeRNMBXTileStoreModule.setOption(this.__nativeTag, key, domain, {
44
+ value,
45
+ });
46
+ }
47
+ }
@@ -263,7 +263,7 @@ class OfflineManager {
263
263
  * @return {Array<OfflinePack>}
264
264
  */
265
265
  async getPacks(): Promise<OfflinePack[]> {
266
- await this._initialize();
266
+ await this._initialize(true);
267
267
  return Object.keys(this._offlinePacks).map(
268
268
  (name) => this._offlinePacks[name],
269
269
  );
@@ -279,7 +279,7 @@ class OfflineManager {
279
279
  * @return {OfflinePack}
280
280
  */
281
281
  async getPack(name: string): Promise<OfflinePack | undefined> {
282
- await this._initialize();
282
+ await this._initialize(true);
283
283
  return this._offlinePacks[name];
284
284
  }
285
285
 
@@ -0,0 +1,27 @@
1
+ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2
+ import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
6
+ type ObjectOr<T> = Object;
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ type StringOr<_T> = string;
10
+
11
+ type Domain = 'Maps' | 'Navigation' | 'Search' | 'ADAS';
12
+
13
+ type Tag = Int32;
14
+
15
+ type Value = { value: string | number };
16
+
17
+ export interface Spec extends TurboModule {
18
+ shared(path?: string): Promise<Tag>;
19
+ setOption(
20
+ tag: Tag,
21
+ key: string,
22
+ domain: StringOr<Domain>,
23
+ value: ObjectOr<Value>,
24
+ ): Promise<void>;
25
+ }
26
+
27
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXTileStoreModule');
@@ -76,6 +76,8 @@ export interface NativeProps extends ViewProps {
76
76
  onLongPress?: DirectEventHandler<OnPressEventType>;
77
77
  onMapChange?: DirectEventHandler<OnMapChangeEventType>;
78
78
  onCameraChanged?: DirectEventHandler<OnCameraChangedEventType>;
79
+
80
+ mapViewImpl?: OptionalProp<string>;
79
81
  }
80
82
 
81
83
  export default codegenNativeComponent<NativeProps>(