@maplibre/maplibre-react-native 10.0.0-alpha.7 → 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 +9 -0
- package/README.md +1 -1
- package/android/build.gradle +1 -1
- package/android/rctmln/build.gradle +5 -5
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/annotation/MarkerView.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/annotation/MarkerViewManager.java +6 -6
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/annotation/RCTMLNMarkerView.java +5 -5
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/annotation/RCTMLNPointAnnotation.java +9 -8
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/camera/CameraStop.java +14 -12
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/camera/CameraUpdateItem.java +10 -10
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/camera/CameraUpdateQueue.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/camera/RCTMLNCamera.java +26 -26
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/camera/RCTMLNCameraManager.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/images/RCTMLNImages.java +12 -12
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/LocationComponentManager.java +9 -9
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/RCTMLNNativeUserLocation.java +7 -7
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/location/RCTMLNNativeUserLocationManager.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/LayerSourceInfo.java +9 -9
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNAndroidTextureMapView.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNAndroidTextureMapViewManager.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNMapView.java +43 -43
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/mapview/RCTMLNMapViewManager.java +6 -6
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyle.java +3 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java +14 -14
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFunctionParser.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleValue.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTLayer.java +8 -8
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNBackgroundLayer.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNCircleLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNFillExtrusionLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNFillLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNHeatmapLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNLineLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNRasterLayer.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/layers/RCTMLNSymbolLayer.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/light/RCTMLNLight.java +6 -6
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNImageSource.java +3 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNImageSourceManager.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNRasterSource.java +3 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNShapeSource.java +9 -9
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNShapeSourceManager.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNTileSource.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTMLNVectorSource.java +4 -4
- package/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/sources/RCTSource.java +7 -7
- package/android/rctmln/src/main/java/com/maplibre/rctmln/events/FeatureClickEvent.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/events/MapClickEvent.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/events/PointAnnotationClickEvent.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/events/PointAnnotationDragEvent.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/location/LocationManager.java +6 -6
- package/android/rctmln/src/main/java/com/maplibre/rctmln/location/UserLocation.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/location/UserTrackingMode.java +3 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNLocationModule.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNLogging.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNModule.java +8 -8
- package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNOfflineModule.java +11 -11
- package/android/rctmln/src/main/java/com/maplibre/rctmln/modules/RCTMLNSnapshotModule.java +7 -7
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/ClusterPropertyEntry.java +1 -1
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/DownloadMapImageTask.java +5 -5
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/ExpressionParser.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/GeoJSONUtils.java +13 -13
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/GeoViewport.java +3 -3
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/SimpleEventCallback.java +2 -2
- package/android/rctmln/src/main/java/com/maplibre/rctmln/utils/SphericalMercator.java +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/scripts/templates/RCTMLNStyleFactory.java.ejs +14 -14
- 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
package/javascript/Maplibre.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { UserTrackingMode } from "./components/Camera";
|
|
2
|
+
|
|
3
|
+
export * from "./MLNModule";
|
|
2
4
|
export {
|
|
3
5
|
default as Camera,
|
|
4
6
|
UserTrackingMode,
|
|
@@ -6,45 +8,45 @@ export {
|
|
|
6
8
|
type CameraAnimationMode,
|
|
7
9
|
type CameraBounds,
|
|
8
10
|
type CameraRef,
|
|
9
|
-
} from
|
|
10
|
-
export {default as MapView, type MapViewRef} from
|
|
11
|
-
export {default as Light} from
|
|
12
|
-
export {default as PointAnnotation} from
|
|
13
|
-
export type {PointAnnotationRef} from
|
|
14
|
-
export {default as Annotation} from
|
|
15
|
-
export {default as Callout} from
|
|
16
|
-
export {requestAndroidLocationPermissions} from
|
|
11
|
+
} from "./components/Camera";
|
|
12
|
+
export { default as MapView, type MapViewRef } from "./components/MapView";
|
|
13
|
+
export { default as Light } from "./components/Light";
|
|
14
|
+
export { default as PointAnnotation } from "./components/PointAnnotation";
|
|
15
|
+
export type { PointAnnotationRef } from "./components/PointAnnotation";
|
|
16
|
+
export { default as Annotation } from "./components/annotations/Annotation";
|
|
17
|
+
export { default as Callout } from "./components/Callout";
|
|
18
|
+
export { requestAndroidLocationPermissions } from "./requestAndroidLocationPermissions";
|
|
17
19
|
export {
|
|
18
20
|
default as UserLocation,
|
|
19
21
|
UserLocationRenderMode,
|
|
20
|
-
} from
|
|
21
|
-
export type {UserLocationRef} from
|
|
22
|
-
export {default as VectorSource} from
|
|
23
|
-
export {default as ShapeSource} from
|
|
24
|
-
export type {ShapeSourceRef} from
|
|
25
|
-
export {default as RasterSource} from
|
|
26
|
-
export {default as ImageSource} from
|
|
27
|
-
export {default as Images} from
|
|
28
|
-
export {default as FillLayer} from
|
|
29
|
-
export {default as FillExtrusionLayer} from
|
|
30
|
-
export {default as HeatmapLayer} from
|
|
31
|
-
export {default as LineLayer} from
|
|
32
|
-
export {default as CircleLayer} from
|
|
33
|
-
export {default as SymbolLayer} from
|
|
34
|
-
export {default as RasterLayer} from
|
|
35
|
-
export {default as BackgroundLayer} from
|
|
22
|
+
} from "./components/UserLocation";
|
|
23
|
+
export type { UserLocationRef } from "./components/UserLocation";
|
|
24
|
+
export { default as VectorSource } from "./components/VectorSource";
|
|
25
|
+
export { default as ShapeSource } from "./components/ShapeSource";
|
|
26
|
+
export type { ShapeSourceRef } from "./components/ShapeSource";
|
|
27
|
+
export { default as RasterSource } from "./components/RasterSource";
|
|
28
|
+
export { default as ImageSource } from "./components/ImageSource";
|
|
29
|
+
export { default as Images } from "./components/Images";
|
|
30
|
+
export { default as FillLayer } from "./components/FillLayer";
|
|
31
|
+
export { default as FillExtrusionLayer } from "./components/FillExtrusionLayer";
|
|
32
|
+
export { default as HeatmapLayer } from "./components/HeatmapLayer";
|
|
33
|
+
export { default as LineLayer } from "./components/LineLayer";
|
|
34
|
+
export { default as CircleLayer } from "./components/CircleLayer";
|
|
35
|
+
export { default as SymbolLayer } from "./components/SymbolLayer";
|
|
36
|
+
export { default as RasterLayer } from "./components/RasterLayer";
|
|
37
|
+
export { default as BackgroundLayer } from "./components/BackgroundLayer";
|
|
36
38
|
export {
|
|
37
39
|
default as locationManager,
|
|
38
40
|
type Location,
|
|
39
|
-
} from
|
|
40
|
-
export {default as offlineManager} from
|
|
41
|
-
export {default as OfflineCreatePackOptions} from
|
|
42
|
-
export {default as snapshotManager} from
|
|
43
|
-
export type {SnapshotInputOptions} from
|
|
44
|
-
export {default as MarkerView} from
|
|
45
|
-
export {default as Animated} from
|
|
46
|
-
export {default as Style} from
|
|
47
|
-
export {default as Logger, type LogLevel} from
|
|
41
|
+
} from "./modules/location/locationManager";
|
|
42
|
+
export { default as offlineManager } from "./modules/offline/offlineManager";
|
|
43
|
+
export { default as OfflineCreatePackOptions } from "./modules/offline/OfflineCreatePackOptions";
|
|
44
|
+
export { default as snapshotManager } from "./modules/snapshot/snapshotManager";
|
|
45
|
+
export type { SnapshotInputOptions } from "./modules/snapshot/SnapshotOptions";
|
|
46
|
+
export { default as MarkerView } from "./components/MarkerView";
|
|
47
|
+
export { default as Animated } from "./utils/animated/Animated";
|
|
48
|
+
export { default as Style } from "./components/Style";
|
|
49
|
+
export { default as Logger, type LogLevel } from "./utils/Logger";
|
|
48
50
|
export type {
|
|
49
51
|
FillLayerStyleProps as FillLayerStyle,
|
|
50
52
|
LineLayerStyleProps as LineLayerStyle,
|
|
@@ -56,14 +58,7 @@ export type {
|
|
|
56
58
|
HillshadeLayerStyleProps as HillshadeLayerStyle,
|
|
57
59
|
BackgroundLayerStyleProps as BackgroundLayerStyle,
|
|
58
60
|
LightLayerStyleProps as LightLayerStyle,
|
|
59
|
-
} from
|
|
60
|
-
|
|
61
|
-
import {UserTrackingMode} from './components/Camera';
|
|
62
|
-
|
|
63
|
-
// types:
|
|
64
|
-
export enum StyleURL {
|
|
65
|
-
Default = 'https://demotiles.maplibre.org/style.json',
|
|
66
|
-
}
|
|
61
|
+
} from "./utils/MaplibreStyles";
|
|
67
62
|
|
|
68
63
|
/** @deprecated UserTrackingModes is deprecated use UserTrackingMode */
|
|
69
64
|
export const UserTrackingModes = UserTrackingMode;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { BackgroundLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNBackgroundLayer";
|
|
14
14
|
|
|
15
15
|
export interface BackgroundLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface BackgroundLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<BackgroundLayerProps,
|
|
23
|
+
extends Omit<BackgroundLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNBackgroundLayer =
|
|
@@ -30,7 +30,7 @@ const BackgroundLayer: React.FC<BackgroundLayerProps> = ({
|
|
|
30
30
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
31
31
|
...props
|
|
32
32
|
}: BackgroundLayerProps) => {
|
|
33
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
33
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
34
34
|
BackgroundLayerProps,
|
|
35
35
|
NativeProps
|
|
36
36
|
>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {ReactElement} from
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -8,47 +8,47 @@ import {
|
|
|
8
8
|
ViewStyle,
|
|
9
9
|
ViewProps,
|
|
10
10
|
StyleProp,
|
|
11
|
-
} from
|
|
11
|
+
} from "react-native";
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCallout";
|
|
14
14
|
|
|
15
15
|
const styles = StyleSheet.create({
|
|
16
16
|
container: {
|
|
17
|
-
alignItems:
|
|
18
|
-
justifyContent:
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
19
|
width: 180,
|
|
20
20
|
zIndex: 9999999,
|
|
21
21
|
},
|
|
22
22
|
content: {
|
|
23
|
-
backgroundColor:
|
|
24
|
-
borderColor:
|
|
23
|
+
backgroundColor: "white",
|
|
24
|
+
borderColor: "rgba(0, 0, 0, 0.2)",
|
|
25
25
|
borderRadius: 3,
|
|
26
26
|
borderWidth: 1,
|
|
27
27
|
flex: 1,
|
|
28
28
|
padding: 8,
|
|
29
|
-
position:
|
|
29
|
+
position: "relative",
|
|
30
30
|
},
|
|
31
31
|
tip: {
|
|
32
|
-
backgroundColor:
|
|
33
|
-
borderBottomColor:
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
borderBottomColor: "transparent",
|
|
34
34
|
borderBottomWidth: 0,
|
|
35
|
-
borderLeftColor:
|
|
35
|
+
borderLeftColor: "transparent",
|
|
36
36
|
borderLeftWidth: 8,
|
|
37
|
-
borderRightColor:
|
|
37
|
+
borderRightColor: "transparent",
|
|
38
38
|
borderRightWidth: 8,
|
|
39
|
-
borderTopColor:
|
|
39
|
+
borderTopColor: "white",
|
|
40
40
|
borderTopWidth: 16,
|
|
41
41
|
elevation: 0,
|
|
42
42
|
marginTop: -2,
|
|
43
43
|
zIndex: 1000,
|
|
44
44
|
},
|
|
45
45
|
title: {
|
|
46
|
-
color:
|
|
47
|
-
textAlign:
|
|
46
|
+
color: "black",
|
|
47
|
+
textAlign: "center",
|
|
48
48
|
},
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
interface CalloutProps extends Omit<ViewProps,
|
|
51
|
+
interface CalloutProps extends Omit<ViewProps, "style"> {
|
|
52
52
|
/**
|
|
53
53
|
* String that get's displayed in the default callout.
|
|
54
54
|
*/
|
|
@@ -75,7 +75,7 @@ interface CalloutProps extends Omit<ViewProps, 'style'> {
|
|
|
75
75
|
textStyle?: ViewStyle;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
interface NativeProps extends Omit<CalloutProps,
|
|
78
|
+
interface NativeProps extends Omit<CalloutProps, "style"> {
|
|
79
79
|
style: StyleProp<ViewStyle>;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -95,9 +95,9 @@ const Callout = (props: CalloutProps): ReactElement => {
|
|
|
95
95
|
|
|
96
96
|
const _containerStyle: ViewStyle[] = [
|
|
97
97
|
{
|
|
98
|
-
position:
|
|
98
|
+
position: "absolute",
|
|
99
99
|
zIndex: 999,
|
|
100
|
-
backgroundColor:
|
|
100
|
+
backgroundColor: "transparent",
|
|
101
101
|
...containerStyle,
|
|
102
102
|
} as ViewStyle,
|
|
103
103
|
];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {toJSONString} from '../utils';
|
|
2
|
-
import * as geoUtils from '../utils/geoUtils';
|
|
3
|
-
import {MaplibreGLEvent} from '../types';
|
|
4
|
-
import {useNativeRef} from '../hooks/useNativeRef';
|
|
5
|
-
|
|
6
|
-
import {NativeModules, requireNativeComponent, ViewProps} from 'react-native';
|
|
7
1
|
import React, {
|
|
8
2
|
memo,
|
|
9
3
|
RefObject,
|
|
@@ -12,21 +6,27 @@ import React, {
|
|
|
12
6
|
useMemo,
|
|
13
7
|
useRef,
|
|
14
8
|
useCallback,
|
|
15
|
-
} from
|
|
9
|
+
} from "react";
|
|
10
|
+
import { NativeModules, requireNativeComponent, ViewProps } from "react-native";
|
|
11
|
+
|
|
12
|
+
import { useNativeRef } from "../hooks/useNativeRef";
|
|
13
|
+
import { MaplibreGLEvent } from "../types";
|
|
14
|
+
import { toJSONString } from "../utils";
|
|
15
|
+
import * as geoUtils from "../utils/geoUtils";
|
|
16
16
|
|
|
17
17
|
const MapLibreGL = NativeModules.MLNModule;
|
|
18
18
|
|
|
19
|
-
export const NATIVE_MODULE_NAME =
|
|
19
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCamera";
|
|
20
20
|
|
|
21
21
|
export enum UserTrackingMode {
|
|
22
|
-
Follow =
|
|
23
|
-
FollowWithHeading =
|
|
24
|
-
FollowWithCourse =
|
|
22
|
+
Follow = "normal",
|
|
23
|
+
FollowWithHeading = "compass",
|
|
24
|
+
FollowWithCourse = "course",
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export type UserTrackingModeChangeCallback = (
|
|
28
28
|
event: MaplibreGLEvent<
|
|
29
|
-
|
|
29
|
+
"usertrackingmodechange",
|
|
30
30
|
{
|
|
31
31
|
followUserLocation: boolean;
|
|
32
32
|
followUserMode: UserTrackingMode | null;
|
|
@@ -96,8 +96,8 @@ interface CameraBoundsWithPadding
|
|
|
96
96
|
extends CameraBounds,
|
|
97
97
|
Partial<CameraPadding> {}
|
|
98
98
|
|
|
99
|
-
type NativeAnimationMode =
|
|
100
|
-
export type CameraAnimationMode =
|
|
99
|
+
type NativeAnimationMode = "flight" | "ease" | "linear" | "none" | "move";
|
|
100
|
+
export type CameraAnimationMode = "flyTo" | "easeTo" | "linearTo" | "moveTo";
|
|
101
101
|
|
|
102
102
|
export interface NativeCameraStop extends Required<CameraPadding> {
|
|
103
103
|
mode: NativeAnimationMode;
|
|
@@ -133,7 +133,7 @@ export type CameraStops = {
|
|
|
133
133
|
stops: CameraStop[];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
interface CameraProps extends Omit<ViewProps,
|
|
136
|
+
interface CameraProps extends Omit<ViewProps, "style">, CameraStop {
|
|
137
137
|
/**
|
|
138
138
|
* If false, the camera will not send any props to the native module. Intended to be used to prevent unnecessary tile fetching and improve performance when the map is not visible. Defaults to true.
|
|
139
139
|
*/
|
|
@@ -193,7 +193,7 @@ interface CameraProps extends Omit<ViewProps, 'style'>, CameraStop {
|
|
|
193
193
|
onUserTrackingModeChange?: UserTrackingModeChangeCallback;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
interface NativeProps extends Omit<CameraProps,
|
|
196
|
+
interface NativeProps extends Omit<CameraProps, "maxBounds"> {
|
|
197
197
|
maxBounds: string | null;
|
|
198
198
|
stop: NativeCameraStop | null;
|
|
199
199
|
defaultStop: NativeCameraStop | null;
|
|
@@ -204,7 +204,7 @@ const Camera = memo(
|
|
|
204
204
|
(
|
|
205
205
|
{
|
|
206
206
|
allowUpdates = true,
|
|
207
|
-
animationMode =
|
|
207
|
+
animationMode = "easeTo",
|
|
208
208
|
animationDuration = 2000,
|
|
209
209
|
...rest
|
|
210
210
|
}: CameraProps,
|
|
@@ -340,7 +340,7 @@ const Camera = memo(
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
if (config.bounds && config.bounds.ne && config.bounds.sw) {
|
|
343
|
-
const {ne, sw} = config.bounds;
|
|
343
|
+
const { ne, sw } = config.bounds;
|
|
344
344
|
stopConfig.bounds = toJSONString(geoUtils.makeLatLngBounds(ne, sw));
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -351,7 +351,7 @@ const Camera = memo(
|
|
|
351
351
|
|
|
352
352
|
const _setCamera = useCallback(
|
|
353
353
|
(config: CameraStop | CameraStops = {}): void => {
|
|
354
|
-
if (
|
|
354
|
+
if ("stops" in config) {
|
|
355
355
|
let nativeStops: NativeCameraStop[] = [];
|
|
356
356
|
|
|
357
357
|
for (const stop of config.stops) {
|
|
@@ -360,12 +360,12 @@ const Camera = memo(
|
|
|
360
360
|
nativeStops = [...nativeStops, nativeStop];
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
cameraRef.current?.setNativeProps({stop: {stops: nativeStops}});
|
|
363
|
+
cameraRef.current?.setNativeProps({ stop: { stops: nativeStops } });
|
|
364
364
|
} else {
|
|
365
365
|
const nativeStop = _createStopConfig(config);
|
|
366
366
|
|
|
367
367
|
if (nativeStop) {
|
|
368
|
-
cameraRef.current?.setNativeProps({stop: nativeStop});
|
|
368
|
+
cameraRef.current?.setNativeProps({ stop: nativeStop });
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
},
|
|
@@ -520,8 +520,8 @@ const Camera = memo(
|
|
|
520
520
|
sw: southWestCoordinates,
|
|
521
521
|
},
|
|
522
522
|
padding: pad,
|
|
523
|
-
animationDuration
|
|
524
|
-
animationMode:
|
|
523
|
+
animationDuration,
|
|
524
|
+
animationMode: "easeTo",
|
|
525
525
|
});
|
|
526
526
|
};
|
|
527
527
|
|
|
@@ -532,7 +532,7 @@ const Camera = memo(
|
|
|
532
532
|
setCamera({
|
|
533
533
|
centerCoordinate: coordinates,
|
|
534
534
|
animationDuration,
|
|
535
|
-
animationMode:
|
|
535
|
+
animationMode: "flyTo",
|
|
536
536
|
});
|
|
537
537
|
};
|
|
538
538
|
|
|
@@ -550,7 +550,7 @@ const Camera = memo(
|
|
|
550
550
|
setCamera({
|
|
551
551
|
zoomLevel,
|
|
552
552
|
animationDuration,
|
|
553
|
-
animationMode:
|
|
553
|
+
animationMode: "flyTo",
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
556
|
|
|
@@ -569,7 +569,7 @@ const Camera = memo(
|
|
|
569
569
|
_defaultCamera.current = _createStopConfig(
|
|
570
570
|
{
|
|
571
571
|
...props.defaultSettings,
|
|
572
|
-
animationMode:
|
|
572
|
+
animationMode: "moveTo",
|
|
573
573
|
},
|
|
574
574
|
true,
|
|
575
575
|
);
|
|
@@ -580,11 +580,11 @@ const Camera = memo(
|
|
|
580
580
|
config: CameraStop,
|
|
581
581
|
): NativeAnimationMode => {
|
|
582
582
|
switch (config.animationMode) {
|
|
583
|
-
case
|
|
583
|
+
case "flyTo":
|
|
584
584
|
return MapLibreGL.CameraModes.Flight;
|
|
585
|
-
case
|
|
585
|
+
case "moveTo":
|
|
586
586
|
return MapLibreGL.CameraModes.None;
|
|
587
|
-
case
|
|
587
|
+
case "linearTo":
|
|
588
588
|
return MapLibreGL.CameraModes.Linear;
|
|
589
589
|
default:
|
|
590
590
|
return MapLibreGL.CameraModes.Ease;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { CircleLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCircleLayer";
|
|
14
14
|
|
|
15
15
|
export interface CircleLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface CircleLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<CircleLayerProps,
|
|
23
|
+
extends Omit<CircleLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNCircleLayer =
|
|
@@ -33,7 +33,7 @@ const CircleLayer: React.FC<CircleLayerProps> = ({
|
|
|
33
33
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
34
34
|
...props
|
|
35
35
|
}: CircleLayerProps) => {
|
|
36
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
36
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
37
37
|
CircleLayerProps,
|
|
38
38
|
NativeProps
|
|
39
39
|
>({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { FillExtrusionLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNFillExtrusionLayer";
|
|
14
14
|
|
|
15
15
|
export interface FillExtrusionLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface FillExtrusionLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<FillExtrusionLayerProps,
|
|
23
|
+
extends Omit<FillExtrusionLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNFillExtrusionLayer =
|
|
@@ -33,7 +33,7 @@ const FillExtrusionLayer: React.FC<FillExtrusionLayerProps> = ({
|
|
|
33
33
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
34
34
|
...props
|
|
35
35
|
}: FillExtrusionLayerProps) => {
|
|
36
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
36
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
37
37
|
FillExtrusionLayerProps,
|
|
38
38
|
NativeProps
|
|
39
39
|
>({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { FillLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNFillLayer";
|
|
14
14
|
|
|
15
15
|
export interface FillLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export interface FillLayerProps extends BaseProps, BaseLayerProps {
|
|
|
19
19
|
style?: FillLayerStyleProps;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface NativeProps extends Omit<FillLayerProps,
|
|
22
|
+
interface NativeProps extends Omit<FillLayerProps, "style">, NativeBaseProps {}
|
|
23
23
|
|
|
24
24
|
const RCTMLNFillLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ const FillLayer: React.FC<FillLayerProps> = ({
|
|
|
30
30
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
31
31
|
...props
|
|
32
32
|
}: FillLayerProps) => {
|
|
33
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
33
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
34
34
|
FillLayerProps,
|
|
35
35
|
NativeProps
|
|
36
36
|
>({
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import headingIcon from '../../assets/heading.png';
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
3
2
|
|
|
4
|
-
import SymbolLayer from
|
|
5
|
-
|
|
6
|
-
import
|
|
3
|
+
import SymbolLayer from "./SymbolLayer";
|
|
4
|
+
import headingIcon from "../../assets/heading.png";
|
|
5
|
+
import BaseProps from "../types/BaseProps";
|
|
7
6
|
|
|
8
7
|
const style = {
|
|
9
8
|
iconImage: headingIcon,
|
|
10
9
|
iconAllowOverlap: true,
|
|
11
|
-
iconPitchAlignment:
|
|
12
|
-
iconRotationAlignment:
|
|
10
|
+
iconPitchAlignment: "map",
|
|
11
|
+
iconRotationAlignment: "map",
|
|
13
12
|
} as const;
|
|
14
13
|
|
|
15
14
|
interface HeadingIndicatorProps extends BaseProps {
|
|
16
15
|
heading?: number;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
const HeadingIndicator = ({heading}: HeadingIndicatorProps): ReactElement => (
|
|
18
|
+
const HeadingIndicator = ({ heading }: HeadingIndicatorProps): ReactElement => (
|
|
20
19
|
<SymbolLayer
|
|
21
20
|
key="mapboxUserLocationHeadingIndicator"
|
|
22
21
|
id="mapboxUserLocationHeadingIndicator"
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { HeatmapLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNHeatmapLayer";
|
|
14
14
|
|
|
15
|
-
interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
15
|
+
export interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
17
17
|
* Customizable style attributes
|
|
18
18
|
*/
|
|
@@ -20,7 +20,7 @@ interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<HeatmapLayerProps,
|
|
23
|
+
extends Omit<HeatmapLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNHeatmapLayer =
|
|
@@ -32,7 +32,7 @@ const HeatmapLayer: React.FC<HeatmapLayerProps> = ({
|
|
|
32
32
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
33
33
|
...props
|
|
34
34
|
}: HeatmapLayerProps) => {
|
|
35
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
35
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
36
36
|
HeatmapLayerProps,
|
|
37
37
|
NativeProps
|
|
38
38
|
>({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
4
|
+
import useAbstractSource from "../hooks/useAbstractSource";
|
|
5
|
+
import BaseProps from "../types/BaseProps";
|
|
1
6
|
import {
|
|
2
7
|
cloneReactChildrenWithProps,
|
|
3
8
|
isNumber,
|
|
4
9
|
resolveImagePath,
|
|
5
|
-
} from
|
|
6
|
-
import BaseProps from '../types/BaseProps';
|
|
7
|
-
import useAbstractSource from '../hooks/useAbstractSource';
|
|
8
|
-
|
|
9
|
-
import {requireNativeComponent} from 'react-native';
|
|
10
|
-
import React, {ReactElement} from 'react';
|
|
10
|
+
} from "../utils";
|
|
11
11
|
|
|
12
|
-
export const NATIVE_MODULE_NAME =
|
|
12
|
+
export const NATIVE_MODULE_NAME = "RCTMLNImageSource";
|
|
13
13
|
|
|
14
14
|
export interface ImageSourceProps extends BaseProps {
|
|
15
15
|
/**
|
|
@@ -44,7 +44,7 @@ const RCTMLNImageSource =
|
|
|
44
44
|
* The georeferenced image scales and rotates as the user zooms and rotates the map
|
|
45
45
|
*/
|
|
46
46
|
const ImageSource: React.FC<ImageSourceProps> = (props: ImageSourceProps) => {
|
|
47
|
-
const {setNativeRef} = useAbstractSource<NativeProps>();
|
|
47
|
+
const { setNativeRef } = useAbstractSource<NativeProps>();
|
|
48
48
|
|
|
49
49
|
const _getURL = (): string | undefined => {
|
|
50
50
|
return isNumber(props.url) ? resolveImagePath(props.url) : props.url;
|