@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.
Files changed (137) hide show
  1. package/android/build.gradle +1 -3
  2. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +3 -3
  3. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt +7 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCalloutManager.kt +29 -0
  5. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerView.kt +220 -0
  6. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewContent.kt +50 -0
  7. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewManager.kt +81 -0
  8. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MarkerViewManager.kt +127 -0
  9. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotation.kt +407 -0
  10. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotationManager.kt +105 -0
  11. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +38 -37
  12. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationClickEvent.java +1 -1
  13. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationDragEvent.java +1 -1
  14. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationEvent.kt +30 -0
  15. package/ios/components/annotations/callout/MLRNCalloutComponentView.h +10 -0
  16. package/ios/components/annotations/callout/MLRNCalloutComponentView.mm +91 -0
  17. package/ios/components/annotations/point-annotation/MLRNPointAnnotation.h +44 -0
  18. package/ios/components/annotations/{MLRNPointAnnotation.m → point-annotation/MLRNPointAnnotation.m} +69 -35
  19. package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.h +10 -0
  20. package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.mm +331 -0
  21. package/ios/components/map-view/MLRNMapView.m +4 -5
  22. package/lib/commonjs/components/annotations/callout/Callout.js +94 -0
  23. package/lib/commonjs/components/annotations/callout/Callout.js.map +1 -0
  24. package/lib/commonjs/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  25. package/lib/commonjs/components/annotations/marker-view/MarkerView.js +70 -0
  26. package/lib/commonjs/components/annotations/marker-view/MarkerView.js.map +1 -0
  27. package/lib/commonjs/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  28. package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js +88 -0
  29. package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
  30. package/lib/commonjs/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  31. package/lib/commonjs/index.js +3 -3
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/types/Anchor.js +68 -0
  34. package/lib/commonjs/types/Anchor.js.map +1 -0
  35. package/lib/commonjs/utils/animated/Animated.js +4 -0
  36. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  37. package/lib/module/components/annotations/callout/Callout.js +88 -0
  38. package/lib/module/components/annotations/callout/Callout.js.map +1 -0
  39. package/lib/module/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  40. package/lib/module/components/annotations/marker-view/MarkerView.js +64 -0
  41. package/lib/module/components/annotations/marker-view/MarkerView.js.map +1 -0
  42. package/lib/module/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  43. package/lib/module/components/annotations/point-annotation/PointAnnotation.js +83 -0
  44. package/lib/module/components/annotations/point-annotation/PointAnnotation.js.map +1 -0
  45. package/lib/module/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  46. package/lib/module/index.js +3 -3
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/types/Anchor.js +64 -0
  49. package/lib/module/types/Anchor.js.map +1 -0
  50. package/lib/module/utils/animated/Animated.js +4 -0
  51. package/lib/module/utils/animated/Animated.js.map +1 -1
  52. package/lib/typescript/{module/src/components/annotations → commonjs/src/components/annotations/callout}/Callout.d.ts +9 -9
  53. package/lib/typescript/commonjs/src/components/annotations/callout/Callout.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
  55. package/lib/typescript/commonjs/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
  57. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
  59. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
  61. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
  63. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  64. package/lib/typescript/commonjs/src/index.d.ts +4 -4
  65. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/src/types/Anchor.d.ts +17 -0
  67. package/lib/typescript/commonjs/src/types/Anchor.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -0
  69. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
  70. package/lib/typescript/{commonjs/src/components/annotations → module/src/components/annotations/callout}/Callout.d.ts +9 -9
  71. package/lib/typescript/module/src/components/annotations/callout/Callout.d.ts.map +1 -0
  72. package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts +6 -0
  73. package/lib/typescript/module/src/components/annotations/callout/CalloutNativeComponent.d.ts.map +1 -0
  74. package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts +52 -0
  75. package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts.map +1 -0
  76. package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts +21 -0
  77. package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +1 -0
  78. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts +95 -0
  79. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +1 -0
  80. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts +43 -0
  81. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  82. package/lib/typescript/module/src/index.d.ts +4 -4
  83. package/lib/typescript/module/src/index.d.ts.map +1 -1
  84. package/lib/typescript/module/src/types/Anchor.d.ts +17 -0
  85. package/lib/typescript/module/src/types/Anchor.d.ts.map +1 -0
  86. package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -0
  87. package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
  88. package/package.json +3 -1
  89. package/src/components/annotations/callout/Callout.tsx +145 -0
  90. package/src/components/annotations/callout/CalloutNativeComponent.ts +11 -0
  91. package/src/components/annotations/marker-view/MarkerView.tsx +124 -0
  92. package/src/components/annotations/marker-view/MarkerViewNativeComponent.ts +30 -0
  93. package/src/components/annotations/point-annotation/PointAnnotation.tsx +219 -0
  94. package/src/components/annotations/point-annotation/PointAnnotationNativeComponent.ts +58 -0
  95. package/src/index.ts +15 -4
  96. package/src/types/Anchor.ts +44 -0
  97. package/src/utils/animated/Animated.tsx +6 -0
  98. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCallout.java +0 -11
  99. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNCalloutManager.java +0 -18
  100. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerView.java +0 -112
  101. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNMarkerViewManager.java +0 -45
  102. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotation.java +0 -361
  103. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MLRNPointAnnotationManager.java +0 -84
  104. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerView.java +0 -23
  105. package/android/src/main/java/org/maplibre/reactnative/components/annotations/MarkerViewManager.java +0 -69
  106. package/ios/components/annotations/MLRNCalloutManager.h +0 -5
  107. package/ios/components/annotations/MLRNCalloutManager.m +0 -12
  108. package/ios/components/annotations/MLRNPointAnnotation.h +0 -33
  109. package/ios/components/annotations/MLRNPointAnnotationManager.h +0 -5
  110. package/ios/components/annotations/MLRNPointAnnotationManager.m +0 -27
  111. package/lib/commonjs/components/annotations/Callout.js +0 -101
  112. package/lib/commonjs/components/annotations/Callout.js.map +0 -1
  113. package/lib/commonjs/components/annotations/MarkerView.js +0 -60
  114. package/lib/commonjs/components/annotations/MarkerView.js.map +0 -1
  115. package/lib/commonjs/components/annotations/PointAnnotation.js +0 -114
  116. package/lib/commonjs/components/annotations/PointAnnotation.js.map +0 -1
  117. package/lib/module/components/annotations/Callout.js +0 -96
  118. package/lib/module/components/annotations/Callout.js.map +0 -1
  119. package/lib/module/components/annotations/MarkerView.js +0 -55
  120. package/lib/module/components/annotations/MarkerView.js.map +0 -1
  121. package/lib/module/components/annotations/PointAnnotation.js +0 -110
  122. package/lib/module/components/annotations/PointAnnotation.js.map +0 -1
  123. package/lib/typescript/commonjs/src/components/annotations/Callout.d.ts.map +0 -1
  124. package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts +0 -44
  125. package/lib/typescript/commonjs/src/components/annotations/MarkerView.d.ts.map +0 -1
  126. package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts +0 -90
  127. package/lib/typescript/commonjs/src/components/annotations/PointAnnotation.d.ts.map +0 -1
  128. package/lib/typescript/module/src/components/annotations/Callout.d.ts.map +0 -1
  129. package/lib/typescript/module/src/components/annotations/MarkerView.d.ts +0 -44
  130. package/lib/typescript/module/src/components/annotations/MarkerView.d.ts.map +0 -1
  131. package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts +0 -90
  132. package/lib/typescript/module/src/components/annotations/PointAnnotation.d.ts.map +0 -1
  133. package/src/components/annotations/Callout.tsx +0 -139
  134. package/src/components/annotations/MarkerView.tsx +0 -86
  135. package/src/components/annotations/PointAnnotation.tsx +0 -240
  136. /package/ios/components/annotations/{MLRNCallout.h → callout/MLRNCallout.h} +0 -0
  137. /package/ios/components/annotations/{MLRNCallout.m → callout/MLRNCallout.m} +0 -0
@@ -1,90 +0,0 @@
1
- import { type ReactElement } from "react";
2
- import { type ViewProps } from "react-native";
3
- export declare const NATIVE_MODULE_NAME = "MLRNPointAnnotation";
4
- type FeaturePayload = GeoJSON.Feature<GeoJSON.Point, {
5
- screenPointX: number;
6
- screenPointY: number;
7
- }>;
8
- export interface PointAnnotationProps {
9
- /**
10
- * A string that uniquely identifies the annotation
11
- */
12
- id: string;
13
- /**
14
- * The string containing the annotation’s title. Note this is required to be set if you want to see a callout appear on iOS.
15
- */
16
- title?: string;
17
- /**
18
- * The string containing the annotation’s snippet(subtitle). Not displayed in the default callout.
19
- */
20
- snippet?: string;
21
- /**
22
- * Manually selects/deselects annotation
23
- */
24
- selected?: boolean;
25
- /**
26
- * Enable or disable dragging. Defaults to false.
27
- */
28
- draggable?: boolean;
29
- /**
30
- * The center point (specified as a map coordinate) of the annotation.
31
- */
32
- coordinate: number[];
33
- /**
34
- * Specifies the anchor being set on a particular point of the annotation.
35
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
36
- * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
37
- * Note this is only for custom annotations not the default pin view.
38
- * Defaults to the center of the view.
39
- */
40
- anchor?: {
41
- /**
42
- * See anchor
43
- */
44
- x: number;
45
- /**
46
- * See anchor
47
- */
48
- y: number;
49
- };
50
- /**
51
- * This callback is fired once this annotation is selected. Returns a Feature as the first param.
52
- */
53
- onSelected?: (payload: FeaturePayload) => void;
54
- /**
55
- * This callback is fired once this annotation is deselected.
56
- */
57
- onDeselected?: (payload: FeaturePayload) => void;
58
- /**
59
- * This callback is fired once this annotation has started being dragged.
60
- */
61
- onDragStart?: (payload: FeaturePayload) => void;
62
- /**
63
- * This callback is fired once this annotation has stopped being dragged.
64
- */
65
- onDragEnd?: (payload: FeaturePayload) => void;
66
- /**
67
- * This callback is fired while this annotation is being dragged.
68
- */
69
- onDrag?: (payload: FeaturePayload) => void;
70
- /**
71
- * Expects one child, and an optional callout can be added as well
72
- */
73
- children: ReactElement | [ReactElement, ReactElement];
74
- style?: ViewProps["style"];
75
- }
76
- export interface PointAnnotationRef {
77
- refresh(): void;
78
- }
79
- /**
80
- * PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
81
- *
82
- * Consider using GeoJSONSource and SymbolLayer instead, if you have many points, and you have static images,
83
- * they'll offer much better performance.
84
- *
85
- * If you need interactive views please use MarkerView,
86
- * as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
87
- */
88
- export declare const PointAnnotation: import("react").ForwardRefExoticComponent<PointAnnotationProps & import("react").RefAttributes<PointAnnotationRef>>;
89
- export {};
90
- //# sourceMappingURL=PointAnnotation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PointAnnotation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/annotations/PointAnnotation.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAUxD,KAAK,cAAc,GAAG,OAAO,CAAC,OAAO,CACnC,OAAO,CAAC,KAAK,EACb;IACE,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;QACV;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAEtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,qHA+G3B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../../../../../../src/components/annotations/Callout.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAsChD,UAAU,YAAa,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IACrD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAMD;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,4CAoD1C,CAAC"}
@@ -1,44 +0,0 @@
1
- import { type ReactElement } from "react";
2
- import { type ViewProps } from "react-native";
3
- export declare const NATIVE_MODULE_NAME = "MLRNMarkerView";
4
- interface MarkerViewProps extends ViewProps {
5
- /**
6
- * The center point (specified as a map coordinate) of the marker.
7
- * See also #anchor.
8
- */
9
- coordinate: number[];
10
- /**
11
- * Specifies the anchor being set on a particular point of the annotation.
12
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
13
- * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
14
- * Note this is only for custom annotations not the default pin view.
15
- * Defaults to the center of the view.
16
- */
17
- anchor?: {
18
- /**
19
- * `x` of anchor
20
- */
21
- x: number;
22
- /**
23
- * `y` of anchor
24
- */
25
- y: number;
26
- };
27
- allowOverlap?: boolean;
28
- isSelected?: boolean;
29
- /**
30
- * Expects one child - can be container with multiple elements
31
- */
32
- children: ReactElement;
33
- }
34
- /**
35
- * MarkerView allows you to place a interactive react native marker to the map.
36
- *
37
- * If you have static view consider using PointAnnotation or SymbolLayer they'll offer much better performance
38
- * .
39
- * This is based on [MakerView plugin](https://github.com/maplibre/maplibre-plugins-android/tree/main/plugin-markerview) on Android
40
- * and PointAnnotation on iOS.
41
- */
42
- export declare const MarkerView: ({ anchor, allowOverlap, isSelected, ...rest }: MarkerViewProps) => import("react/jsx-runtime").JSX.Element;
43
- export {};
44
- //# sourceMappingURL=MarkerView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkerView.d.ts","sourceRoot":"","sources":["../../../../../../src/components/annotations/MarkerView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAW,MAAM,OAAO,CAAC;AACnD,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAKhF,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD,UAAU,eAAgB,SAAQ,SAAS;IACzC;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;QACV;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB;AASD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,+CAKxB,eAAe,4CAqBjB,CAAC"}
@@ -1,90 +0,0 @@
1
- import { type ReactElement } from "react";
2
- import { type ViewProps } from "react-native";
3
- export declare const NATIVE_MODULE_NAME = "MLRNPointAnnotation";
4
- type FeaturePayload = GeoJSON.Feature<GeoJSON.Point, {
5
- screenPointX: number;
6
- screenPointY: number;
7
- }>;
8
- export interface PointAnnotationProps {
9
- /**
10
- * A string that uniquely identifies the annotation
11
- */
12
- id: string;
13
- /**
14
- * The string containing the annotation’s title. Note this is required to be set if you want to see a callout appear on iOS.
15
- */
16
- title?: string;
17
- /**
18
- * The string containing the annotation’s snippet(subtitle). Not displayed in the default callout.
19
- */
20
- snippet?: string;
21
- /**
22
- * Manually selects/deselects annotation
23
- */
24
- selected?: boolean;
25
- /**
26
- * Enable or disable dragging. Defaults to false.
27
- */
28
- draggable?: boolean;
29
- /**
30
- * The center point (specified as a map coordinate) of the annotation.
31
- */
32
- coordinate: number[];
33
- /**
34
- * Specifies the anchor being set on a particular point of the annotation.
35
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
36
- * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
37
- * Note this is only for custom annotations not the default pin view.
38
- * Defaults to the center of the view.
39
- */
40
- anchor?: {
41
- /**
42
- * See anchor
43
- */
44
- x: number;
45
- /**
46
- * See anchor
47
- */
48
- y: number;
49
- };
50
- /**
51
- * This callback is fired once this annotation is selected. Returns a Feature as the first param.
52
- */
53
- onSelected?: (payload: FeaturePayload) => void;
54
- /**
55
- * This callback is fired once this annotation is deselected.
56
- */
57
- onDeselected?: (payload: FeaturePayload) => void;
58
- /**
59
- * This callback is fired once this annotation has started being dragged.
60
- */
61
- onDragStart?: (payload: FeaturePayload) => void;
62
- /**
63
- * This callback is fired once this annotation has stopped being dragged.
64
- */
65
- onDragEnd?: (payload: FeaturePayload) => void;
66
- /**
67
- * This callback is fired while this annotation is being dragged.
68
- */
69
- onDrag?: (payload: FeaturePayload) => void;
70
- /**
71
- * Expects one child, and an optional callout can be added as well
72
- */
73
- children: ReactElement | [ReactElement, ReactElement];
74
- style?: ViewProps["style"];
75
- }
76
- export interface PointAnnotationRef {
77
- refresh(): void;
78
- }
79
- /**
80
- * PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
81
- *
82
- * Consider using GeoJSONSource and SymbolLayer instead, if you have many points, and you have static images,
83
- * they'll offer much better performance.
84
- *
85
- * If you need interactive views please use MarkerView,
86
- * as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
87
- */
88
- export declare const PointAnnotation: import("react").ForwardRefExoticComponent<PointAnnotationProps & import("react").RefAttributes<PointAnnotationRef>>;
89
- export {};
90
- //# sourceMappingURL=PointAnnotation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PointAnnotation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/annotations/PointAnnotation.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAUxD,KAAK,cAAc,GAAG,OAAO,CAAC,OAAO,CACnC,OAAO,CAAC,KAAK,EACb;IACE,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;QACV;;WAEG;QACH,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAEtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,qHA+G3B,CAAC"}
@@ -1,139 +0,0 @@
1
- import { Children } from "react";
2
- import {
3
- Animated,
4
- requireNativeComponent,
5
- type StyleProp,
6
- StyleSheet,
7
- Text,
8
- View,
9
- type ViewProps,
10
- type ViewStyle,
11
- } from "react-native";
12
-
13
- export const NATIVE_MODULE_NAME = "MLRNCallout";
14
-
15
- const styles = StyleSheet.create({
16
- container: {
17
- alignItems: "center",
18
- justifyContent: "center",
19
- width: 180,
20
- zIndex: 9999999,
21
- },
22
- content: {
23
- backgroundColor: "white",
24
- borderColor: "rgba(0, 0, 0, 0.2)",
25
- borderRadius: 3,
26
- borderWidth: 1,
27
- flex: 1,
28
- padding: 8,
29
- position: "relative",
30
- },
31
- tip: {
32
- backgroundColor: "transparent",
33
- borderBottomColor: "transparent",
34
- borderBottomWidth: 0,
35
- borderLeftColor: "transparent",
36
- borderLeftWidth: 8,
37
- borderRightColor: "transparent",
38
- borderRightWidth: 8,
39
- borderTopColor: "white",
40
- borderTopWidth: 16,
41
- elevation: 0,
42
- marginTop: -2,
43
- zIndex: 1000,
44
- },
45
- title: {
46
- color: "black",
47
- textAlign: "center",
48
- },
49
- });
50
-
51
- interface CalloutProps extends Omit<ViewProps, "style"> {
52
- /**
53
- * String that get's displayed in the default callout.
54
- */
55
- title?: string;
56
- /**
57
- * Style property for the Animated.View wrapper, apply animations to this
58
- */
59
- style?: ViewStyle;
60
- /**
61
- * Style property for the native MLRNCallout container, set at your own risk.
62
- */
63
- containerStyle?: ViewStyle;
64
- /**
65
- * Style property for the content bubble.
66
- */
67
- contentStyle?: ViewStyle;
68
- /**
69
- * Style property for the triangle tip under the content.
70
- */
71
- tipStyle?: ViewStyle;
72
- /**
73
- * Style property for the title in the content bubble.
74
- */
75
- textStyle?: ViewStyle;
76
- }
77
-
78
- interface NativeProps extends Omit<CalloutProps, "style"> {
79
- style: StyleProp<ViewStyle>;
80
- }
81
-
82
- /**
83
- * Callout that displays information about a selected annotation near the annotation.
84
- */
85
- export const Callout = (props: CalloutProps) => {
86
- const {
87
- title,
88
- style,
89
- containerStyle,
90
- contentStyle,
91
- tipStyle,
92
- textStyle,
93
- children,
94
- } = props;
95
-
96
- const _containerStyle: ViewStyle[] = [
97
- {
98
- position: "absolute",
99
- zIndex: 999,
100
- backgroundColor: "transparent",
101
- ...containerStyle,
102
- } as ViewStyle,
103
- ];
104
-
105
- const _hasChildren = Children.count(children) > 0;
106
-
107
- const _renderDefaultCallout = () => {
108
- return (
109
- <Animated.View testID="container" style={[styles.container, style]}>
110
- <View testID="wrapper" style={[styles.content, contentStyle]}>
111
- <Text testID="title" style={[styles.title, textStyle]}>
112
- {title}
113
- </Text>
114
- </View>
115
- <View testID="tip" style={[styles.tip, tipStyle]} />
116
- </Animated.View>
117
- );
118
- };
119
-
120
- const _renderCustomCallout = () => {
121
- return (
122
- <Animated.View testID="container" {...props} style={style}>
123
- {children}
124
- </Animated.View>
125
- );
126
- };
127
-
128
- const calloutContent = _hasChildren
129
- ? _renderCustomCallout()
130
- : _renderDefaultCallout();
131
-
132
- return (
133
- <MLRNCallout testID="callout" style={_containerStyle}>
134
- {calloutContent}
135
- </MLRNCallout>
136
- );
137
- };
138
-
139
- const MLRNCallout = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
@@ -1,86 +0,0 @@
1
- import { point } from "@turf/helpers";
2
- import { type ReactElement, useMemo } from "react";
3
- import { Platform, requireNativeComponent, type ViewProps } from "react-native";
4
-
5
- import { PointAnnotation } from "./PointAnnotation";
6
- import { toJSONString } from "../../utils";
7
-
8
- export const NATIVE_MODULE_NAME = "MLRNMarkerView";
9
-
10
- interface MarkerViewProps extends ViewProps {
11
- /**
12
- * The center point (specified as a map coordinate) of the marker.
13
- * See also #anchor.
14
- */
15
- coordinate: number[];
16
- /**
17
- * Specifies the anchor being set on a particular point of the annotation.
18
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
19
- * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
20
- * Note this is only for custom annotations not the default pin view.
21
- * Defaults to the center of the view.
22
- */
23
- anchor?: {
24
- /**
25
- * `x` of anchor
26
- */
27
- x: number;
28
- /**
29
- * `y` of anchor
30
- */
31
- y: number;
32
- };
33
- allowOverlap?: boolean;
34
- isSelected?: boolean;
35
- /**
36
- * Expects one child - can be container with multiple elements
37
- */
38
- children: ReactElement;
39
- }
40
-
41
- interface NativeProps extends ViewProps {
42
- coordinate: string | undefined;
43
- anchor: { x: number; y: number };
44
- allowOverlap: boolean;
45
- isSelected: boolean;
46
- }
47
-
48
- /**
49
- * MarkerView allows you to place a interactive react native marker to the map.
50
- *
51
- * If you have static view consider using PointAnnotation or SymbolLayer they'll offer much better performance
52
- * .
53
- * This is based on [MakerView plugin](https://github.com/maplibre/maplibre-plugins-android/tree/main/plugin-markerview) on Android
54
- * and PointAnnotation on iOS.
55
- */
56
- export const MarkerView = ({
57
- anchor = { x: 0.5, y: 0.5 },
58
- allowOverlap = false,
59
- isSelected = false,
60
- ...rest
61
- }: MarkerViewProps) => {
62
- const props = { anchor, allowOverlap, isSelected, ...rest };
63
- const coordinate = props.coordinate
64
- ? toJSONString(point(props.coordinate))
65
- : undefined;
66
-
67
- const idForPointAnnotation = useMemo(() => {
68
- lastId = lastId + 1;
69
- return `MV-${lastId}`;
70
- }, []);
71
-
72
- if (Platform.OS === "ios") {
73
- return <PointAnnotation id={idForPointAnnotation} {...props} />;
74
- }
75
-
76
- const propsToSend = {
77
- ...props,
78
- coordinate,
79
- };
80
-
81
- return <MLRNMarkerView {...propsToSend}>{props.children}</MLRNMarkerView>;
82
- };
83
-
84
- let lastId = 0;
85
-
86
- const MLRNMarkerView = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);