@maplibre/maplibre-react-native 11.0.0-alpha.42 → 11.0.0-alpha.43
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/android/build.gradle +1 -3
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +3 -3
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt +7 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCalloutManager.kt +29 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerView.kt +220 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewContent.kt +50 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewManager.kt +81 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MarkerViewManager.kt +127 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotation.kt +407 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotationManager.kt +105 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +38 -37
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationClickEvent.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationDragEvent.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationEvent.kt +30 -0
- package/ios/components/annotations/callout/MLRNCalloutComponentView.h +10 -0
- package/ios/components/annotations/callout/MLRNCalloutComponentView.mm +91 -0
- package/ios/components/annotations/point-annotation/MLRNPointAnnotation.h +44 -0
- package/ios/components/annotations/{MLRNPointAnnotation.m → point-annotation/MLRNPointAnnotation.m} +69 -35
- package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.h +10 -0
- package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.mm +331 -0
- package/ios/components/map-view/MLRNMapView.m +4 -5
- package/lib/commonjs/components/annotations/callout/Callout.js +94 -0
- package/lib/commonjs/components/annotations/callout/Callout.js.map +1 -0
- package/lib/commonjs/components/annotations/callout/CalloutNativeComponent.ts +11 -0
- package/lib/commonjs/components/annotations/marker-view/MarkerView.js +70 -0
- package/lib/commonjs/components/annotations/marker-view/MarkerView.js.map +1 -0
- package/lib/commonjs/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
- package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js +88 -0
- package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
- package/lib/commonjs/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
- package/lib/commonjs/index.js +3 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/Anchor.js +68 -0
- package/lib/commonjs/types/Anchor.js.map +1 -0
- package/lib/commonjs/utils/animated/Animated.js +4 -0
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/module/components/annotations/callout/Callout.js +88 -0
- package/lib/module/components/annotations/callout/Callout.js.map +1 -0
- package/lib/module/components/annotations/callout/CalloutNativeComponent.ts +11 -0
- package/lib/module/components/annotations/marker-view/MarkerView.js +64 -0
- package/lib/module/components/annotations/marker-view/MarkerView.js.map +1 -0
- package/lib/module/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
- package/lib/module/components/annotations/point-annotation/PointAnnotation.js +83 -0
- package/lib/module/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
- package/lib/module/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/Anchor.js +64 -0
- package/lib/module/types/Anchor.js.map +1 -0
- package/lib/module/utils/animated/Animated.js +4 -0
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/typescript/{module/src/components/annotations → commonjs/src/components/annotations/callout}/Callout.d.ts +9 -9
- package/lib/typescript/commonjs/src/components/annotations/callout/Callout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
- package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
- package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -4
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/Anchor.d.ts +17 -0
- package/lib/typescript/commonjs/src/types/Anchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/components/annotations → module/src/components/annotations/callout}/Callout.d.ts +9 -9
- package/lib/typescript/module/src/components/annotations/callout/Callout.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
- package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
- package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
- package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -4
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/Anchor.d.ts +17 -0
- package/lib/typescript/module/src/types/Anchor.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -0
- package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/components/annotations/callout/Callout.tsx +145 -0
- package/src/components/annotations/callout/CalloutNativeComponent.ts +11 -0
- package/src/components/annotations/marker-view/MarkerView.tsx +124 -0
- package/src/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
- package/src/components/annotations/point-annotation/PointAnnotation.tsx +219 -0
- package/src/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
- package/src/index.ts +15 -4
- package/src/types/Anchor.ts +44 -0
- package/src/utils/animated/Animated.tsx +6 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCallout.java +0 -11
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCalloutManager.java +0 -18
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerView.java +0 -112
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerViewManager.java +0 -45
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotation.java +0 -361
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotationManager.java +0 -84
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerView.java +0 -23
- package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerViewManager.java +0 -69
- package/ios/components/annotations/MLRNCalloutManager.h +0 -5
- package/ios/components/annotations/MLRNCalloutManager.m +0 -12
- package/ios/components/annotations/MLRNPointAnnotation.h +0 -33
- package/ios/components/annotations/MLRNPointAnnotationManager.h +0 -5
- package/ios/components/annotations/MLRNPointAnnotationManager.m +0 -27
- package/lib/commonjs/components/annotations/Callout.js +0 -101
- package/lib/commonjs/components/annotations/Callout.js.map +0 -1
- package/lib/commonjs/components/annotations/MarkerView.js +0 -60
- package/lib/commonjs/components/annotations/MarkerView.js.map +0 -1
- package/lib/commonjs/components/annotations/PointAnnotation.js +0 -114
- package/lib/commonjs/components/annotations/PointAnnotation.js.map +0 -1
- package/lib/module/components/annotations/Callout.js +0 -96
- package/lib/module/components/annotations/Callout.js.map +0 -1
- package/lib/module/components/annotations/MarkerView.js +0 -55
- package/lib/module/components/annotations/MarkerView.js.map +0 -1
- package/lib/module/components/annotations/PointAnnotation.js +0 -110
- package/lib/module/components/annotations/PointAnnotation.js.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/Callout.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts +0 -44
- package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts +0 -90
- package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/Callout.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/MarkerView.d.ts +0 -44
- package/lib/typescript/module/src/components/annotations/MarkerView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts +0 -90
- package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts.map +0 -1
- package/src/components/annotations/Callout.tsx +0 -139
- package/src/components/annotations/MarkerView.tsx +0 -86
- package/src/components/annotations/PointAnnotation.tsx +0 -240
- /package/ios/components/annotations/{MLRNCallout.h → callout/MLRNCallout.h} +0 -0
- /package/ios/components/annotations/{MLRNCallout.m → callout/MLRNCallout.m} +0 -0
package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type NativeSyntheticEvent, type ViewProps } from "react-native";
|
|
3
|
+
import { type Anchor } from "../../../types/Anchor";
|
|
4
|
+
import type { LngLat } from "../../../types/LngLat";
|
|
5
|
+
import type { PixelPoint } from "../../../types/PixelPoint";
|
|
6
|
+
import type { PressEvent } from "../../../types/PressEvent";
|
|
7
|
+
export type AnnotationEvent = PressEvent & {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export interface PointAnnotationProps {
|
|
11
|
+
/**
|
|
12
|
+
* A string that uniquely identifies the annotation.
|
|
13
|
+
* If not provided, a unique ID will be generated automatically.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The string containing the annotation's title. Note this is required to be set if you want to see a callout appear on iOS.
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The string containing the annotation's snippet(subtitle). Not displayed in the default callout.
|
|
22
|
+
*/
|
|
23
|
+
snippet?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Manually selects/deselects annotation
|
|
26
|
+
*/
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Enable or disable dragging. Defaults to false.
|
|
30
|
+
*/
|
|
31
|
+
draggable?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The center point (specified as a map coordinate) of the annotation.
|
|
34
|
+
*/
|
|
35
|
+
lngLat: LngLat;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the anchor being set on a particular point of the annotation.
|
|
38
|
+
* The anchor indicates which part of the marker should be placed closest to the coordinate.
|
|
39
|
+
* Defaults to "center".
|
|
40
|
+
*
|
|
41
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PositionAnchor/
|
|
42
|
+
*/
|
|
43
|
+
anchor?: Anchor;
|
|
44
|
+
/**
|
|
45
|
+
* The offset in pixels to apply relative to the anchor.
|
|
46
|
+
* Negative values indicate left and up.
|
|
47
|
+
*
|
|
48
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MarkerOptions/#offset
|
|
49
|
+
*/
|
|
50
|
+
offset?: PixelPoint;
|
|
51
|
+
/**
|
|
52
|
+
* This callback is fired once this annotation is selected.
|
|
53
|
+
*/
|
|
54
|
+
onSelected?: (event: NativeSyntheticEvent<AnnotationEvent>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* This callback is fired once this annotation is deselected.
|
|
57
|
+
*/
|
|
58
|
+
onDeselected?: (event: NativeSyntheticEvent<AnnotationEvent>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* This callback is fired once this annotation has started being dragged.
|
|
61
|
+
*/
|
|
62
|
+
onDragStart?: (event: NativeSyntheticEvent<AnnotationEvent>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* This callback is fired once this annotation has stopped being dragged.
|
|
65
|
+
*/
|
|
66
|
+
onDragEnd?: (event: NativeSyntheticEvent<AnnotationEvent>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* This callback is fired while this annotation is being dragged.
|
|
69
|
+
*/
|
|
70
|
+
onDrag?: (event: NativeSyntheticEvent<AnnotationEvent>) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Expects one child, and an optional callout can be added as well
|
|
73
|
+
*/
|
|
74
|
+
children: ReactElement | [ReactElement, ReactElement];
|
|
75
|
+
style?: ViewProps["style"];
|
|
76
|
+
}
|
|
77
|
+
export interface PointAnnotationRef {
|
|
78
|
+
/**
|
|
79
|
+
* On android point annotation is rendered offscreen with a canvas into an image.
|
|
80
|
+
* To rerender the image from the current state of the view call refresh.
|
|
81
|
+
* Call this for example from Image#onLoad.
|
|
82
|
+
*/
|
|
83
|
+
refresh(): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
|
|
87
|
+
*
|
|
88
|
+
* Consider using GeoJSONSource and SymbolLayer instead, if you have many points, and you have static images,
|
|
89
|
+
* they'll offer much better performance.
|
|
90
|
+
*
|
|
91
|
+
* If you need interactive views please use MarkerView,
|
|
92
|
+
* as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
|
|
93
|
+
*/
|
|
94
|
+
export declare const PointAnnotation: import("react").ForwardRefExoticComponent<PointAnnotationProps & import("react").RefAttributes<PointAnnotationRef>>;
|
|
95
|
+
//# sourceMappingURL=PointAnnotation.d.ts.map
|
package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointAnnotation.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/annotations/point-annotation/PointAnnotation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,YAAY,EAGlB,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,KAAK,oBAAoB,EAIzB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAW5D,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IACzC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAEpE;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAEtE;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAErE;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAEnE;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAEhE;;OAEG;IACH,QAAQ,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAEtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,qHA6E3B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CodegenTypes, type HostComponent, type ViewProps } from "react-native";
|
|
2
|
+
import type { UnsafeMixed } from "../../../types/codegen/UnsafeMixed";
|
|
3
|
+
type NativeAnchor = {
|
|
4
|
+
x: CodegenTypes.Double;
|
|
5
|
+
y: CodegenTypes.Double;
|
|
6
|
+
};
|
|
7
|
+
type NativeOffset = {
|
|
8
|
+
x: CodegenTypes.Double;
|
|
9
|
+
y: CodegenTypes.Double;
|
|
10
|
+
};
|
|
11
|
+
type NativeAnnotationEvent = {
|
|
12
|
+
id: string;
|
|
13
|
+
lngLat: UnsafeMixed<[
|
|
14
|
+
longitude: CodegenTypes.Double,
|
|
15
|
+
latitude: CodegenTypes.Double
|
|
16
|
+
]>;
|
|
17
|
+
point: UnsafeMixed<[x: CodegenTypes.Double, y: CodegenTypes.Double]>;
|
|
18
|
+
};
|
|
19
|
+
export interface NativeProps extends ViewProps {
|
|
20
|
+
id: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
snippet?: string;
|
|
23
|
+
selected?: CodegenTypes.WithDefault<boolean, false>;
|
|
24
|
+
draggable?: CodegenTypes.WithDefault<boolean, false>;
|
|
25
|
+
lngLat: UnsafeMixed<[
|
|
26
|
+
longitude: CodegenTypes.Double,
|
|
27
|
+
latitude: CodegenTypes.Double
|
|
28
|
+
]>;
|
|
29
|
+
anchor?: NativeAnchor;
|
|
30
|
+
offset?: NativeOffset;
|
|
31
|
+
onSelected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
|
|
32
|
+
onDeselected?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
|
|
33
|
+
onDragStart?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
|
|
34
|
+
onDrag?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
|
|
35
|
+
onDragEnd?: CodegenTypes.DirectEventHandler<NativeAnnotationEvent>;
|
|
36
|
+
}
|
|
37
|
+
interface NativeCommands {
|
|
38
|
+
refresh: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
39
|
+
}
|
|
40
|
+
export declare const Commands: NativeCommands;
|
|
41
|
+
declare const _default: HostComponent<NativeProps>;
|
|
42
|
+
export default _default;
|
|
43
|
+
//# sourceMappingURL=PointAnnotationNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointAnnotationNativeComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/annotations/point-annotation/PointAnnotationNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,KAAK,YAAY,GAAG;IAClB,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;IACvB,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;IACvB,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,CACjB;QAAC,SAAS,EAAE,YAAY,CAAC,MAAM;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM;KAAC,CAChE,CAAC;IACF,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;CACtE,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,EAAE,WAAW,CACjB;QAAC,SAAS,EAAE,YAAY,CAAC,MAAM;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM;KAAC,CAChE,CAAC;IACF,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB,UAAU,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IACpE,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IACtE,WAAW,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IACrE,MAAM,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAChE,SAAS,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpE;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;CAC1E;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;wBAIE,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export { type CameraOptions, type CameraEasing, type CameraAnimationOptions, type CameraCenterOptions, type CameraBoundsOptions, type CameraCenterStop, type CameraBoundsStop, type CameraStop, type InitialViewState, type TrackUserLocation, type TrackUserLocationChangeEvent, type CameraRef, type CameraProps, Camera, } from "./components/camera/Camera";
|
|
2
2
|
export { type ViewState, type ViewStateChangeEvent, type MapViewRef, type MapViewProps, MapView, } from "./components/map-view/MapView";
|
|
3
|
-
export { PointAnnotation } from "./components/annotations/PointAnnotation";
|
|
4
|
-
export type { PointAnnotationRef } from "./components/annotations/PointAnnotation";
|
|
3
|
+
export { PointAnnotation, type PointAnnotationProps, type PointAnnotationRef, type AnnotationEvent, } from "./components/annotations/point-annotation/PointAnnotation";
|
|
5
4
|
export { GeoJSONSourceAnnotation } from "./components/annotations/GeoJSONSourceAnnotation";
|
|
6
|
-
export { Callout } from "./components/annotations/Callout";
|
|
5
|
+
export { Callout, type CalloutProps, } from "./components/annotations/callout/Callout";
|
|
7
6
|
export { UserLocation } from "./components/user-location/UserLocation";
|
|
8
7
|
export { NativeUserLocation } from "./components/user-location/NativeUserLocation";
|
|
9
8
|
export { useCurrentPosition } from "./hooks/useCurrentPosition";
|
|
@@ -13,13 +12,14 @@ export { type RasterSourceProps, RasterSource, } from "./components/sources/rast
|
|
|
13
12
|
export { type VectorSourceRef, type VectorSourceProps, VectorSource, } from "./components/sources/vector-source/VectorSource";
|
|
14
13
|
export { Layer, type LayerProps, type SourceLayerProps, type StandaloneLayerProps, type FillLayerProps, type LineLayerProps, type SymbolLayerProps, type CircleLayerProps, type HeatmapLayerProps, type FillExtrusionLayerProps, type RasterLayerProps, type BackgroundLayerProps, } from "./components/layers/Layer";
|
|
15
14
|
export { type ImageSourceWithSdf, type ImageEntry, type ImagesProps, Images, } from "./components/images/Images";
|
|
16
|
-
export { MarkerView } from "./components/annotations/MarkerView";
|
|
15
|
+
export { MarkerView, type MarkerViewProps, } from "./components/annotations/marker-view/MarkerView";
|
|
17
16
|
export { LocationManager, type GeolocationPosition, } from "./modules/location/LocationManager";
|
|
18
17
|
export { LogManager, type LogLevel } from "./modules/log/LogManager";
|
|
19
18
|
export { NetworkManager } from "./modules/network/NetworkManager";
|
|
20
19
|
export { OfflineManager, type OfflinePackCreateOptions, type OfflinePackDownloadState, type OfflinePackError, type OfflinePackProgressListener, type OfflinePackErrorListener, } from "./modules/offline/OfflineManager";
|
|
21
20
|
export { OfflinePack, type OfflinePackStatus, } from "./modules/offline/OfflinePack";
|
|
22
21
|
export { StaticMapImageManager, type StaticMapOptions, type StaticMapCenterOptions, type StaticMapBoundsOptions, type StaticMapCreateOptions, } from "./modules/static-map/StaticMapManager";
|
|
22
|
+
export type { Anchor } from "./types/Anchor";
|
|
23
23
|
export type { LngLat } from "./types/LngLat";
|
|
24
24
|
export type { LngLatBounds } from "./types/LngLatBounds";
|
|
25
25
|
export type { FillLayerStyle, LineLayerStyle, SymbolLayerStyle, CircleLayerStyle, HeatmapLayerStyle, FillExtrusionLayerStyle, RasterLayerStyle, HillshadeLayerStyle, BackgroundLayerStyle, LightLayerStyle, Expression, } from "./types/MapLibreRNStyles";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,MAAM,GACP,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,OAAO,GACR,MAAM,+BAA+B,CAAC;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position anchor for markers and annotations.
|
|
3
|
+
* Follows MapLibre GL JS PositionAnchor format.
|
|
4
|
+
*
|
|
5
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PositionAnchor/
|
|
6
|
+
*/
|
|
7
|
+
export type Anchor = "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
8
|
+
/**
|
|
9
|
+
* Converts an Anchor string to native {x, y} format.
|
|
10
|
+
* x: 0 = left, 0.5 = center, 1 = right
|
|
11
|
+
* y: 0 = top, 0.5 = center, 1 = bottom
|
|
12
|
+
*/
|
|
13
|
+
export declare function anchorToNative(anchor: Anchor): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../../../src/types/Anchor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GACd,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;AAEnB;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBvE"}
|
|
@@ -9,6 +9,7 @@ export declare const Animated: {
|
|
|
9
9
|
data: string | GeoJSON.GeoJSON | AnimatedGeoJSON;
|
|
10
10
|
}>>;
|
|
11
11
|
ImageSource: RNAnimated.AnimatedComponent<import("react").MemoExoticComponent<({ id, url, ...props }: import("../..").ImageSourceProps) => import("react/jsx-runtime").JSX.Element>>;
|
|
12
|
+
MarkerView: RNAnimated.AnimatedComponent<({ id, anchor, offset, ...props }: import("../..").MarkerViewProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
13
|
Layer: RNAnimated.AnimatedComponent<({ id, ...props }: import("../..").LayerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
14
|
CoordinatesArray: typeof AnimatedCoordinatesArray;
|
|
14
15
|
RouteCoordinatesArray: typeof AnimatedRouteCoordinatesArray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animated.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/animated/Animated.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"Animated.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/animated/Animated.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAMhF,eAAO,MAAM,QAAQ;;cAMP,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,eAAe;;;;;;;;;CAgBvD,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.43",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": true
|
|
@@ -128,12 +128,14 @@
|
|
|
128
128
|
},
|
|
129
129
|
"ios": {
|
|
130
130
|
"componentProvider": {
|
|
131
|
+
"MLRNCallout": "MLRNCalloutComponentView",
|
|
131
132
|
"MLRNCamera": "MLRNCameraComponentView",
|
|
132
133
|
"MLRNImages": "MLRNImagesComponentView",
|
|
133
134
|
"MLRNImageSource": "MLRNImageSourceComponentView",
|
|
134
135
|
"MLRNLayer": "MLRNLayerComponentView",
|
|
135
136
|
"MLRNMapView": "MLRNMapViewComponentView",
|
|
136
137
|
"MLRNNativeUserLocation": "MLRNNativeUserLocationComponentView",
|
|
138
|
+
"MLRNPointAnnotation": "MLRNPointAnnotationComponentView",
|
|
137
139
|
"MLRNRasterSource": "MLRNRasterSourceComponentView",
|
|
138
140
|
"MLRNGeoJSONSource": "MLRNGeoJSONSourceComponentView",
|
|
139
141
|
"MLRNVectorSource": "MLRNVectorSourceComponentView"
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Children } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
Text,
|
|
6
|
+
View,
|
|
7
|
+
type ViewProps,
|
|
8
|
+
type ViewStyle,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
|
|
11
|
+
import CalloutNativeComponent from "./CalloutNativeComponent";
|
|
12
|
+
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
animated: {
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
width: 180,
|
|
18
|
+
zIndex: 9999999,
|
|
19
|
+
},
|
|
20
|
+
content: {
|
|
21
|
+
backgroundColor: "white",
|
|
22
|
+
borderColor: "rgba(0, 0, 0, 0.2)",
|
|
23
|
+
borderRadius: 3,
|
|
24
|
+
borderWidth: 1,
|
|
25
|
+
flex: 1,
|
|
26
|
+
padding: 8,
|
|
27
|
+
position: "relative",
|
|
28
|
+
},
|
|
29
|
+
tip: {
|
|
30
|
+
backgroundColor: "transparent",
|
|
31
|
+
borderBottomColor: "transparent",
|
|
32
|
+
borderBottomWidth: 0,
|
|
33
|
+
borderLeftColor: "transparent",
|
|
34
|
+
borderLeftWidth: 8,
|
|
35
|
+
borderRightColor: "transparent",
|
|
36
|
+
borderRightWidth: 8,
|
|
37
|
+
borderTopColor: "white",
|
|
38
|
+
borderTopWidth: 16,
|
|
39
|
+
elevation: 0,
|
|
40
|
+
marginTop: -2,
|
|
41
|
+
zIndex: 1000,
|
|
42
|
+
},
|
|
43
|
+
title: {
|
|
44
|
+
color: "black",
|
|
45
|
+
textAlign: "center",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export interface CalloutProps extends Omit<ViewProps, "style"> {
|
|
50
|
+
/**
|
|
51
|
+
* String that gets displayed in the default callout.
|
|
52
|
+
*/
|
|
53
|
+
title?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Style property for the CalloutNativeComponent.
|
|
57
|
+
*
|
|
58
|
+
* @experimental Use at your own risk.
|
|
59
|
+
*/
|
|
60
|
+
style?: ViewStyle;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Style property for the Animated.View wrapper, apply animations to this
|
|
64
|
+
*/
|
|
65
|
+
animatedStyle?: ViewStyle;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Style property for the content bubble.
|
|
69
|
+
*/
|
|
70
|
+
contentStyle?: ViewStyle;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Style property for the triangle tip under the content.
|
|
74
|
+
*/
|
|
75
|
+
tipStyle?: ViewStyle;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Style property for the title in the content bubble.
|
|
79
|
+
*/
|
|
80
|
+
titleStyle?: ViewStyle;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Callout that displays information about a selected annotation near the annotation.
|
|
85
|
+
*/
|
|
86
|
+
export const Callout = ({
|
|
87
|
+
title,
|
|
88
|
+
style,
|
|
89
|
+
animatedStyle,
|
|
90
|
+
contentStyle,
|
|
91
|
+
tipStyle,
|
|
92
|
+
titleStyle,
|
|
93
|
+
children,
|
|
94
|
+
testID,
|
|
95
|
+
...props
|
|
96
|
+
}: CalloutProps) => {
|
|
97
|
+
const calloutContent =
|
|
98
|
+
Children.count(children) > 0 ? (
|
|
99
|
+
<Animated.View
|
|
100
|
+
testID={testID ? `${testID}-animated` : undefined}
|
|
101
|
+
style={animatedStyle}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</Animated.View>
|
|
106
|
+
) : (
|
|
107
|
+
<Animated.View
|
|
108
|
+
testID={testID ? `${testID}-animated` : undefined}
|
|
109
|
+
style={[styles.animated, animatedStyle]}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
112
|
+
<View
|
|
113
|
+
testID={testID ? `${testID}-content` : undefined}
|
|
114
|
+
style={[styles.content, contentStyle]}
|
|
115
|
+
>
|
|
116
|
+
<Text
|
|
117
|
+
testID={testID ? `${testID}-title` : undefined}
|
|
118
|
+
style={[styles.title, titleStyle]}
|
|
119
|
+
>
|
|
120
|
+
{title}
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
<View
|
|
124
|
+
testID={testID ? `${testID}-tip` : undefined}
|
|
125
|
+
style={[styles.tip, tipStyle]}
|
|
126
|
+
/>
|
|
127
|
+
</Animated.View>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<CalloutNativeComponent
|
|
132
|
+
testID={testID}
|
|
133
|
+
style={[
|
|
134
|
+
{
|
|
135
|
+
position: "absolute",
|
|
136
|
+
zIndex: 999,
|
|
137
|
+
backgroundColor: "transparent",
|
|
138
|
+
},
|
|
139
|
+
style,
|
|
140
|
+
]}
|
|
141
|
+
>
|
|
142
|
+
{calloutContent}
|
|
143
|
+
</CalloutNativeComponent>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type HostComponent,
|
|
4
|
+
type ViewProps,
|
|
5
|
+
} from "react-native";
|
|
6
|
+
|
|
7
|
+
export interface NativeProps extends ViewProps {}
|
|
8
|
+
|
|
9
|
+
export default codegenNativeComponent<NativeProps>(
|
|
10
|
+
"MLRNCallout",
|
|
11
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
type ReactElement,
|
|
5
|
+
useRef,
|
|
6
|
+
} from "react";
|
|
7
|
+
import {
|
|
8
|
+
type NativeMethods,
|
|
9
|
+
Platform,
|
|
10
|
+
View,
|
|
11
|
+
type ViewProps,
|
|
12
|
+
} from "react-native";
|
|
13
|
+
|
|
14
|
+
import MarkerViewNativeComponent from "./MarkerViewNativeComponent";
|
|
15
|
+
import { useFrozenId } from "../../../hooks/useFrozenId";
|
|
16
|
+
import { type Anchor, anchorToNative } from "../../../types/Anchor";
|
|
17
|
+
import type { LngLat } from "../../../types/LngLat";
|
|
18
|
+
import type { PixelPoint } from "../../../types/PixelPoint";
|
|
19
|
+
import {
|
|
20
|
+
PointAnnotation,
|
|
21
|
+
type PointAnnotationRef,
|
|
22
|
+
} from "../point-annotation/PointAnnotation";
|
|
23
|
+
|
|
24
|
+
export interface MarkerViewProps extends ViewProps {
|
|
25
|
+
/**
|
|
26
|
+
* A string that uniquely identifies the marker.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The center point (specified as a map coordinate) of the marker.
|
|
32
|
+
* See also #anchor.
|
|
33
|
+
*/
|
|
34
|
+
lngLat: LngLat;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the anchor being set on a particular point of the annotation.
|
|
38
|
+
* The anchor indicates which part of the marker should be placed closest to the coordinate.
|
|
39
|
+
* Defaults to "center".
|
|
40
|
+
*
|
|
41
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PositionAnchor/
|
|
42
|
+
*/
|
|
43
|
+
anchor?: Anchor;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The offset in pixels to apply relative to the anchor.
|
|
47
|
+
* Negative values indicate left and up.
|
|
48
|
+
*
|
|
49
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MarkerOptions/#offset
|
|
50
|
+
*/
|
|
51
|
+
offset?: PixelPoint;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Manually selects/deselects the marker.
|
|
55
|
+
*
|
|
56
|
+
* @platform iOS
|
|
57
|
+
*/
|
|
58
|
+
selected?: boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Expects one child - can be container with multiple elements
|
|
62
|
+
*/
|
|
63
|
+
children: ReactElement;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* MarkerView allows you to place an interactive React Native View on the map.
|
|
68
|
+
*
|
|
69
|
+
* If you have static view consider using PointAnnotation or SymbolLayer for better performance.
|
|
70
|
+
*
|
|
71
|
+
* Implemented through:
|
|
72
|
+
* - Android: Native MarkerViewManager using map projection
|
|
73
|
+
* - iOS: [MLNPointAnnotation](https://maplibre.org/maplibre-native/ios/latest/documentation/maplibre/mlnpointannotation/)
|
|
74
|
+
*/
|
|
75
|
+
export const MarkerView = ({
|
|
76
|
+
id,
|
|
77
|
+
anchor = "center",
|
|
78
|
+
offset,
|
|
79
|
+
...props
|
|
80
|
+
}: MarkerViewProps) => {
|
|
81
|
+
const nativeRef = useRef<
|
|
82
|
+
Component<ComponentProps<typeof MarkerViewNativeComponent>> &
|
|
83
|
+
Readonly<NativeMethods>
|
|
84
|
+
>(null);
|
|
85
|
+
|
|
86
|
+
const nativeAnchor = anchorToNative(anchor);
|
|
87
|
+
const nativeOffset = offset ? { x: offset[0], y: offset[1] } : undefined;
|
|
88
|
+
|
|
89
|
+
const pointAnnotationRef = useRef<PointAnnotationRef>(null);
|
|
90
|
+
const frozenId = useFrozenId(id);
|
|
91
|
+
|
|
92
|
+
if (Platform.OS === "ios") {
|
|
93
|
+
return (
|
|
94
|
+
<PointAnnotation
|
|
95
|
+
ref={pointAnnotationRef}
|
|
96
|
+
id={frozenId}
|
|
97
|
+
anchor={anchor}
|
|
98
|
+
offset={offset}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<MarkerViewNativeComponent
|
|
106
|
+
ref={nativeRef}
|
|
107
|
+
id={frozenId}
|
|
108
|
+
anchor={nativeAnchor}
|
|
109
|
+
offset={nativeOffset}
|
|
110
|
+
{...props}
|
|
111
|
+
style={[
|
|
112
|
+
{ flex: 0, alignSelf: "flex-start", overflow: "visible" },
|
|
113
|
+
props.style,
|
|
114
|
+
]}
|
|
115
|
+
>
|
|
116
|
+
<View
|
|
117
|
+
collapsable={false}
|
|
118
|
+
style={{ flex: 0, alignSelf: "flex-start", overflow: "visible" }}
|
|
119
|
+
>
|
|
120
|
+
{props.children}
|
|
121
|
+
</View>
|
|
122
|
+
</MarkerViewNativeComponent>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type HostComponent,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from "react-native";
|
|
7
|
+
|
|
8
|
+
import type { UnsafeMixed } from "../../../types/codegen/UnsafeMixed";
|
|
9
|
+
|
|
10
|
+
type NativeAnchor = {
|
|
11
|
+
x: CodegenTypes.Double;
|
|
12
|
+
y: CodegenTypes.Double;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type NativeOffset = {
|
|
16
|
+
x: CodegenTypes.Double;
|
|
17
|
+
y: CodegenTypes.Double;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface NativeProps extends ViewProps {
|
|
21
|
+
lngLat: UnsafeMixed<
|
|
22
|
+
[longitude: CodegenTypes.Double, latitude: CodegenTypes.Double]
|
|
23
|
+
>;
|
|
24
|
+
anchor?: NativeAnchor;
|
|
25
|
+
offset?: NativeOffset;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default codegenNativeComponent<NativeProps>(
|
|
29
|
+
"MLRNMarkerView",
|
|
30
|
+
) as HostComponent<NativeProps>;
|