@maplibre/maplibre-react-native 10.0.0-beta.1 → 10.0.0-beta.10
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/README.md +34 -35
- package/android/build.gradle +98 -51
- package/android/gradle.properties +7 -0
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/AndroidManifestNew.xml +5 -0
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.java +0 -5
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyle.java +1 -4
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyleFactory.java +10 -11
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +0 -66
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSourceManager.java +0 -28
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +0 -145
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +80 -0
- package/ios/MLRN/MLRNBackgroundLayer.h +0 -1
- package/ios/MLRN/MLRNFillExtrusionLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.m +1 -0
- package/ios/MLRN/MLRNLineLayer.h +0 -1
- package/ios/MLRN/MLRNModule.m +0 -135
- package/ios/MLRN/MLRNRasterLayer.h +0 -1
- package/ios/MLRN/MLRNShapeSource.h +0 -11
- package/ios/MLRN/MLRNShapeSource.m +0 -38
- package/ios/MLRN/MLRNShapeSourceManager.m +0 -68
- package/ios/MLRN/MLRNSymbolLayer.h +1 -7
- package/ios/MLRN/MLRNSymbolLayer.m +1 -89
- package/ios/MLRN/MLRNSymbolLayerManager.m +0 -1
- package/lib/commonjs/MLRNModule.js +7 -5
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/MapLibreRN.js +3 -15
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/Annotation.js.map +1 -1
- package/lib/commonjs/components/Images.js +1 -5
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/MapView.js +0 -7
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +6 -38
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js +2 -17
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +1 -11
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
- package/lib/commonjs/types/MapLibreRNStyles.js +6 -0
- package/lib/commonjs/types/MapLibreRNStyles.js.map +1 -0
- package/lib/commonjs/utils/StyleValue.js +2 -2
- package/lib/commonjs/utils/StyleValue.js.map +1 -1
- package/lib/commonjs/utils/getStylePropertyType.js +252 -0
- package/lib/commonjs/utils/getStylePropertyType.js.map +1 -0
- package/lib/module/MLRNModule.js +3 -2
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/MapLibreRN.js +1 -5
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/Annotation.js.map +1 -1
- package/lib/module/components/Images.js +1 -5
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/MapView.js +0 -7
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/ShapeSource.js +5 -37
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SymbolLayer.js +3 -18
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/VectorSource.js +1 -11
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/modules/offline/offlineManager.js +1 -1
- package/lib/module/modules/offline/offlineManager.js.map +1 -1
- package/lib/module/types/MapLibreRNStyles.js +4 -0
- package/lib/module/types/MapLibreRNStyles.js.map +1 -0
- package/lib/module/utils/StyleValue.js +2 -2
- package/lib/module/utils/StyleValue.js.map +1 -1
- package/lib/module/utils/getStylePropertyType.js +248 -0
- package/lib/module/utils/getStylePropertyType.js.map +1 -0
- package/lib/typescript/commonjs/jest.config.d.ts +2 -0
- package/lib/typescript/commonjs/jest.config.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +3 -7
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +5 -8
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Annotation.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Light.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts +2 -8
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts +4 -14
- package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/lib/typescript/module/jest.config.d.ts +2 -0
- package/lib/typescript/module/jest.config.d.ts.map +1 -0
- package/lib/typescript/module/src/MLRNModule.d.ts +3 -7
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +5 -8
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Annotation.d.ts +2 -2
- package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts +1 -1
- package/lib/typescript/module/src/components/CircleLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Light.d.ts +2 -2
- package/lib/typescript/module/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/module/src/components/LineLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts +1 -2
- package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterLayer.d.ts +2 -2
- package/lib/typescript/module/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +1 -2
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SymbolLayer.d.ts +2 -8
- package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts +1 -1
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/offline/offlineManager.d.ts +4 -14
- package/lib/typescript/module/src/modules/offline/offlineManager.d.ts.map +1 -1
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/module/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +1 -0
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -0
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +1 -0
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +1 -0
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/package.json +31 -38
- package/plugin/build/withMapLibre.js +6 -6
- package/src/MLRNModule.ts +15 -9
- package/src/MapLibreRN.ts +22 -23
- package/src/components/Annotation.tsx +3 -3
- package/src/components/BackgroundLayer.tsx +2 -2
- package/src/components/Camera.tsx +1 -1
- package/src/components/CircleLayer.tsx +2 -2
- package/src/components/FillExtrusionLayer.tsx +2 -2
- package/src/components/FillLayer.tsx +2 -2
- package/src/components/HeatmapLayer.tsx +2 -2
- package/src/components/Images.tsx +1 -10
- package/src/components/Light.tsx +2 -2
- package/src/components/LineLayer.tsx +2 -2
- package/src/components/MapView.tsx +1 -12
- package/src/components/RasterLayer.tsx +2 -2
- package/src/components/ShapeSource.tsx +9 -77
- package/src/components/SymbolLayer.tsx +7 -35
- package/src/components/UserLocation.tsx +2 -2
- package/src/components/VectorSource.tsx +5 -21
- package/src/hooks/useAbstractLayer.ts +3 -3
- package/src/modules/offline/OfflinePack.ts +1 -1
- package/src/modules/offline/offlineManager.ts +4 -18
- package/src/{utils/MapLibreRNStyles.d.ts → types/MapLibreRNStyles.ts} +85 -405
- package/src/utils/StyleValue.ts +4 -4
- package/src/utils/filterUtils.ts +1 -1
- package/src/utils/getStylePropertyType.ts +265 -0
- package/android/install.md +0 -32
- package/android/src/main/res/values/strings.xml +0 -3
- package/ios/install.md +0 -49
- package/lib/commonjs/components/Style.js +0 -266
- package/lib/commonjs/components/Style.js.map +0 -1
- package/lib/commonjs/utils/MapLibreRNStyles.d.js +0 -181
- package/lib/commonjs/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/commonjs/utils/deprecation.js +0 -31
- package/lib/commonjs/utils/deprecation.js.map +0 -1
- package/lib/commonjs/utils/styleMap.js +0 -255
- package/lib/commonjs/utils/styleMap.js.map +0 -1
- package/lib/module/components/Style.js +0 -261
- package/lib/module/components/Style.js.map +0 -1
- package/lib/module/utils/MapLibreRNStyles.d.js +0 -180
- package/lib/module/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/module/utils/deprecation.js +0 -27
- package/lib/module/utils/deprecation.js.map +0 -1
- package/lib/module/utils/styleMap.js +0 -249
- package/lib/module/utils/styleMap.js.map +0 -1
- package/lib/typescript/commonjs/src/components/Style.d.ts +0 -81
- package/lib/typescript/commonjs/src/components/Style.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Style.d.ts +0 -81
- package/lib/typescript/module/src/components/Style.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/module/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/module/src/utils/styleMap.d.ts.map +0 -1
- package/src/components/Style.tsx +0 -371
- package/src/utils/deprecation.ts +0 -31
- package/src/utils/styleMap.ts +0 -265
|
@@ -26,9 +26,9 @@ import useNativeBridge from "../hooks/useNativeBridge";
|
|
|
26
26
|
import useOnce from "../hooks/useOnce";
|
|
27
27
|
import { type Location } from "../modules/location/locationManager";
|
|
28
28
|
import { type BaseProps } from "../types/BaseProps";
|
|
29
|
+
import { type FilterExpression } from "../types/MapLibreRNStyles";
|
|
29
30
|
import { isFunction, isAndroid } from "../utils";
|
|
30
31
|
import Logger from "../utils/Logger";
|
|
31
|
-
import { type FilterExpression } from "../utils/MapLibreRNStyles";
|
|
32
32
|
import { getFilter } from "../utils/filterUtils";
|
|
33
33
|
|
|
34
34
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
@@ -268,7 +268,6 @@ export interface MapViewRef {
|
|
|
268
268
|
filter: FilterExpression | undefined,
|
|
269
269
|
layerIDs: string[],
|
|
270
270
|
) => Promise<GeoJSON.FeatureCollection>;
|
|
271
|
-
setCamera: () => void;
|
|
272
271
|
takeSnap: (writeToDisk?: boolean) => Promise<string>;
|
|
273
272
|
getZoom: () => Promise<number>;
|
|
274
273
|
getCenter: () => Promise<GeoJSON.Position>;
|
|
@@ -359,10 +358,6 @@ const MapView = memo(
|
|
|
359
358
|
* @return {GeoJSON.FeatureCollection}
|
|
360
359
|
*/
|
|
361
360
|
queryRenderedFeaturesInRect,
|
|
362
|
-
/**
|
|
363
|
-
* Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.
|
|
364
|
-
*/
|
|
365
|
-
setCamera,
|
|
366
361
|
/**
|
|
367
362
|
* Takes snapshot of map with current tiles and returns a URI to the image
|
|
368
363
|
* @param {Boolean} writeToDisk If true will create a temp file, otherwise it is in base64
|
|
@@ -571,12 +566,6 @@ const MapView = memo(
|
|
|
571
566
|
return res.data as GeoJSON.FeatureCollection;
|
|
572
567
|
};
|
|
573
568
|
|
|
574
|
-
const setCamera = (): void => {
|
|
575
|
-
console.warn(
|
|
576
|
-
"MapView.setCamera is deprecated - please use Camera#setCamera",
|
|
577
|
-
);
|
|
578
|
-
};
|
|
579
|
-
|
|
580
569
|
const takeSnap = async (writeToDisk = false): Promise<string> => {
|
|
581
570
|
const res: { uri: string } = await _runNativeCommand(
|
|
582
571
|
"takeSnap",
|
|
@@ -6,7 +6,7 @@ import useAbstractLayer, {
|
|
|
6
6
|
type NativeBaseProps,
|
|
7
7
|
} from "../hooks/useAbstractLayer";
|
|
8
8
|
import { type BaseProps } from "../types/BaseProps";
|
|
9
|
-
import { type
|
|
9
|
+
import { type RasterLayerStyle } from "../types/MapLibreRNStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ export interface RasterLayerProps extends BaseProps, BaseLayerProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* Customizable style attributes
|
|
18
18
|
*/
|
|
19
|
-
style?:
|
|
19
|
+
style?: RasterLayerStyle;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
@@ -15,6 +15,10 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import useNativeBridge from "../hooks/useNativeBridge";
|
|
17
17
|
import { type BaseProps } from "../types/BaseProps";
|
|
18
|
+
import {
|
|
19
|
+
type ExpressionField,
|
|
20
|
+
type FilterExpression,
|
|
21
|
+
} from "../types/MapLibreRNStyles";
|
|
18
22
|
import { type OnPressEvent } from "../types/OnPressEvent";
|
|
19
23
|
import {
|
|
20
24
|
cloneReactChildrenWithProps,
|
|
@@ -22,16 +26,10 @@ import {
|
|
|
22
26
|
isFunction,
|
|
23
27
|
toJSONString,
|
|
24
28
|
} from "../utils";
|
|
25
|
-
import {
|
|
26
|
-
type ExpressionField,
|
|
27
|
-
type FilterExpression,
|
|
28
|
-
} from "../utils/MapLibreRNStyles";
|
|
29
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
30
29
|
import { getFilter } from "../utils/filterUtils";
|
|
31
30
|
|
|
32
31
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
33
32
|
export const NATIVE_MODULE_NAME = "MLRNShapeSource";
|
|
34
|
-
export const SHAPE_SOURCE_NATIVE_ASSETS_KEY = "assets";
|
|
35
33
|
|
|
36
34
|
interface NativeProps {
|
|
37
35
|
shape?: string;
|
|
@@ -252,18 +250,6 @@ const ShapeSource = memo(
|
|
|
252
250
|
async function getClusterExpansionZoom(
|
|
253
251
|
feature: GeoJSON.Feature,
|
|
254
252
|
): Promise<number> {
|
|
255
|
-
if (typeof feature === "number") {
|
|
256
|
-
console.warn(
|
|
257
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
258
|
-
);
|
|
259
|
-
const res: { data: number } = await _runNativeCommand(
|
|
260
|
-
"getClusterExpansionZoomById",
|
|
261
|
-
_nativeRef.current,
|
|
262
|
-
[feature],
|
|
263
|
-
);
|
|
264
|
-
return res.data;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
253
|
const res: { data: number } = await _runNativeCommand(
|
|
268
254
|
"getClusterExpansionZoom",
|
|
269
255
|
_nativeRef.current,
|
|
@@ -277,24 +263,6 @@ const ShapeSource = memo(
|
|
|
277
263
|
limit: number,
|
|
278
264
|
offset: number,
|
|
279
265
|
): Promise<GeoJSON.FeatureCollection> {
|
|
280
|
-
if (typeof feature === "number") {
|
|
281
|
-
console.warn(
|
|
282
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
283
|
-
);
|
|
284
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
285
|
-
await _runNativeCommand(
|
|
286
|
-
"getClusterLeavesById",
|
|
287
|
-
_nativeRef.current,
|
|
288
|
-
[feature, limit, offset],
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
if (isAndroid()) {
|
|
292
|
-
return JSON.parse(res.data as string);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
266
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
299
267
|
await _runNativeCommand("getClusterLeaves", _nativeRef.current, [
|
|
300
268
|
JSON.stringify(feature),
|
|
@@ -312,24 +280,6 @@ const ShapeSource = memo(
|
|
|
312
280
|
async function getClusterChildren(
|
|
313
281
|
feature: GeoJSON.Feature,
|
|
314
282
|
): Promise<GeoJSON.FeatureCollection> {
|
|
315
|
-
if (typeof feature === "number") {
|
|
316
|
-
console.warn(
|
|
317
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
318
|
-
);
|
|
319
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
320
|
-
await _runNativeCommand(
|
|
321
|
-
"getClusterChildrenById",
|
|
322
|
-
_nativeRef.current,
|
|
323
|
-
[feature],
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
if (isAndroid()) {
|
|
327
|
-
return JSON.parse(res.data as string);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
283
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
334
284
|
await _runNativeCommand("getClusterChildren", _nativeRef.current, [
|
|
335
285
|
JSON.stringify(feature),
|
|
@@ -372,31 +322,13 @@ const ShapeSource = memo(
|
|
|
372
322
|
payload: { features, coordinates, point },
|
|
373
323
|
},
|
|
374
324
|
} = event;
|
|
375
|
-
let newEvent = {
|
|
376
|
-
features,
|
|
377
|
-
coordinates,
|
|
378
|
-
point,
|
|
379
|
-
};
|
|
380
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
381
|
-
event,
|
|
382
|
-
newEvent,
|
|
383
|
-
(key: string): void => {
|
|
384
|
-
console.warn(
|
|
385
|
-
`event.${key} is deprecated on ShapeSource#onPress, please use event.features`,
|
|
386
|
-
);
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
nativeEvent: (
|
|
390
|
-
origNativeEvent: NativeSyntheticEvent<{ payload: OnPressEvent }>,
|
|
391
|
-
) => ({
|
|
392
|
-
...origNativeEvent,
|
|
393
|
-
payload: features[0],
|
|
394
|
-
}),
|
|
395
|
-
},
|
|
396
|
-
);
|
|
397
325
|
|
|
398
326
|
if (props.onPress) {
|
|
399
|
-
props.onPress(
|
|
327
|
+
props.onPress({
|
|
328
|
+
features,
|
|
329
|
+
coordinates,
|
|
330
|
+
point,
|
|
331
|
+
});
|
|
400
332
|
}
|
|
401
333
|
}
|
|
402
334
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { View, NativeModules, requireNativeComponent } from "react-native";
|
|
1
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
2
|
|
|
4
3
|
import useAbstractLayer, {
|
|
5
4
|
type BaseLayerProps,
|
|
6
5
|
type NativeBaseProps,
|
|
7
6
|
} from "../hooks/useAbstractLayer";
|
|
8
7
|
import { type BaseProps } from "../types/BaseProps";
|
|
9
|
-
import { type
|
|
8
|
+
import { type SymbolLayerStyle } from "../types/MapLibreRNStyles";
|
|
10
9
|
|
|
11
10
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
12
11
|
|
|
@@ -16,18 +15,12 @@ export interface SymbolLayerProps extends BaseProps, BaseLayerProps {
|
|
|
16
15
|
/**
|
|
17
16
|
* Customizable style attributes
|
|
18
17
|
*/
|
|
19
|
-
style?:
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.
|
|
23
|
-
* This is now deprecated, use Image component instead.
|
|
24
|
-
*/
|
|
25
|
-
children?: ReactElement | ReactElement[];
|
|
18
|
+
style?: SymbolLayerStyle;
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
interface NativeProps
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
interface NativeProps
|
|
22
|
+
extends Omit<SymbolLayerProps, "style">,
|
|
23
|
+
NativeBaseProps {}
|
|
31
24
|
|
|
32
25
|
const MLRNSymbolLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
33
26
|
|
|
@@ -46,32 +39,11 @@ const SymbolLayer: React.FC<SymbolLayerProps> = ({
|
|
|
46
39
|
sourceID,
|
|
47
40
|
});
|
|
48
41
|
|
|
49
|
-
const _shouldSnapshot = (): boolean => {
|
|
50
|
-
let isSnapshot = false;
|
|
51
|
-
|
|
52
|
-
if (Children.count(props.children) <= 0) {
|
|
53
|
-
return isSnapshot;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Children.forEach(props.children, (child) => {
|
|
57
|
-
if (child?.type === View) {
|
|
58
|
-
isSnapshot = true;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return isSnapshot;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
42
|
const updatedProps = {
|
|
66
43
|
...baseProps,
|
|
67
|
-
snapshot: _shouldSnapshot(),
|
|
68
44
|
};
|
|
69
45
|
|
|
70
|
-
return
|
|
71
|
-
<MLRNSymbolLayer ref={setNativeLayer} {...updatedProps}>
|
|
72
|
-
{props.children}
|
|
73
|
-
</MLRNSymbolLayer>
|
|
74
|
-
);
|
|
46
|
+
return <MLRNSymbolLayer ref={setNativeLayer} {...updatedProps} />;
|
|
75
47
|
};
|
|
76
48
|
|
|
77
49
|
export default SymbolLayer;
|
|
@@ -15,11 +15,11 @@ import NativeUserLocation from "./NativeUserLocation";
|
|
|
15
15
|
import locationManager, {
|
|
16
16
|
type Location,
|
|
17
17
|
} from "../modules/location/locationManager";
|
|
18
|
-
import { type
|
|
18
|
+
import { type CircleLayerStyle } from "../types/MapLibreRNStyles";
|
|
19
19
|
|
|
20
20
|
const mapboxBlue = "rgba(51, 181, 229, 100)";
|
|
21
21
|
|
|
22
|
-
const layerStyles: Record<string,
|
|
22
|
+
const layerStyles: Record<string, CircleLayerStyle> = {
|
|
23
23
|
pluse: {
|
|
24
24
|
circleRadius: 15,
|
|
25
25
|
circleColor: mapboxBlue,
|
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
import useAbstractSource from "../hooks/useAbstractSource";
|
|
10
10
|
import useNativeBridge from "../hooks/useNativeBridge";
|
|
11
11
|
import { type BaseProps } from "../types/BaseProps";
|
|
12
|
+
import { type FilterExpression } from "../types/MapLibreRNStyles";
|
|
12
13
|
import { type OnPressEvent } from "../types/OnPressEvent";
|
|
13
14
|
import { cloneReactChildrenWithProps, isFunction, isAndroid } from "../utils";
|
|
14
|
-
import { type FilterExpression } from "../utils/MapLibreRNStyles";
|
|
15
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
16
15
|
import { getFilter } from "../utils/filterUtils";
|
|
17
16
|
|
|
18
17
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
@@ -160,33 +159,18 @@ const VectorSource = memo(
|
|
|
160
159
|
if (!onPress) {
|
|
161
160
|
return;
|
|
162
161
|
}
|
|
162
|
+
|
|
163
163
|
const {
|
|
164
164
|
nativeEvent: {
|
|
165
165
|
payload: { features, coordinates, point },
|
|
166
166
|
},
|
|
167
167
|
} = event;
|
|
168
|
-
|
|
168
|
+
|
|
169
|
+
onPress({
|
|
169
170
|
features,
|
|
170
171
|
coordinates,
|
|
171
172
|
point,
|
|
172
|
-
};
|
|
173
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
174
|
-
event,
|
|
175
|
-
newEvent,
|
|
176
|
-
(key: string) => {
|
|
177
|
-
console.warn(
|
|
178
|
-
`event.${key} is deprecated on VectorSource#onPress, please use event.features`,
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
nativeEvent: (origNativeEvent: OnPressEvent) => ({
|
|
183
|
-
...origNativeEvent,
|
|
184
|
-
payload: features[0],
|
|
185
|
-
}),
|
|
186
|
-
},
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
onPress(newEvent);
|
|
173
|
+
});
|
|
190
174
|
};
|
|
191
175
|
|
|
192
176
|
const allProps = {
|
|
@@ -3,11 +3,11 @@ import { processColor, type NativeMethods } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import { type BaseProps } from "../types/BaseProps";
|
|
5
5
|
import {
|
|
6
|
-
type
|
|
6
|
+
type AllLayerStyle,
|
|
7
7
|
type ExpressionField,
|
|
8
8
|
type ExpressionName,
|
|
9
9
|
type FilterExpression,
|
|
10
|
-
} from "../
|
|
10
|
+
} from "../types/MapLibreRNStyles";
|
|
11
11
|
import { type StyleValue, transformStyle } from "../utils/StyleValue";
|
|
12
12
|
import { getFilter } from "../utils/filterUtils";
|
|
13
13
|
|
|
@@ -53,7 +53,7 @@ export interface BaseLayerProps {
|
|
|
53
53
|
/**
|
|
54
54
|
* Customizable style attributes
|
|
55
55
|
*/
|
|
56
|
-
style?:
|
|
56
|
+
style?: AllLayerStyle;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export interface NativeBaseProps {
|
|
@@ -10,8 +10,8 @@ export type OfflinePackStatus = {
|
|
|
10
10
|
percentage: number;
|
|
11
11
|
completedResourceCount: number;
|
|
12
12
|
completedResourceSize: number;
|
|
13
|
-
completedTileSize: number;
|
|
14
13
|
completedTileCount: number;
|
|
14
|
+
completedTileSize: number;
|
|
15
15
|
requiredResourceCount: number;
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import OfflineCreatePackOptions, {
|
|
8
8
|
type OfflineCreatePackInputOptions,
|
|
9
9
|
} from "./OfflineCreatePackOptions";
|
|
10
|
-
import OfflinePack from "./OfflinePack";
|
|
10
|
+
import OfflinePack, { type OfflinePackStatus } from "./OfflinePack";
|
|
11
11
|
import { isUndefined, isFunction, isAndroid } from "../../utils";
|
|
12
12
|
|
|
13
13
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
@@ -16,17 +16,6 @@ export const OfflineModuleEventEmitter = new NativeEventEmitter(
|
|
|
16
16
|
MLRNOfflineModule,
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
export type OfflineProgressStatus = {
|
|
20
|
-
name: string;
|
|
21
|
-
state: number;
|
|
22
|
-
percentage: number;
|
|
23
|
-
completedResourceSize: number;
|
|
24
|
-
completedTileCount: number;
|
|
25
|
-
completedResourceCount: number;
|
|
26
|
-
requiredResourceCount: number;
|
|
27
|
-
completedTileSize: number;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
19
|
export type OfflinePackError = {
|
|
31
20
|
name: string;
|
|
32
21
|
message: string;
|
|
@@ -37,13 +26,10 @@ type ErrorEvent = {
|
|
|
37
26
|
};
|
|
38
27
|
|
|
39
28
|
type ProgressEvent = {
|
|
40
|
-
payload:
|
|
29
|
+
payload: OfflinePackStatus;
|
|
41
30
|
};
|
|
42
31
|
|
|
43
|
-
type ProgressListener = (
|
|
44
|
-
pack: OfflinePack,
|
|
45
|
-
status: OfflineProgressStatus,
|
|
46
|
-
) => void;
|
|
32
|
+
type ProgressListener = (pack: OfflinePack, status: OfflinePackStatus) => void;
|
|
47
33
|
type ErrorListener = (pack: OfflinePack, err: OfflinePackError) => void;
|
|
48
34
|
|
|
49
35
|
/**
|
|
@@ -83,7 +69,7 @@ class OfflineManager {
|
|
|
83
69
|
*
|
|
84
70
|
* await MapLibreGL.offlineManager.createPack({
|
|
85
71
|
* name: 'offlinePack',
|
|
86
|
-
* styleURL: '
|
|
72
|
+
* styleURL: 'https://demotiles.maplibre.org/tiles/tiles.json',
|
|
87
73
|
* minZoom: 14,
|
|
88
74
|
* maxZoom: 20,
|
|
89
75
|
* bounds: [[neLng, neLat], [swLng, swLat]]
|