@maplibre/maplibre-react-native 11.0.0-alpha.4 → 11.0.0-alpha.6
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/MapLibreReactNative.podspec +1 -1
- package/README.md +9 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +20 -24
- package/android/src/main/java/org/maplibre/reactnative/components/images/MLRNImagesManager.java +3 -0
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +9 -0
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSourceManager.java +5 -0
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNSnapshotModule.kt +2 -16
- package/android/src/main/java/org/maplibre/reactnative/utils/DownloadMapImageTask.java +8 -10
- package/android/src/main/java/org/maplibre/reactnative/utils/DownloadedImage.java +6 -0
- package/android/src/main/java/org/maplibre/reactnative/utils/ImageEntry.java +1 -0
- package/ios/MLRNImageQueue.h +1 -0
- package/ios/MLRNImageQueue.m +2 -0
- package/ios/MLRNImageQueueOperation.h +1 -0
- package/ios/MLRNImageQueueOperation.m +17 -15
- package/ios/MLRNMapViewManager.m +4 -4
- package/ios/MLRNShapeSource.h +1 -0
- package/ios/MLRNShapeSource.m +4 -0
- package/ios/MLRNShapeSourceManager.m +1 -0
- package/ios/MLRNStyle.m +5 -5
- package/ios/MLRNStyleValue.h +1 -0
- package/ios/MLRNStyleValue.m +13 -0
- package/ios/MLRNUtils.h +1 -0
- package/ios/MLRNUtils.m +10 -1
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/Images.js +32 -46
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +1 -0
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/Images.js +32 -46
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/ShapeSource.js +1 -0
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts +11 -2
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +5 -0
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/plugin/android.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/plugin/ios.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts +11 -2
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/module/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +5 -0
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/plugin/android.d.ts.map +1 -1
- package/lib/typescript/module/src/plugin/ios.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/MapLibreRN.ts +1 -0
- package/src/components/Images.tsx +62 -67
- package/src/components/ShapeSource.tsx +6 -0
|
@@ -31,6 +31,11 @@ export interface ShapeSourceProps extends BaseProps {
|
|
|
31
31
|
* The default value is 50.
|
|
32
32
|
*/
|
|
33
33
|
clusterRadius?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Specifies minimum number of points to form a cluster if clustering is enabled.
|
|
36
|
+
* The default value is 2.
|
|
37
|
+
*/
|
|
38
|
+
clusterMinPoints?: number;
|
|
34
39
|
/**
|
|
35
40
|
* Specifies the maximum zoom level at which to cluster points if clustering is enabled.
|
|
36
41
|
* Defaults to one zoom level less than the value of maxZoomLevel so that, at the maximum zoom level,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShapeSource.d.ts","sourceRoot":"","sources":["../../../../../src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,MAAM,2BAA2B,CAAC;AAIlE,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACjE;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAQD;;GAEG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SymbolLayer.d.ts","sourceRoot":"","sources":["../../../../../src/components/SymbolLayer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIlE,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACjE;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAQD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,wBAGzB,gBAAgB,4CAclB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/android.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/android.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,eAAO,MAAM,mBAAmB,GAC9B,OAAO,mBAAmB,KACzB,YAAY,EAed,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,eAAe,cAAc,EAAE,EAC/B,eAAe,YAAY,EAAE,KAC5B,cAAc,EAYhB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,mBAAmB,CAWlE,CAAC;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehE;AAUD,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehE;AAUD,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,EAChB,OAAO,mBAAmB,KACzB,MA2BF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,mBAAmB,CAYxE,CAAC;AAyCF,eAAO,MAAM,GAAG;;;;;CAKf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "React Native library for creating maps with MapLibre Native for Android & iOS",
|
|
4
|
-
"version": "11.0.0-alpha.
|
|
4
|
+
"version": "11.0.0-alpha.6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": true
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"@react-native/babel-preset": "^0.79.2",
|
|
157
157
|
"@semantic-release/changelog": "^6.0.3",
|
|
158
158
|
"@semantic-release/git": "^10.0.1",
|
|
159
|
-
"@sinonjs/fake-timers": "^
|
|
159
|
+
"@sinonjs/fake-timers": "^15.0.0",
|
|
160
160
|
"@testing-library/react-native": "^13.0.1",
|
|
161
161
|
"@types/ejs": "^3.1.5",
|
|
162
162
|
"@types/geojson": "^7946.0.14",
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
"eslint": "^8.57.1",
|
|
168
168
|
"eslint-config-universe": "15.0.3",
|
|
169
169
|
"expo-module-scripts": "^4.1.7",
|
|
170
|
-
"jest": "^
|
|
171
|
-
"prettier": "3.
|
|
170
|
+
"jest": "^30.0.2",
|
|
171
|
+
"prettier": "3.6.2",
|
|
172
172
|
"react": "19.0.0",
|
|
173
173
|
"react-docgen": "^8.0.0",
|
|
174
174
|
"react-native": "0.79.2",
|
package/src/MapLibreRN.ts
CHANGED
|
@@ -1,39 +1,35 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
1
|
+
import { type ReactNode, useMemo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Image,
|
|
4
|
+
type ImageResolvedAssetSource,
|
|
4
5
|
type ImageSourcePropType,
|
|
5
|
-
type ImageURISource,
|
|
6
6
|
type NativeSyntheticEvent,
|
|
7
7
|
requireNativeComponent,
|
|
8
8
|
} from "react-native";
|
|
9
|
+
import type {
|
|
10
|
+
ImageRequireSource,
|
|
11
|
+
ImageURISource,
|
|
12
|
+
} from "react-native/Libraries/Image/ImageSource";
|
|
9
13
|
|
|
10
14
|
import { type BaseProps } from "../types/BaseProps";
|
|
11
15
|
|
|
12
16
|
export const NATIVE_MODULE_NAME = "MLRNImages";
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
|
19
|
+
type XOR<T, U> = T | U extends object
|
|
20
|
+
? (Without<T, U> & U) | (Without<U, T> & T)
|
|
21
|
+
: T | U;
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
value.startsWith("http://") ||
|
|
21
|
-
value.startsWith("https://") ||
|
|
22
|
-
value.startsWith("data:") ||
|
|
23
|
-
value.startsWith("asset://") ||
|
|
24
|
-
value.startsWith("/"))
|
|
25
|
-
);
|
|
26
|
-
}
|
|
23
|
+
export type ImageSourceWithSdf = {
|
|
24
|
+
source: ImageSourcePropType;
|
|
25
|
+
sdf?: boolean;
|
|
26
|
+
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const valueAsSource = value as ImageURISource;
|
|
35
|
-
return !!valueAsSource.uri && typeof valueAsSource.uri === "string";
|
|
36
|
-
}
|
|
28
|
+
export type ImageEntry =
|
|
29
|
+
| string
|
|
30
|
+
| ImageRequireSource
|
|
31
|
+
| ImageURISource[]
|
|
32
|
+
| XOR<ImageURISource, ImageSourceWithSdf>;
|
|
37
33
|
|
|
38
34
|
interface ImagesProps extends BaseProps {
|
|
39
35
|
/**
|
|
@@ -59,7 +55,7 @@ interface ImagesProps extends BaseProps {
|
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
/**
|
|
62
|
-
* Images defines the images used in Symbol
|
|
58
|
+
* Images defines the images used in Symbol layers
|
|
63
59
|
*/
|
|
64
60
|
export const Images = ({
|
|
65
61
|
images,
|
|
@@ -68,56 +64,55 @@ export const Images = ({
|
|
|
68
64
|
id,
|
|
69
65
|
children,
|
|
70
66
|
}: ImagesProps) => {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const imagesResult: { [key: string]: ImageEntry } = {};
|
|
80
|
-
let nativeImages: ImageEntry[] = [];
|
|
67
|
+
const props = useMemo(() => {
|
|
68
|
+
const getImages = (): {
|
|
69
|
+
images?: { [key: string]: ImageEntry };
|
|
70
|
+
nativeImages?: ImageEntry[];
|
|
71
|
+
} => {
|
|
72
|
+
if (!images && !nativeAssetImages) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
76
|
+
const imagesResult: {
|
|
77
|
+
[key: string]: string | (ImageResolvedAssetSource & { sdf?: boolean });
|
|
78
|
+
} = {};
|
|
79
|
+
|
|
80
|
+
if (images) {
|
|
81
|
+
Object.entries(images).forEach(([imageName, value]) => {
|
|
82
|
+
if (typeof value === "string") {
|
|
83
|
+
imagesResult[imageName] = value;
|
|
84
|
+
} else if (
|
|
85
|
+
typeof value === "object" &&
|
|
86
|
+
"source" in value &&
|
|
87
|
+
value.source
|
|
88
|
+
) {
|
|
89
|
+
imagesResult[imageName] = {
|
|
90
|
+
...Image.resolveAssetSource(value.source),
|
|
91
|
+
sdf: value.sdf,
|
|
92
|
+
};
|
|
93
|
+
} else {
|
|
94
|
+
imagesResult[imageName] = Image.resolveAssetSource(value);
|
|
92
95
|
}
|
|
93
|
-
}
|
|
96
|
+
});
|
|
94
97
|
}
|
|
95
|
-
}
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
99
|
+
return imagesResult;
|
|
100
|
+
};
|
|
100
101
|
|
|
101
102
|
return {
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
id,
|
|
104
|
+
hasOnImageMissing: !!onImageMissing,
|
|
105
|
+
onImageMissing: (
|
|
106
|
+
event: NativeSyntheticEvent<{ payload: { imageKey: string } }>,
|
|
107
|
+
): void => {
|
|
108
|
+
if (onImageMissing) {
|
|
109
|
+
onImageMissing(event.nativeEvent.payload.imageKey);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
images: getImages(),
|
|
113
|
+
nativeImages: nativeAssetImages ?? [],
|
|
104
114
|
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const _onImageMissing = (
|
|
108
|
-
event: NativeSyntheticEvent<{ payload: { imageKey: string } }>,
|
|
109
|
-
): void => {
|
|
110
|
-
if (onImageMissing) {
|
|
111
|
-
onImageMissing(event.nativeEvent.payload.imageKey);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const props = {
|
|
116
|
-
id,
|
|
117
|
-
hasOnImageMissing: !!onImageMissing,
|
|
118
|
-
onImageMissing: _onImageMissing,
|
|
119
|
-
..._getImages(),
|
|
120
|
-
};
|
|
115
|
+
}, [id, onImageMissing, images, nativeAssetImages]);
|
|
121
116
|
|
|
122
117
|
return <MLRNImages {...props}>{children}</MLRNImages>;
|
|
123
118
|
};
|
|
@@ -64,6 +64,11 @@ export interface ShapeSourceProps extends BaseProps {
|
|
|
64
64
|
* The default value is 50.
|
|
65
65
|
*/
|
|
66
66
|
clusterRadius?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Specifies minimum number of points to form a cluster if clustering is enabled.
|
|
69
|
+
* The default value is 2.
|
|
70
|
+
*/
|
|
71
|
+
clusterMinPoints?: number;
|
|
67
72
|
/**
|
|
68
73
|
* Specifies the maximum zoom level at which to cluster points if clustering is enabled.
|
|
69
74
|
* Defaults to one zoom level less than the value of maxZoomLevel so that, at the maximum zoom level,
|
|
@@ -343,6 +348,7 @@ export const ShapeSource = memo(
|
|
|
343
348
|
onMapboxShapeSourcePress: onPress.bind(this),
|
|
344
349
|
cluster: props.cluster ? 1 : 0,
|
|
345
350
|
clusterRadius: props.clusterRadius,
|
|
351
|
+
clusterMinPoints: props.clusterMinPoints,
|
|
346
352
|
clusterMaxZoomLevel: props.clusterMaxZoomLevel,
|
|
347
353
|
clusterProperties: props.clusterProperties,
|
|
348
354
|
maxZoomLevel: props.maxZoomLevel,
|