@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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/Camera.md +1 -1
- package/docs/MapView.md +9 -9
- package/docs/MarkerView.md +1 -1
- package/docs/NativeUserLocation.md +1 -1
- package/docs/PointAnnotation.md +2 -2
- package/docs/UserLocation.md +2 -2
- package/docs/docs.json +12 -12
- package/javascript/@types/assets.d.ts +1 -1
- package/javascript/MLNModule.ts +2 -2
- package/javascript/Maplibre.ts +37 -42
- package/javascript/components/BackgroundLayer.tsx +9 -9
- package/javascript/components/Callout.tsx +19 -19
- package/javascript/components/Camera.tsx +29 -29
- package/javascript/components/CircleLayer.tsx +9 -9
- package/javascript/components/FillExtrusionLayer.tsx +9 -9
- package/javascript/components/FillLayer.tsx +9 -9
- package/javascript/components/HeadingIndicator.tsx +7 -8
- package/javascript/components/HeatmapLayer.tsx +10 -10
- package/javascript/components/ImageSource.tsx +8 -8
- package/javascript/components/Images.tsx +19 -20
- package/javascript/components/Light.tsx +15 -15
- package/javascript/components/LineLayer.tsx +9 -9
- package/javascript/components/MapView.tsx +74 -70
- package/javascript/components/MarkerView.tsx +9 -10
- package/javascript/components/NativeUserLocation.tsx +4 -4
- package/javascript/components/PointAnnotation.tsx +17 -17
- package/javascript/components/RasterLayer.tsx +9 -9
- package/javascript/components/RasterSource.tsx +10 -10
- package/javascript/components/ShapeSource.tsx +63 -61
- package/javascript/components/Style.tsx +69 -59
- package/javascript/components/SymbolLayer.tsx +10 -10
- package/javascript/components/UserLocation.tsx +23 -23
- package/javascript/components/VectorSource.tsx +19 -19
- package/javascript/components/annotations/Annotation.tsx +16 -15
- package/javascript/hooks/useAbstractLayer.ts +15 -12
- package/javascript/hooks/useAbstractSource.ts +2 -2
- package/javascript/hooks/useNativeBridge.ts +7 -7
- package/javascript/hooks/useNativeRef.ts +2 -2
- package/javascript/hooks/useOnce.ts +1 -1
- package/javascript/index.ts +2 -2
- package/javascript/modules/location/locationManager.ts +4 -4
- package/javascript/modules/offline/OfflineCreatePackOptions.ts +5 -5
- package/javascript/modules/offline/OfflinePack.ts +3 -3
- package/javascript/modules/offline/offlineManager.ts +11 -12
- package/javascript/modules/snapshot/SnapshotOptions.ts +4 -4
- package/javascript/modules/snapshot/snapshotManager.ts +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +3 -3
- package/javascript/types/OnPressEvent.ts +1 -1
- package/javascript/types/index.ts +6 -2
- package/javascript/utils/BridgeValue.ts +20 -20
- package/javascript/utils/Logger.ts +14 -14
- package/javascript/utils/MaplibreStyles.d.ts +359 -359
- package/javascript/utils/StyleValue.ts +12 -12
- package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +6 -6
- package/javascript/utils/animated/Animated.ts +38 -16
- package/javascript/utils/animated/AnimatedCoordinatesArray.ts +7 -11
- package/javascript/utils/animated/AnimatedExtractCoordinateFromArray.ts +3 -3
- package/javascript/utils/animated/AnimatedPoint.ts +7 -7
- package/javascript/utils/animated/AnimatedRouteCoordinatesArray.ts +16 -20
- package/javascript/utils/animated/AnimatedShape.ts +15 -15
- package/javascript/utils/deprecation.ts +6 -3
- package/javascript/utils/filterUtils.ts +1 -1
- package/javascript/utils/geoUtils.ts +8 -8
- package/javascript/utils/index.ts +14 -14
- package/javascript/utils/styleMap.ts +18 -18
- package/package.json +28 -15
- package/plugin/build/withMapLibre.d.ts +2 -2
- package/plugin/build/withMapLibre.js +24 -24
- package/scripts/autogenerate.js +1 -1
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -169
- package/.prettierrc.js +0 -7
- package/.yarn/sdks/eslint/bin/eslint.js +0 -27
- package/.yarn/sdks/eslint/lib/api.js +0 -27
- package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -27
- package/.yarn/sdks/eslint/package.json +0 -14
- package/.yarn/sdks/integrations.yml +0 -5
- package/.yarn/sdks/prettier/bin/prettier.cjs +0 -27
- package/.yarn/sdks/prettier/index.cjs +0 -27
- package/.yarn/sdks/prettier/package.json +0 -7
- package/.yarn/sdks/typescript/bin/tsc +0 -27
- package/.yarn/sdks/typescript/bin/tsserver +0 -27
- package/.yarn/sdks/typescript/lib/tsc.js +0 -27
- package/.yarn/sdks/typescript/lib/tsserver.js +0 -239
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -239
- package/.yarn/sdks/typescript/lib/typescript.js +0 -27
- package/.yarn/sdks/typescript/package.json +0 -10
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {isBoolean, isNumber, isString} from
|
|
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:
|
|
12
|
-
| {type:
|
|
13
|
-
| {type:
|
|
14
|
-
| {type:
|
|
15
|
-
| {type:
|
|
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 =
|
|
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
|
|
28
|
+
return "array";
|
|
29
29
|
}
|
|
30
30
|
if (isBoolean(this.rawValue)) {
|
|
31
|
-
return
|
|
31
|
+
return "boolean";
|
|
32
32
|
}
|
|
33
33
|
if (isNumber(this.rawValue)) {
|
|
34
|
-
return
|
|
34
|
+
return "number";
|
|
35
35
|
}
|
|
36
36
|
if (isString(this.rawValue)) {
|
|
37
|
-
return
|
|
37
|
+
return "string";
|
|
38
38
|
}
|
|
39
|
-
if (this.rawValue && typeof this.rawValue ===
|
|
40
|
-
return
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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
|
|
6
|
-
const {MLNLogging} = NativeModules;
|
|
5
|
+
} from "react-native";
|
|
6
|
+
const { MLNLogging } = NativeModules;
|
|
7
7
|
|
|
8
|
-
export type LogLevel =
|
|
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(
|
|
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 ===
|
|
105
|
+
effectiveLevel({ level, message, tag }: Log): LogLevel {
|
|
106
|
+
if (level === "warning") {
|
|
107
107
|
if (
|
|
108
|
-
tag ===
|
|
109
|
-
message.startsWith(
|
|
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
|
|
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 ===
|
|
123
|
-
console.error(
|
|
124
|
-
} else if (level ===
|
|
125
|
-
console.warn(
|
|
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
|
}
|