@maplibre/maplibre-react-native 10.0.0-alpha.8 → 10.0.0-alpha.9

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 (89) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/docs/Camera.md +1 -1
  4. package/docs/MapView.md +9 -9
  5. package/docs/MarkerView.md +1 -1
  6. package/docs/NativeUserLocation.md +1 -1
  7. package/docs/PointAnnotation.md +2 -2
  8. package/docs/UserLocation.md +2 -2
  9. package/docs/docs.json +12 -12
  10. package/javascript/@types/assets.d.ts +1 -1
  11. package/javascript/MLNModule.ts +2 -2
  12. package/javascript/Maplibre.ts +37 -42
  13. package/javascript/components/BackgroundLayer.tsx +9 -9
  14. package/javascript/components/Callout.tsx +19 -19
  15. package/javascript/components/Camera.tsx +29 -29
  16. package/javascript/components/CircleLayer.tsx +9 -9
  17. package/javascript/components/FillExtrusionLayer.tsx +9 -9
  18. package/javascript/components/FillLayer.tsx +9 -9
  19. package/javascript/components/HeadingIndicator.tsx +7 -8
  20. package/javascript/components/HeatmapLayer.tsx +10 -10
  21. package/javascript/components/ImageSource.tsx +8 -8
  22. package/javascript/components/Images.tsx +19 -20
  23. package/javascript/components/Light.tsx +15 -15
  24. package/javascript/components/LineLayer.tsx +9 -9
  25. package/javascript/components/MapView.tsx +74 -70
  26. package/javascript/components/MarkerView.tsx +9 -10
  27. package/javascript/components/NativeUserLocation.tsx +4 -4
  28. package/javascript/components/PointAnnotation.tsx +17 -17
  29. package/javascript/components/RasterLayer.tsx +9 -9
  30. package/javascript/components/RasterSource.tsx +10 -10
  31. package/javascript/components/ShapeSource.tsx +63 -61
  32. package/javascript/components/Style.tsx +69 -59
  33. package/javascript/components/SymbolLayer.tsx +10 -10
  34. package/javascript/components/UserLocation.tsx +23 -23
  35. package/javascript/components/VectorSource.tsx +19 -19
  36. package/javascript/components/annotations/Annotation.tsx +16 -15
  37. package/javascript/hooks/useAbstractLayer.ts +15 -12
  38. package/javascript/hooks/useAbstractSource.ts +2 -2
  39. package/javascript/hooks/useNativeBridge.ts +7 -7
  40. package/javascript/hooks/useNativeRef.ts +2 -2
  41. package/javascript/hooks/useOnce.ts +1 -1
  42. package/javascript/index.ts +2 -2
  43. package/javascript/modules/location/locationManager.ts +4 -4
  44. package/javascript/modules/offline/OfflineCreatePackOptions.ts +5 -5
  45. package/javascript/modules/offline/OfflinePack.ts +3 -3
  46. package/javascript/modules/offline/offlineManager.ts +11 -12
  47. package/javascript/modules/snapshot/SnapshotOptions.ts +4 -4
  48. package/javascript/modules/snapshot/snapshotManager.ts +2 -2
  49. package/javascript/requestAndroidLocationPermissions.ts +3 -3
  50. package/javascript/types/OnPressEvent.ts +1 -1
  51. package/javascript/types/index.ts +6 -2
  52. package/javascript/utils/BridgeValue.ts +20 -20
  53. package/javascript/utils/Logger.ts +14 -14
  54. package/javascript/utils/MaplibreStyles.d.ts +359 -359
  55. package/javascript/utils/StyleValue.ts +12 -12
  56. package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +6 -6
  57. package/javascript/utils/animated/Animated.ts +38 -16
  58. package/javascript/utils/animated/AnimatedCoordinatesArray.ts +7 -11
  59. package/javascript/utils/animated/AnimatedExtractCoordinateFromArray.ts +3 -3
  60. package/javascript/utils/animated/AnimatedPoint.ts +7 -7
  61. package/javascript/utils/animated/AnimatedRouteCoordinatesArray.ts +16 -20
  62. package/javascript/utils/animated/AnimatedShape.ts +15 -15
  63. package/javascript/utils/deprecation.ts +6 -3
  64. package/javascript/utils/filterUtils.ts +1 -1
  65. package/javascript/utils/geoUtils.ts +8 -8
  66. package/javascript/utils/index.ts +14 -14
  67. package/javascript/utils/styleMap.ts +18 -18
  68. package/package.json +28 -15
  69. package/plugin/build/withMapLibre.d.ts +2 -2
  70. package/plugin/build/withMapLibre.js +24 -24
  71. package/scripts/autogenerate.js +1 -1
  72. package/.eslintignore +0 -3
  73. package/.eslintrc.js +0 -169
  74. package/.prettierrc.js +0 -7
  75. package/.yarn/sdks/eslint/bin/eslint.js +0 -27
  76. package/.yarn/sdks/eslint/lib/api.js +0 -27
  77. package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -27
  78. package/.yarn/sdks/eslint/package.json +0 -14
  79. package/.yarn/sdks/integrations.yml +0 -5
  80. package/.yarn/sdks/prettier/bin/prettier.cjs +0 -27
  81. package/.yarn/sdks/prettier/index.cjs +0 -27
  82. package/.yarn/sdks/prettier/package.json +0 -7
  83. package/.yarn/sdks/typescript/bin/tsc +0 -27
  84. package/.yarn/sdks/typescript/bin/tsserver +0 -27
  85. package/.yarn/sdks/typescript/lib/tsc.js +0 -27
  86. package/.yarn/sdks/typescript/lib/tsserver.js +0 -239
  87. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -239
  88. package/.yarn/sdks/typescript/lib/typescript.js +0 -27
  89. package/.yarn/sdks/typescript/package.json +0 -10
@@ -1,20 +1,20 @@
1
- import {isBoolean, isNumber, isString} from './index';
1
+ import { isBoolean, isNumber, isString } from "./index";
2
2
 
3
3
  export type RawValueType =
4
4
  | string
5
5
  | number
6
6
  | boolean
7
7
  | RawValueType[]
8
- | {[key: string]: RawValueType};
8
+ | { [key: string]: RawValueType };
9
9
 
10
10
  export type StyleValueJSON =
11
- | {type: 'boolean'; value: boolean}
12
- | {type: 'number'; value: number}
13
- | {type: 'string'; value: string}
14
- | {type: 'hashmap'; value: object}
15
- | {type: 'array'; value: unknown[]};
11
+ | { type: "boolean"; value: boolean }
12
+ | { type: "number"; value: number }
13
+ | { type: "string"; value: string }
14
+ | { type: "hashmap"; value: object }
15
+ | { type: "array"; value: unknown[] };
16
16
 
17
- type StyleValueTypes = 'boolean' | 'number' | 'string' | 'hashmap' | 'array';
17
+ type StyleValueTypes = "boolean" | "number" | "string" | "hashmap" | "array";
18
18
 
19
19
  export default class BridgeValue {
20
20
  rawValue: RawValueType;
@@ -25,19 +25,19 @@ export default class BridgeValue {
25
25
 
26
26
  get type(): StyleValueTypes {
27
27
  if (Array.isArray(this.rawValue)) {
28
- return 'array';
28
+ return "array";
29
29
  }
30
30
  if (isBoolean(this.rawValue)) {
31
- return 'boolean';
31
+ return "boolean";
32
32
  }
33
33
  if (isNumber(this.rawValue)) {
34
- return 'number';
34
+ return "number";
35
35
  }
36
36
  if (isString(this.rawValue)) {
37
- return 'string';
37
+ return "string";
38
38
  }
39
- if (this.rawValue && typeof this.rawValue === 'object') {
40
- return 'hashmap';
39
+ if (this.rawValue && typeof this.rawValue === "object") {
40
+ return "hashmap";
41
41
  }
42
42
  throw new Error(
43
43
  `[type - ${this.rawValue}] BridgeValue must be a primitive/array/object`,
@@ -48,20 +48,20 @@ export default class BridgeValue {
48
48
  | [StyleValueJSON, StyleValueJSON][]
49
49
  | StyleValueJSON[]
50
50
  | RawValueType {
51
- const {type} = this;
51
+ const { type } = this;
52
52
 
53
53
  let value;
54
54
 
55
- if (type === 'array') {
55
+ if (type === "array") {
56
56
  value = [];
57
57
 
58
58
  for (const innerRawValue of this.rawValue as RawValueType[]) {
59
59
  const bridgeValue = new BridgeValue(innerRawValue);
60
60
  value.push(bridgeValue.toJSON());
61
61
  }
62
- } else if (type === 'hashmap') {
62
+ } else if (type === "hashmap") {
63
63
  value = [];
64
- const rawValue = this.rawValue as {[key: string]: RawValueType};
64
+ const rawValue = this.rawValue as { [key: string]: RawValueType };
65
65
  const stringKeys = Object.keys(this.rawValue);
66
66
  for (const stringKey of stringKeys) {
67
67
  value.push([
@@ -69,7 +69,7 @@ export default class BridgeValue {
69
69
  new BridgeValue(rawValue[stringKey]).toJSON(),
70
70
  ] as [StyleValueJSON, StyleValueJSON]);
71
71
  }
72
- } else if (type === 'boolean' || type === 'number' || type === 'string') {
72
+ } else if (type === "boolean" || type === "number" || type === "string") {
73
73
  value = this.rawValue;
74
74
  } else {
75
75
  throw new Error(
@@ -84,7 +84,7 @@ export default class BridgeValue {
84
84
  return {
85
85
  type: this.type,
86
86
  value:
87
- typeof formatter === 'function' ? formatter(this.value) : this.value,
87
+ typeof formatter === "function" ? formatter(this.value) : this.value,
88
88
  } as StyleValueJSON;
89
89
  }
90
90
  }
@@ -2,10 +2,10 @@ import {
2
2
  EmitterSubscription,
3
3
  NativeEventEmitter,
4
4
  NativeModules,
5
- } from 'react-native';
6
- const {MLNLogging} = NativeModules;
5
+ } from "react-native";
6
+ const { MLNLogging } = NativeModules;
7
7
 
8
- export type LogLevel = 'error' | 'warning' | 'info' | 'debug' | 'verbose';
8
+ export type LogLevel = "error" | "warning" | "info" | "debug" | "verbose";
9
9
  interface Log {
10
10
  message: string;
11
11
  level: LogLevel;
@@ -90,7 +90,7 @@ class Logger {
90
90
  }
91
91
 
92
92
  subscribe(): void {
93
- this.subscription = this.loggerEmitter.addListener('LogEvent', log => {
93
+ this.subscription = this.loggerEmitter.addListener("LogEvent", (log) => {
94
94
  this.onLog(log);
95
95
  });
96
96
  }
@@ -102,14 +102,14 @@ class Logger {
102
102
  }
103
103
  }
104
104
 
105
- effectiveLevel({level, message, tag}: Log): LogLevel {
106
- if (level === 'warning') {
105
+ effectiveLevel({ level, message, tag }: Log): LogLevel {
106
+ if (level === "warning") {
107
107
  if (
108
- tag === 'Mbgl-HttpRequest' &&
109
- message.startsWith('Request failed due to a permanent error: Canceled')
108
+ tag === "Mbgl-HttpRequest" &&
109
+ message.startsWith("Request failed due to a permanent error: Canceled")
110
110
  ) {
111
111
  // this seems to happening too much to show a warning every time
112
- return 'info';
112
+ return "info";
113
113
  }
114
114
  }
115
115
  return level;
@@ -117,12 +117,12 @@ class Logger {
117
117
 
118
118
  onLog(log: Log): void {
119
119
  if (!this.logCallback || !this.logCallback(log)) {
120
- const {message} = log;
120
+ const { message } = log;
121
121
  const level = this.effectiveLevel(log);
122
- if (level === 'error') {
123
- console.error('MapLibre error', message, log);
124
- } else if (level === 'warning') {
125
- console.warn('MapLibre warning', message, log);
122
+ if (level === "error") {
123
+ console.error("MapLibre error", message, log);
124
+ } else if (level === "warning") {
125
+ console.warn("MapLibre warning", message, log);
126
126
  } else {
127
127
  console.log(`MapLibre [${level}]`, message, log);
128
128
  }