@lugg/maps 0.2.0-alpha.9 → 1.0.0-beta.1

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 (184) hide show
  1. package/README.md +21 -20
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +74 -0
  4. package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +38 -0
  5. package/android/src/main/java/com/luggmaps/LuggMapView.kt +290 -0
  6. package/android/src/main/java/com/luggmaps/{LuggGoogleMapViewManager.kt → LuggMapViewManager.kt} +99 -36
  7. package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +11 -14
  8. package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +187 -21
  9. package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +28 -0
  10. package/android/src/main/java/com/luggmaps/LuggPackage.kt +8 -4
  11. package/android/src/main/java/com/luggmaps/LuggPolygonView.kt +85 -0
  12. package/android/src/main/java/com/luggmaps/LuggPolygonViewManager.kt +100 -0
  13. package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +16 -0
  14. package/android/src/main/java/com/luggmaps/LuggPolylineViewManager.kt +22 -0
  15. package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +874 -0
  16. package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +60 -0
  17. package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +89 -24
  18. package/android/src/main/java/com/luggmaps/events/LongPressEvent.kt +29 -0
  19. package/android/src/main/java/com/luggmaps/events/MarkerDragEvent.kt +41 -0
  20. package/android/src/main/java/com/luggmaps/events/MarkerPressEvent.kt +34 -0
  21. package/android/src/main/java/com/luggmaps/events/PolygonPressEvent.kt +12 -0
  22. package/android/src/main/java/com/luggmaps/events/PressEvent.kt +29 -0
  23. package/ios/LuggCalloutView.h +23 -0
  24. package/ios/LuggCalloutView.mm +145 -0
  25. package/ios/LuggMapView.h +9 -0
  26. package/ios/LuggMapView.mm +343 -0
  27. package/ios/LuggMarkerView.h +15 -0
  28. package/ios/LuggMarkerView.mm +136 -2
  29. package/ios/LuggPolygonView.h +31 -0
  30. package/ios/LuggPolygonView.mm +151 -0
  31. package/ios/LuggPolylineView.h +4 -0
  32. package/ios/LuggPolylineView.mm +23 -0
  33. package/ios/core/AppleMapProvider.h +15 -0
  34. package/ios/core/AppleMapProvider.mm +1173 -0
  35. package/ios/core/GMSPolylineAnimator.h +3 -0
  36. package/ios/core/GMSPolylineAnimator.m +101 -15
  37. package/ios/core/GoogleMapProvider.h +13 -0
  38. package/ios/core/GoogleMapProvider.mm +798 -0
  39. package/ios/core/LuggAnnotationView.h +12 -0
  40. package/ios/core/LuggAnnotationView.mm +55 -0
  41. package/ios/core/MKPolylineAnimator.h +4 -0
  42. package/ios/core/MKPolylineAnimator.m +167 -42
  43. package/ios/core/MapProviderDelegate.h +84 -0
  44. package/ios/core/PolylineAnimatorBase.h +24 -1
  45. package/ios/core/PolylineAnimatorBase.m +82 -19
  46. package/ios/events/LongPressEvent.h +29 -0
  47. package/ios/events/MarkerDragEvent.h +69 -0
  48. package/ios/events/MarkerPressEvent.h +29 -0
  49. package/ios/events/PolygonPressEvent.h +20 -0
  50. package/ios/events/PressEvent.h +29 -0
  51. package/ios/extensions/MKMapView+Zoom.h +2 -0
  52. package/ios/extensions/MKMapView+Zoom.m +14 -4
  53. package/lib/module/MapProvider.js +2 -4
  54. package/lib/module/MapProvider.js.map +1 -1
  55. package/lib/module/MapProvider.web.js +14 -7
  56. package/lib/module/MapProvider.web.js.map +1 -1
  57. package/lib/module/MapView.js +33 -16
  58. package/lib/module/MapView.js.map +1 -1
  59. package/lib/module/MapView.web.js +296 -181
  60. package/lib/module/MapView.web.js.map +1 -1
  61. package/lib/module/components/GeoJson.js +159 -0
  62. package/lib/module/components/GeoJson.js.map +1 -0
  63. package/lib/module/components/GeoJson.types.js +4 -0
  64. package/lib/module/components/GeoJson.types.js.map +1 -0
  65. package/lib/module/components/Marker.js +49 -8
  66. package/lib/module/components/Marker.js.map +1 -1
  67. package/lib/module/components/Marker.types.js +4 -0
  68. package/lib/module/components/Marker.types.js.map +1 -0
  69. package/lib/module/components/Marker.web.js +159 -24
  70. package/lib/module/components/Marker.web.js.map +1 -1
  71. package/lib/module/components/Polygon.js +46 -0
  72. package/lib/module/components/Polygon.js.map +1 -0
  73. package/lib/module/components/Polygon.types.js +4 -0
  74. package/lib/module/components/Polygon.types.js.map +1 -0
  75. package/lib/module/components/Polygon.web.js +87 -0
  76. package/lib/module/components/Polygon.web.js.map +1 -0
  77. package/lib/module/components/Polyline.js +17 -4
  78. package/lib/module/components/Polyline.js.map +1 -1
  79. package/lib/module/components/Polyline.types.js +4 -0
  80. package/lib/module/components/Polyline.types.js.map +1 -0
  81. package/lib/module/components/Polyline.web.js +108 -31
  82. package/lib/module/components/Polyline.web.js.map +1 -1
  83. package/lib/module/components/index.js +4 -2
  84. package/lib/module/components/index.js.map +1 -1
  85. package/lib/module/components/index.web.js +2 -0
  86. package/lib/module/components/index.web.js.map +1 -1
  87. package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +20 -0
  88. package/lib/module/fabric/{LuggGoogleMapViewNativeComponent.ts → LuggMapViewNativeComponent.ts} +43 -7
  89. package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +49 -1
  90. package/lib/module/fabric/LuggPolygonViewNativeComponent.ts +25 -0
  91. package/lib/module/fabric/LuggPolylineViewNativeComponent.ts +8 -0
  92. package/lib/module/index.js +4 -1
  93. package/lib/module/index.js.map +1 -1
  94. package/lib/module/index.web.js +4 -1
  95. package/lib/module/index.web.js.map +1 -1
  96. package/lib/typescript/src/MapProvider.d.ts +1 -1
  97. package/lib/typescript/src/MapProvider.d.ts.map +1 -1
  98. package/lib/typescript/src/MapProvider.web.d.ts +23 -1
  99. package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
  100. package/lib/typescript/src/MapView.d.ts +4 -4
  101. package/lib/typescript/src/MapView.d.ts.map +1 -1
  102. package/lib/typescript/src/MapView.types.d.ts +35 -9
  103. package/lib/typescript/src/MapView.types.d.ts.map +1 -1
  104. package/lib/typescript/src/MapView.web.d.ts +2 -11
  105. package/lib/typescript/src/MapView.web.d.ts.map +1 -1
  106. package/lib/typescript/src/components/GeoJson.d.ts +4 -0
  107. package/lib/typescript/src/components/GeoJson.d.ts.map +1 -0
  108. package/lib/typescript/src/components/GeoJson.types.d.ts +89 -0
  109. package/lib/typescript/src/components/GeoJson.types.d.ts.map +1 -0
  110. package/lib/typescript/src/components/Marker.d.ts +6 -33
  111. package/lib/typescript/src/components/Marker.d.ts.map +1 -1
  112. package/lib/typescript/src/components/Marker.types.d.ts +100 -0
  113. package/lib/typescript/src/components/Marker.types.d.ts.map +1 -0
  114. package/lib/typescript/src/components/Marker.web.d.ts +2 -5
  115. package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
  116. package/lib/typescript/src/components/Polygon.d.ts +10 -0
  117. package/lib/typescript/src/components/Polygon.d.ts.map +1 -0
  118. package/lib/typescript/src/components/Polygon.types.d.ts +33 -0
  119. package/lib/typescript/src/components/Polygon.types.d.ts.map +1 -0
  120. package/lib/typescript/src/components/Polygon.web.d.ts +3 -0
  121. package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -0
  122. package/lib/typescript/src/components/Polyline.d.ts +6 -21
  123. package/lib/typescript/src/components/Polyline.d.ts.map +1 -1
  124. package/lib/typescript/src/components/Polyline.types.d.ts +53 -0
  125. package/lib/typescript/src/components/Polyline.types.d.ts.map +1 -0
  126. package/lib/typescript/src/components/Polyline.web.d.ts +2 -5
  127. package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
  128. package/lib/typescript/src/components/index.d.ts +8 -2
  129. package/lib/typescript/src/components/index.d.ts.map +1 -1
  130. package/lib/typescript/src/components/index.web.d.ts +6 -2
  131. package/lib/typescript/src/components/index.web.d.ts.map +1 -1
  132. package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +13 -0
  133. package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts.map +1 -0
  134. package/lib/typescript/src/fabric/{LuggGoogleMapViewNativeComponent.d.ts → LuggMapViewNativeComponent.d.ts} +30 -4
  135. package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -0
  136. package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +45 -1
  137. package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
  138. package/lib/typescript/src/fabric/LuggPolygonViewNativeComponent.d.ts +18 -0
  139. package/lib/typescript/src/fabric/LuggPolygonViewNativeComponent.d.ts.map +1 -0
  140. package/lib/typescript/src/fabric/LuggPolylineViewNativeComponent.d.ts +7 -0
  141. package/lib/typescript/src/fabric/LuggPolylineViewNativeComponent.d.ts.map +1 -1
  142. package/lib/typescript/src/index.d.ts +11 -3
  143. package/lib/typescript/src/index.d.ts.map +1 -1
  144. package/lib/typescript/src/index.web.d.ts +9 -1
  145. package/lib/typescript/src/index.web.d.ts.map +1 -1
  146. package/lib/typescript/src/types.d.ts +11 -0
  147. package/lib/typescript/src/types.d.ts.map +1 -1
  148. package/package.json +11 -9
  149. package/src/MapProvider.tsx +1 -3
  150. package/src/MapProvider.web.tsx +22 -3
  151. package/src/MapView.tsx +32 -26
  152. package/src/MapView.types.ts +43 -9
  153. package/src/MapView.web.tsx +368 -210
  154. package/src/components/GeoJson.tsx +221 -0
  155. package/src/components/GeoJson.types.ts +118 -0
  156. package/src/components/Marker.tsx +75 -38
  157. package/src/components/Marker.types.ts +102 -0
  158. package/src/components/Marker.web.tsx +197 -19
  159. package/src/components/Polygon.tsx +52 -0
  160. package/src/components/Polygon.types.ts +33 -0
  161. package/src/components/Polygon.web.tsx +104 -0
  162. package/src/components/Polyline.tsx +23 -22
  163. package/src/components/Polyline.types.ts +55 -0
  164. package/src/components/Polyline.web.tsx +151 -37
  165. package/src/components/index.ts +17 -2
  166. package/src/components/index.web.ts +6 -2
  167. package/src/fabric/LuggCalloutViewNativeComponent.ts +20 -0
  168. package/src/fabric/{LuggGoogleMapViewNativeComponent.ts → LuggMapViewNativeComponent.ts} +43 -7
  169. package/src/fabric/LuggMarkerViewNativeComponent.ts +49 -1
  170. package/src/fabric/LuggPolygonViewNativeComponent.ts +25 -0
  171. package/src/fabric/LuggPolylineViewNativeComponent.ts +8 -0
  172. package/src/index.ts +30 -1
  173. package/src/index.web.ts +16 -1
  174. package/src/types.ts +13 -0
  175. package/android/src/main/java/com/luggmaps/LuggGoogleMapView.kt +0 -511
  176. package/ios/LuggAppleMapView.h +0 -16
  177. package/ios/LuggAppleMapView.mm +0 -592
  178. package/ios/LuggGoogleMapView.h +0 -13
  179. package/ios/LuggGoogleMapView.mm +0 -455
  180. package/lib/module/fabric/LuggAppleMapViewNativeComponent.ts +0 -83
  181. package/lib/typescript/src/fabric/LuggAppleMapViewNativeComponent.d.ts +0 -54
  182. package/lib/typescript/src/fabric/LuggAppleMapViewNativeComponent.d.ts.map +0 -1
  183. package/lib/typescript/src/fabric/LuggGoogleMapViewNativeComponent.d.ts.map +0 -1
  184. package/src/fabric/LuggAppleMapViewNativeComponent.ts +0 -83
@@ -1,17 +1,27 @@
1
- import {
2
- Component,
3
- useCallback,
4
- useEffect,
5
- useMemo,
6
- useRef,
7
- useState,
8
- } from 'react';
9
- import { useMap } from '@vis.gl/react-google-maps';
10
- import type { PolylineProps } from './Polyline';
11
-
12
- const ANIMATION_DURATION = 1500;
13
-
14
- function interpolateColor(color1: string, color2: string, t: number): string {
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useMapContext } from '../MapProvider.web';
3
+ import type { PolylineProps, PolylineEasing } from './Polyline.types';
4
+
5
+ const DEFAULT_DURATION = 2150;
6
+
7
+ const applyEasing = (t: number, easing: PolylineEasing = 'linear'): number => {
8
+ switch (easing) {
9
+ case 'easeIn':
10
+ return t * t;
11
+ case 'easeOut':
12
+ return t * (2 - t);
13
+ case 'easeInOut':
14
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
15
+ default:
16
+ return t;
17
+ }
18
+ };
19
+
20
+ const interpolateColor = (
21
+ color1: string,
22
+ color2: string,
23
+ t: number
24
+ ): string => {
15
25
  const hex = (c: string) => parseInt(c, 16);
16
26
  const r1 = hex(color1.slice(1, 3));
17
27
  const g1 = hex(color1.slice(3, 5));
@@ -27,9 +37,9 @@ function interpolateColor(color1: string, color2: string, t: number): string {
27
37
  return `#${r.toString(16).padStart(2, '0')}${g
28
38
  .toString(16)
29
39
  .padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
30
- }
40
+ };
31
41
 
32
- function getGradientColor(colors: string[], position: number): string {
42
+ const getGradientColor = (colors: string[], position: number): string => {
33
43
  if (colors.length === 0) return '#000000';
34
44
  if (colors.length === 1 || position <= 0) return colors[0]!;
35
45
  if (position >= 1) return colors[colors.length - 1]!;
@@ -39,17 +49,39 @@ function getGradientColor(colors: string[], position: number): string {
39
49
  const t = scaledPos - index;
40
50
 
41
51
  return interpolateColor(colors[index]!, colors[index + 1]!, t);
42
- }
52
+ };
43
53
 
44
- function PolylineImpl({
54
+ export const Polyline = ({
45
55
  coordinates,
46
56
  strokeColors,
47
57
  strokeWidth = 1,
48
58
  animated,
49
- }: PolylineProps) {
50
- const map = useMap();
59
+ animatedOptions,
60
+ zIndex,
61
+ }: PolylineProps) => {
62
+ const resolvedZIndex = zIndex ?? (animated ? 1 : 0);
63
+ const { map, isDragging } = useMapContext();
64
+
65
+ const { duration, easing, trailLength, delay } = useMemo(
66
+ () => ({
67
+ duration: animatedOptions?.duration ?? DEFAULT_DURATION,
68
+ easing: animatedOptions?.easing ?? 'linear',
69
+ trailLength: Math.max(
70
+ 0.01,
71
+ Math.min(1, animatedOptions?.trailLength ?? 1)
72
+ ),
73
+ delay: animatedOptions?.delay ?? 0,
74
+ }),
75
+ [
76
+ animatedOptions?.duration,
77
+ animatedOptions?.easing,
78
+ animatedOptions?.trailLength,
79
+ animatedOptions?.delay,
80
+ ]
81
+ );
51
82
  const polylinesRef = useRef<google.maps.Polyline[]>([]);
52
83
  const animationRef = useRef<number>(0);
84
+ const isPausedRef = useRef(false);
53
85
 
54
86
  const colors = useMemo(
55
87
  () =>
@@ -62,13 +94,25 @@ function PolylineImpl({
62
94
  const hasGradient = colors.length > 1;
63
95
 
64
96
  // Refs for animation loop access
65
- const propsRef = useRef({ map, colors, strokeWidth, hasGradient });
97
+ const propsRef = useRef({
98
+ map,
99
+ colors,
100
+ strokeWidth,
101
+ hasGradient,
102
+ zIndex: resolvedZIndex,
103
+ });
66
104
  const [mapReady, setMapReady] = useState(!!map);
67
105
 
68
106
  useEffect(() => {
69
- propsRef.current = { map, colors, strokeWidth, hasGradient };
107
+ propsRef.current = {
108
+ map,
109
+ colors,
110
+ strokeWidth,
111
+ hasGradient,
112
+ zIndex: resolvedZIndex,
113
+ };
70
114
  if (map && !mapReady) setMapReady(true);
71
- }, [map, colors, strokeWidth, hasGradient, mapReady]);
115
+ }, [map, colors, strokeWidth, hasGradient, resolvedZIndex, mapReady]);
72
116
 
73
117
  const updatePath = useCallback((path: google.maps.LatLngLiteral[]) => {
74
118
  const {
@@ -76,11 +120,18 @@ function PolylineImpl({
76
120
  colors: currentColors,
77
121
  strokeWidth: currentStrokeWidth,
78
122
  hasGradient: currentHasGradient,
123
+ zIndex: currentZIndex,
79
124
  } = propsRef.current;
80
- if (!currentMap || path.length < 2) return;
125
+ const existing = polylinesRef.current;
126
+ if (!currentMap) return;
127
+
128
+ if (path.length < 2) {
129
+ existing.forEach((p) => p.setMap(null));
130
+ existing.length = 0;
131
+ return;
132
+ }
81
133
 
82
134
  const neededSegments = currentHasGradient ? path.length - 1 : 1;
83
- const existing = polylinesRef.current;
84
135
 
85
136
  // Update or create segments
86
137
  for (let i = 0; i < neededSegments; i++) {
@@ -100,6 +151,7 @@ function PolylineImpl({
100
151
  strokeColor: color,
101
152
  strokeWeight: currentStrokeWidth,
102
153
  strokeOpacity: 1,
154
+ zIndex: currentZIndex,
103
155
  map: currentMap,
104
156
  })
105
157
  );
@@ -122,6 +174,11 @@ function PolylineImpl({
122
174
  };
123
175
  }, []);
124
176
 
177
+ // Pause/resume animation during drag
178
+ useEffect(() => {
179
+ isPausedRef.current = isDragging;
180
+ }, [isDragging]);
181
+
125
182
  // Main effect
126
183
  useEffect(() => {
127
184
  if (!propsRef.current.map || coordinates.length === 0) return;
@@ -139,12 +196,65 @@ function PolylineImpl({
139
196
  }
140
197
 
141
198
  const totalPoints = fullPath.length;
142
- const cycleDuration = ANIMATION_DURATION * 2;
199
+ const useTrailMode = trailLength < 1;
200
+ const renderMax = useTrailMode ? 1 : 2;
201
+ const cycleMax = useTrailMode ? 1 : 2.15;
202
+
203
+ let startTime: number | null = null;
204
+ let delayRemaining = delay;
205
+
206
+ let pausedAt: number | null = null;
143
207
 
144
208
  const animate = (time: number) => {
145
- const progress = (time % cycleDuration) / ANIMATION_DURATION;
146
- const startIdx = progress <= 1 ? 0 : (progress - 1) * totalPoints;
147
- const endIdx = progress <= 1 ? progress * totalPoints : totalPoints;
209
+ if (isPausedRef.current) {
210
+ if (pausedAt === null) pausedAt = time;
211
+ animationRef.current = requestAnimationFrame(animate);
212
+ return;
213
+ }
214
+
215
+ if (pausedAt !== null) {
216
+ if (startTime !== null) {
217
+ startTime += time - pausedAt;
218
+ }
219
+ pausedAt = null;
220
+ }
221
+
222
+ if (startTime === null) {
223
+ startTime = time;
224
+ }
225
+
226
+ const elapsed = time - startTime;
227
+
228
+ if (delayRemaining > 0) {
229
+ if (elapsed < delayRemaining) {
230
+ animationRef.current = requestAnimationFrame(animate);
231
+ return;
232
+ }
233
+ startTime = time - (elapsed - delayRemaining);
234
+ delayRemaining = 0;
235
+ }
236
+
237
+ const rawProgress = (time - startTime) / duration;
238
+
239
+ if (rawProgress >= cycleMax) {
240
+ delayRemaining = delay;
241
+ startTime = time;
242
+ }
243
+
244
+ const clampedProgress = Math.min(rawProgress, renderMax);
245
+ const easedProgress =
246
+ applyEasing(clampedProgress / renderMax, easing) * renderMax;
247
+
248
+ let startIdx: number;
249
+ let endIdx: number;
250
+
251
+ if (useTrailMode) {
252
+ endIdx = easedProgress * totalPoints;
253
+ startIdx = Math.max(0, endIdx - trailLength * totalPoints);
254
+ } else {
255
+ startIdx = easedProgress <= 1 ? 0 : (easedProgress - 1) * totalPoints;
256
+ endIdx = easedProgress <= 1 ? easedProgress * totalPoints : totalPoints;
257
+ }
148
258
 
149
259
  const partialPath: google.maps.LatLngLiteral[] = [];
150
260
  const startFloor = Math.floor(startIdx);
@@ -194,13 +304,17 @@ function PolylineImpl({
194
304
  animationRef.current = requestAnimationFrame(animate);
195
305
 
196
306
  return () => cancelAnimationFrame(animationRef.current);
197
- }, [coordinates, animated, hasGradient, updatePath, mapReady]);
307
+ }, [
308
+ coordinates,
309
+ animated,
310
+ duration,
311
+ easing,
312
+ trailLength,
313
+ delay,
314
+ hasGradient,
315
+ updatePath,
316
+ mapReady,
317
+ ]);
198
318
 
199
319
  return null;
200
- }
201
-
202
- export class Polyline extends Component<PolylineProps> {
203
- render() {
204
- return <PolylineImpl {...this.props} />;
205
- }
206
- }
320
+ };
@@ -1,2 +1,17 @@
1
- export * from './Marker';
2
- export * from './Polyline';
1
+ export { Marker } from './Marker';
2
+ export type {
3
+ CalloutOptions,
4
+ MarkerProps,
5
+ MarkerPressEvent,
6
+ MarkerDragEvent,
7
+ } from './Marker.types';
8
+ export { Polygon } from './Polygon';
9
+ export type { PolygonProps } from './Polygon.types';
10
+ export { Polyline } from './Polyline';
11
+ export type {
12
+ PolylineProps,
13
+ PolylineEasing,
14
+ PolylineAnimatedOptions,
15
+ } from './Polyline.types';
16
+ export { GeoJson } from './GeoJson';
17
+ export type { GeoJsonProps } from './GeoJson.types';
@@ -1,4 +1,8 @@
1
1
  export { Marker } from './Marker.web';
2
+ export { Polygon } from './Polygon.web';
2
3
  export { Polyline } from './Polyline.web';
3
- export type { MarkerProps } from './Marker';
4
- export type { PolylineProps } from './Polyline';
4
+ export type { CalloutOptions, MarkerProps } from './Marker.types';
5
+ export type { PolygonProps } from './Polygon.types';
6
+ export type { PolylineProps } from './Polyline.types';
7
+ export { GeoJson } from './GeoJson';
8
+ export type { GeoJsonProps } from './GeoJson.types';
@@ -0,0 +1,20 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+ import type { ViewProps, HostComponent } from 'react-native';
3
+ import type {
4
+ Double,
5
+ WithDefault,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
7
+
8
+ export interface Point {
9
+ x: Double;
10
+ y: Double;
11
+ }
12
+
13
+ export interface NativeProps extends ViewProps {
14
+ bubbled?: WithDefault<boolean, true>;
15
+ anchor?: Point;
16
+ }
17
+
18
+ export default codegenNativeComponent<NativeProps>(
19
+ 'LuggCalloutView'
20
+ ) as HostComponent<NativeProps>;
@@ -2,6 +2,7 @@ import { codegenNativeComponent, codegenNativeCommands } from 'react-native';
2
2
  import type { ViewProps, HostComponent } from 'react-native';
3
3
  import type {
4
4
  Double,
5
+ WithDefault,
5
6
  DirectEventHandler,
6
7
  } from 'react-native/Libraries/Types/CodegenTypes';
7
8
 
@@ -35,9 +36,32 @@ export interface CameraIdleEvent {
35
36
  gesture: boolean;
36
37
  }
37
38
 
39
+ export interface PressEvent {
40
+ coordinate: {
41
+ latitude: Double;
42
+ longitude: Double;
43
+ };
44
+ point: {
45
+ x: Double;
46
+ y: Double;
47
+ };
48
+ }
49
+
50
+ export interface LongPressEvent {
51
+ coordinate: {
52
+ latitude: Double;
53
+ longitude: Double;
54
+ };
55
+ point: {
56
+ x: Double;
57
+ y: Double;
58
+ };
59
+ }
60
+
38
61
  export interface ReadyEvent {}
39
62
 
40
63
  export interface NativeProps extends ViewProps {
64
+ provider?: WithDefault<'google' | 'apple', 'google'>;
41
65
  mapId?: string;
42
66
  initialCoordinate?: Coordinate;
43
67
  initialZoom?: Double;
@@ -47,8 +71,12 @@ export interface NativeProps extends ViewProps {
47
71
  scrollEnabled?: boolean;
48
72
  rotateEnabled?: boolean;
49
73
  pitchEnabled?: boolean;
50
- padding?: EdgeInsets;
74
+ edgeInsets?: EdgeInsets;
51
75
  userLocationEnabled?: boolean;
76
+ userLocationButtonEnabled?: boolean;
77
+ theme?: WithDefault<'light' | 'dark' | 'system', 'system'>;
78
+ onMapPress?: DirectEventHandler<PressEvent>;
79
+ onMapLongPress?: DirectEventHandler<LongPressEvent>;
52
80
  onCameraMove?: DirectEventHandler<CameraMoveEvent>;
53
81
  onCameraIdle?: DirectEventHandler<CameraIdleEvent>;
54
82
  onReady?: DirectEventHandler<ReadyEvent>;
@@ -67,18 +95,26 @@ interface NativeCommands {
67
95
  fitCoordinates: (
68
96
  viewRef: React.ElementRef<ComponentType>,
69
97
  coordinates: Coordinate[],
70
- paddingTop: Double,
71
- paddingLeft: Double,
72
- paddingBottom: Double,
73
- paddingRight: Double,
98
+ edgeInsetsTop: Double,
99
+ edgeInsetsLeft: Double,
100
+ edgeInsetsBottom: Double,
101
+ edgeInsetsRight: Double,
102
+ duration: Double
103
+ ) => void;
104
+ setEdgeInsets: (
105
+ viewRef: React.ElementRef<ComponentType>,
106
+ top: Double,
107
+ left: Double,
108
+ bottom: Double,
109
+ right: Double,
74
110
  duration: Double
75
111
  ) => void;
76
112
  }
77
113
 
78
114
  export const Commands = codegenNativeCommands<NativeCommands>({
79
- supportedCommands: ['moveCamera', 'fitCoordinates'],
115
+ supportedCommands: ['moveCamera', 'fitCoordinates', 'setEdgeInsets'],
80
116
  });
81
117
 
82
118
  export default codegenNativeComponent<NativeProps>(
83
- 'LuggGoogleMapView'
119
+ 'LuggMapView'
84
120
  ) as ComponentType;
@@ -1,6 +1,10 @@
1
1
  import { codegenNativeComponent } from 'react-native';
2
2
  import type { ViewProps, HostComponent } from 'react-native';
3
- import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type {
4
+ Double,
5
+ WithDefault,
6
+ DirectEventHandler,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
4
8
 
5
9
  export interface Coordinate {
6
10
  latitude: Double;
@@ -18,6 +22,50 @@ export interface NativeProps extends ViewProps {
18
22
  title?: string;
19
23
  description?: string;
20
24
  anchor?: Point;
25
+ rotate?: WithDefault<Double, 0>;
26
+ scale?: WithDefault<Double, 1>;
27
+ rasterize?: WithDefault<boolean, true>;
28
+ draggable?: WithDefault<boolean, false>;
29
+ onMarkerPress?: DirectEventHandler<{
30
+ coordinate: {
31
+ latitude: Double;
32
+ longitude: Double;
33
+ };
34
+ point: {
35
+ x: Double;
36
+ y: Double;
37
+ };
38
+ }>;
39
+ onMarkerDragStart?: DirectEventHandler<{
40
+ coordinate: {
41
+ latitude: Double;
42
+ longitude: Double;
43
+ };
44
+ point: {
45
+ x: Double;
46
+ y: Double;
47
+ };
48
+ }>;
49
+ onMarkerDragChange?: DirectEventHandler<{
50
+ coordinate: {
51
+ latitude: Double;
52
+ longitude: Double;
53
+ };
54
+ point: {
55
+ x: Double;
56
+ y: Double;
57
+ };
58
+ }>;
59
+ onMarkerDragEnd?: DirectEventHandler<{
60
+ coordinate: {
61
+ latitude: Double;
62
+ longitude: Double;
63
+ };
64
+ point: {
65
+ x: Double;
66
+ y: Double;
67
+ };
68
+ }>;
21
69
  }
22
70
 
23
71
  export default codegenNativeComponent<NativeProps>(
@@ -0,0 +1,25 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+ import type { ViewProps, HostComponent, ColorValue } from 'react-native';
3
+ import type {
4
+ Double,
5
+ DirectEventHandler,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
7
+
8
+ export interface Coordinate {
9
+ latitude: Double;
10
+ longitude: Double;
11
+ }
12
+
13
+ export interface NativeProps extends ViewProps {
14
+ coordinates: ReadonlyArray<Coordinate>;
15
+ holes?: ReadonlyArray<ReadonlyArray<Coordinate>>;
16
+ strokeColor?: ColorValue;
17
+ strokeWidth?: Double;
18
+ fillColor?: ColorValue;
19
+ tappable?: boolean;
20
+ onPolygonPress?: DirectEventHandler<null>;
21
+ }
22
+
23
+ export default codegenNativeComponent<NativeProps>(
24
+ 'LuggPolygonView'
25
+ ) as HostComponent<NativeProps>;
@@ -7,11 +7,19 @@ export interface Coordinate {
7
7
  longitude: Double;
8
8
  }
9
9
 
10
+ export interface AnimatedOptions {
11
+ duration?: Double;
12
+ easing?: string;
13
+ trailLength?: Double;
14
+ delay?: Double;
15
+ }
16
+
10
17
  export interface NativeProps extends ViewProps {
11
18
  coordinates: ReadonlyArray<Coordinate>;
12
19
  strokeColors?: ReadonlyArray<ColorValue>;
13
20
  strokeWidth?: Double;
14
21
  animated?: boolean;
22
+ animatedOptions?: AnimatedOptions;
15
23
  }
16
24
 
17
25
  export default codegenNativeComponent<NativeProps>(
package/src/index.ts CHANGED
@@ -1,17 +1,46 @@
1
1
  export { MapView } from './MapView';
2
2
  export { MapProvider } from './MapProvider';
3
3
  export type { MapProviderProps } from './MapProvider.types';
4
- export * from './components';
4
+ export { Marker } from './components';
5
+ export type {
6
+ CalloutOptions,
7
+ MarkerProps,
8
+ MarkerPressEvent,
9
+ MarkerDragEvent,
10
+ } from './components';
11
+ export { Polygon } from './components';
12
+ export type { PolygonProps } from './components';
13
+ export { Polyline } from './components';
14
+ export type {
15
+ PolylineProps,
16
+ PolylineEasing,
17
+ PolylineAnimatedOptions,
18
+ } from './components';
19
+ export { GeoJson } from './components';
20
+ export type { GeoJsonProps } from './components';
5
21
  export type {
6
22
  MapViewProps,
7
23
  MapViewRef,
8
24
  MoveCameraOptions,
9
25
  FitCoordinatesOptions,
26
+ SetEdgeInsetsOptions,
10
27
  CameraEventPayload,
28
+ MapCameraEvent,
29
+ MapPressEvent,
11
30
  } from './MapView.types';
12
31
  export type {
13
32
  MapProvider as MapProviderType,
33
+ MapTheme,
14
34
  Coordinate,
15
35
  Point,
16
36
  EdgeInsets,
37
+ PressEventPayload,
17
38
  } from './types';
39
+ export type {
40
+ GeoJSON,
41
+ Feature,
42
+ FeatureCollection,
43
+ FeatureProperties,
44
+ Geometry,
45
+ Position,
46
+ } from './components/GeoJson.types';
package/src/index.web.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  export { MapView } from './MapView.web';
2
2
  export { MapProvider } from './MapProvider.web';
3
3
  export type { MapProviderProps } from './MapProvider.types';
4
- export * from './components/index.web';
4
+ export { Marker } from './components/index.web';
5
+ export type { CalloutOptions, MarkerProps } from './components/index.web';
6
+ export { Polygon } from './components/index.web';
7
+ export type { PolygonProps } from './components/index.web';
8
+ export { Polyline } from './components/index.web';
9
+ export type { PolylineProps } from './components/index.web';
10
+ export { GeoJson } from './components/index.web';
11
+ export type { GeoJsonProps } from './components/index.web';
5
12
  export type {
6
13
  MapViewProps,
7
14
  MapViewRef,
@@ -15,3 +22,11 @@ export type {
15
22
  Point,
16
23
  EdgeInsets,
17
24
  } from './types';
25
+ export type {
26
+ GeoJSON,
27
+ Feature,
28
+ FeatureCollection,
29
+ FeatureProperties,
30
+ Geometry,
31
+ Position,
32
+ } from './components/GeoJson.types';
package/src/types.ts CHANGED
@@ -28,3 +28,16 @@ export interface EdgeInsets {
28
28
  bottom: number;
29
29
  right: number;
30
30
  }
31
+
32
+ /**
33
+ * Map theme
34
+ */
35
+ export type MapTheme = 'light' | 'dark' | 'system';
36
+
37
+ /**
38
+ * Press event payload
39
+ */
40
+ export interface PressEventPayload {
41
+ coordinate: Coordinate;
42
+ point: Point;
43
+ }