@maydon_tech/react-native-nitro-maps 0.1.4 → 0.2.0

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 (217) hide show
  1. package/LICENSE +1 -1
  2. package/NitroMap.podspec +1 -1
  3. package/README.md +82 -9
  4. package/android/CMakeLists.txt +4 -1
  5. package/android/gradle.properties +4 -4
  6. package/android/src/main/cpp/ClusterEngineJNI.cpp +198 -0
  7. package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMap.kt +397 -0
  8. package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMapConfig.kt +53 -0
  9. package/android/src/main/{java → kotlin}/com/margelo/nitro/nitromap/NitroMapPackage.kt +4 -4
  10. package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMapView.kt +73 -0
  11. package/android/src/main/kotlin/com/margelo/nitro/nitromap/UserLocationManager.kt +295 -0
  12. package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/ClusterIconRenderer.kt +111 -0
  13. package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/ClusteringManager.kt +104 -0
  14. package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/NitroClusterEngine.kt +166 -0
  15. package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/MarkerIconFactory.kt +303 -0
  16. package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/MarkerSelectionHandler.kt +72 -0
  17. package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/PriceMarkerRenderer.kt +159 -0
  18. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/MapProviderFactory.kt +24 -0
  19. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/MapProviderInterface.kt +128 -0
  20. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapDelegate.kt +317 -0
  21. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Clustering.kt +524 -0
  22. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Markers.kt +358 -0
  23. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Overlays.kt +272 -0
  24. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+UserLocation.kt +296 -0
  25. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider.kt +815 -0
  26. package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/MarkerTagData.kt +19 -0
  27. package/ios/Location/NitroLocationManager.swift +116 -0
  28. package/ios/MarkerRenderer/MarkerIconFactory.swift +1 -3
  29. package/ios/MarkerRenderer/PriceMarkerRenderer.swift +10 -6
  30. package/ios/NitroMap.swift +279 -13
  31. package/ios/NitroMapConfig/NitroMapConfig.swift +45 -0
  32. package/ios/Providers/{GoogleMapDelegate.swift → Google/GoogleMapDelegate.swift} +48 -23
  33. package/ios/Providers/Google/GoogleMapProvider+Camera.swift +180 -0
  34. package/ios/Providers/Google/GoogleMapProvider+Clustering.swift +541 -0
  35. package/ios/Providers/Google/GoogleMapProvider+Markers.swift +270 -0
  36. package/ios/Providers/Google/GoogleMapProvider+Overlays.swift +245 -0
  37. package/ios/Providers/Google/GoogleMapProvider+UserLocation.swift +180 -0
  38. package/ios/Providers/Google/GoogleMapProvider.swift +342 -0
  39. package/ios/Providers/MapProviderFactory.swift +17 -0
  40. package/ios/Providers/MapProviderProtocol.swift +48 -1
  41. package/ios/Shared/ClusterConfig+Factory.swift +2 -2
  42. package/ios/Shared/MapStyleProvider.swift +6 -4
  43. package/ios/Shared/MarkerSelectionHandler.swift +4 -1
  44. package/ios/Utils/ColorValueExtension.swift +46 -67
  45. package/lib/module/components/ImageMarker.js +39 -29
  46. package/lib/module/components/ImageMarker.js.map +1 -1
  47. package/lib/module/components/Marker.js +118 -0
  48. package/lib/module/components/Marker.js.map +1 -0
  49. package/lib/module/components/NitroCircle.js +92 -0
  50. package/lib/module/components/NitroCircle.js.map +1 -0
  51. package/lib/module/components/NitroMap.js +216 -76
  52. package/lib/module/components/NitroMap.js.map +1 -1
  53. package/lib/module/components/NitroPolygon.js +135 -0
  54. package/lib/module/components/NitroPolygon.js.map +1 -0
  55. package/lib/module/components/NitroPolyline.js +115 -0
  56. package/lib/module/components/NitroPolyline.js.map +1 -0
  57. package/lib/module/components/PriceMarker.js +16 -29
  58. package/lib/module/components/PriceMarker.js.map +1 -1
  59. package/lib/module/context/NitroMapContext.js.map +1 -1
  60. package/lib/module/hooks/useNitroCircle.js +18 -0
  61. package/lib/module/hooks/useNitroCircle.js.map +1 -0
  62. package/lib/module/hooks/useNitroMarker.js +26 -9
  63. package/lib/module/hooks/useNitroMarker.js.map +1 -1
  64. package/lib/module/hooks/useNitroOverlay.js +59 -0
  65. package/lib/module/hooks/useNitroOverlay.js.map +1 -0
  66. package/lib/module/hooks/useNitroPolygon.js +18 -0
  67. package/lib/module/hooks/useNitroPolygon.js.map +1 -0
  68. package/lib/module/hooks/useNitroPolyline.js +18 -0
  69. package/lib/module/hooks/useNitroPolyline.js.map +1 -0
  70. package/lib/module/index.js +5 -0
  71. package/lib/module/index.js.map +1 -1
  72. package/lib/module/types/overlay.js +4 -0
  73. package/lib/module/types/overlay.js.map +1 -0
  74. package/lib/module/types/theme.js +4 -0
  75. package/lib/module/types/theme.js.map +1 -0
  76. package/lib/module/utils/colors.js +41 -13
  77. package/lib/module/utils/colors.js.map +1 -1
  78. package/lib/module/utils/validation.js +45 -0
  79. package/lib/module/utils/validation.js.map +1 -0
  80. package/lib/typescript/src/components/ImageMarker.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Marker.d.ts +34 -0
  82. package/lib/typescript/src/components/Marker.d.ts.map +1 -0
  83. package/lib/typescript/src/components/NitroCircle.d.ts +70 -0
  84. package/lib/typescript/src/components/NitroCircle.d.ts.map +1 -0
  85. package/lib/typescript/src/components/NitroMap.d.ts +60 -3
  86. package/lib/typescript/src/components/NitroMap.d.ts.map +1 -1
  87. package/lib/typescript/src/components/NitroPolygon.d.ts +86 -0
  88. package/lib/typescript/src/components/NitroPolygon.d.ts.map +1 -0
  89. package/lib/typescript/src/components/NitroPolyline.d.ts +84 -0
  90. package/lib/typescript/src/components/NitroPolyline.d.ts.map +1 -0
  91. package/lib/typescript/src/components/PriceMarker.d.ts +0 -5
  92. package/lib/typescript/src/components/PriceMarker.d.ts.map +1 -1
  93. package/lib/typescript/src/context/NitroMapContext.d.ts +2 -0
  94. package/lib/typescript/src/context/NitroMapContext.d.ts.map +1 -1
  95. package/lib/typescript/src/hooks/useNitroCircle.d.ts +7 -0
  96. package/lib/typescript/src/hooks/useNitroCircle.d.ts.map +1 -0
  97. package/lib/typescript/src/hooks/useNitroMarker.d.ts +20 -0
  98. package/lib/typescript/src/hooks/useNitroMarker.d.ts.map +1 -1
  99. package/lib/typescript/src/hooks/useNitroOverlay.d.ts +26 -0
  100. package/lib/typescript/src/hooks/useNitroOverlay.d.ts.map +1 -0
  101. package/lib/typescript/src/hooks/useNitroPolygon.d.ts +7 -0
  102. package/lib/typescript/src/hooks/useNitroPolygon.d.ts.map +1 -0
  103. package/lib/typescript/src/hooks/useNitroPolyline.d.ts +7 -0
  104. package/lib/typescript/src/hooks/useNitroPolyline.d.ts.map +1 -0
  105. package/lib/typescript/src/index.d.ts +15 -2
  106. package/lib/typescript/src/index.d.ts.map +1 -1
  107. package/lib/typescript/src/specs/NitroMap.nitro.d.ts +248 -6
  108. package/lib/typescript/src/specs/NitroMap.nitro.d.ts.map +1 -1
  109. package/lib/typescript/src/types/map.d.ts +34 -4
  110. package/lib/typescript/src/types/map.d.ts.map +1 -1
  111. package/lib/typescript/src/types/marker.d.ts +24 -36
  112. package/lib/typescript/src/types/marker.d.ts.map +1 -1
  113. package/lib/typescript/src/types/overlay.d.ts +75 -0
  114. package/lib/typescript/src/types/overlay.d.ts.map +1 -0
  115. package/lib/typescript/src/types/theme.d.ts +93 -0
  116. package/lib/typescript/src/types/theme.d.ts.map +1 -0
  117. package/lib/typescript/src/utils/colors.d.ts +6 -8
  118. package/lib/typescript/src/utils/colors.d.ts.map +1 -1
  119. package/lib/typescript/src/utils/validation.d.ts +12 -0
  120. package/lib/typescript/src/utils/validation.d.ts.map +1 -0
  121. package/nitrogen/generated/android/c++/JCircleData.hpp +94 -0
  122. package/nitrogen/generated/android/c++/JClusterConfig.hpp +5 -7
  123. package/nitrogen/generated/android/c++/JFunc_void_UserLocationChangeEvent.hpp +79 -0
  124. package/nitrogen/generated/android/c++/JFunc_void_UserTrackingMode.hpp +77 -0
  125. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  126. package/nitrogen/generated/android/c++/JHybridNitroMapSpec.cpp +328 -21
  127. package/nitrogen/generated/android/c++/JHybridNitroMapSpec.hpp +53 -2
  128. package/nitrogen/generated/android/c++/JMarkerAnimation.hpp +3 -6
  129. package/nitrogen/generated/android/c++/JMarkerData.hpp +15 -3
  130. package/nitrogen/generated/android/c++/JPolygonData.hpp +149 -0
  131. package/nitrogen/generated/android/c++/JPolylineData.hpp +113 -0
  132. package/nitrogen/generated/android/c++/JUserLocationChangeEvent.hpp +70 -0
  133. package/nitrogen/generated/android/c++/JUserTrackingMode.hpp +62 -0
  134. package/nitrogen/generated/android/c++/views/JHybridNitroMapStateUpdater.cpp +72 -4
  135. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/CircleData.kt +62 -0
  136. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterConfig.kt +4 -4
  137. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_UserLocationChangeEvent.kt +80 -0
  138. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_UserTrackingMode.kt +80 -0
  139. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_std__string.kt +80 -0
  140. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/HybridNitroMapSpec.kt +228 -2
  141. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerAnimation.kt +1 -2
  142. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerData.kt +12 -3
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PolygonData.kt +62 -0
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PolylineData.kt +62 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/UserLocationChangeEvent.kt +47 -0
  146. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/{ClusterAnimationStyle.kt → UserTrackingMode.kt} +6 -8
  147. package/nitrogen/generated/android/nitromapOnLoad.cpp +6 -0
  148. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.cpp +24 -0
  149. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.hpp +175 -17
  150. package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Umbrella.hpp +15 -3
  151. package/nitrogen/generated/ios/c++/HybridNitroMapSpecSwift.hpp +249 -16
  152. package/nitrogen/generated/ios/c++/views/HybridNitroMapComponent.mm +90 -5
  153. package/nitrogen/generated/ios/swift/CircleData.swift +143 -0
  154. package/nitrogen/generated/ios/swift/ClusterConfig.swift +22 -15
  155. package/nitrogen/generated/ios/swift/Func_void_UserLocationChangeEvent.swift +47 -0
  156. package/nitrogen/generated/ios/swift/Func_void_UserTrackingMode.swift +47 -0
  157. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  158. package/nitrogen/generated/ios/swift/HybridNitroMapSpec.swift +35 -1
  159. package/nitrogen/generated/ios/swift/HybridNitroMapSpec_cxx.swift +582 -8
  160. package/nitrogen/generated/ios/swift/MarkerAnimation.swift +4 -8
  161. package/nitrogen/generated/ios/swift/MarkerData.swift +54 -2
  162. package/nitrogen/generated/ios/swift/PolygonData.swift +179 -0
  163. package/nitrogen/generated/ios/swift/PolylineData.swift +155 -0
  164. package/nitrogen/generated/ios/swift/UserLocationChangeEvent.swift +69 -0
  165. package/nitrogen/generated/ios/swift/UserTrackingMode.swift +44 -0
  166. package/nitrogen/generated/shared/c++/CircleData.hpp +113 -0
  167. package/nitrogen/generated/shared/c++/ClusterConfig.hpp +5 -8
  168. package/nitrogen/generated/shared/c++/HybridNitroMapSpec.cpp +53 -2
  169. package/nitrogen/generated/shared/c++/HybridNitroMapSpec.hpp +75 -6
  170. package/nitrogen/generated/shared/c++/MarkerAnimation.hpp +4 -8
  171. package/nitrogen/generated/shared/c++/MarkerData.hpp +14 -2
  172. package/nitrogen/generated/shared/c++/PolygonData.hpp +114 -0
  173. package/nitrogen/generated/shared/c++/PolylineData.hpp +114 -0
  174. package/nitrogen/generated/shared/c++/UserLocationChangeEvent.hpp +88 -0
  175. package/nitrogen/generated/shared/c++/UserTrackingMode.hpp +80 -0
  176. package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.cpp +216 -12
  177. package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.hpp +23 -1
  178. package/nitrogen/generated/shared/json/NitroMapConfig.json +18 -1
  179. package/package.json +36 -5
  180. package/src/components/ImageMarker.tsx +58 -42
  181. package/src/components/Marker.tsx +161 -0
  182. package/src/components/NitroCircle.tsx +183 -0
  183. package/src/components/NitroMap.tsx +328 -78
  184. package/src/components/NitroPolygon.tsx +229 -0
  185. package/src/components/NitroPolyline.tsx +208 -0
  186. package/src/components/PriceMarker.tsx +23 -48
  187. package/src/context/NitroMapContext.tsx +4 -0
  188. package/src/hooks/useNitroCircle.ts +25 -0
  189. package/src/hooks/useNitroMarker.ts +49 -10
  190. package/src/hooks/useNitroOverlay.ts +68 -0
  191. package/src/hooks/useNitroPolygon.ts +25 -0
  192. package/src/hooks/useNitroPolyline.ts +25 -0
  193. package/src/index.tsx +23 -2
  194. package/src/specs/NitroMap.nitro.ts +294 -5
  195. package/src/types/map.ts +36 -4
  196. package/src/types/marker.ts +24 -44
  197. package/src/types/overlay.ts +77 -0
  198. package/src/types/theme.ts +101 -0
  199. package/src/utils/colors.ts +48 -16
  200. package/src/utils/validation.ts +69 -0
  201. package/android/src/main/java/com/margelo/nitro/nitromap/ClusterIconGenerator.kt +0 -108
  202. package/android/src/main/java/com/margelo/nitro/nitromap/ColorUtils.kt +0 -63
  203. package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMap.kt +0 -408
  204. package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMapConfig.kt +0 -68
  205. package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconCache.kt +0 -176
  206. package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconFactory.kt +0 -252
  207. package/android/src/main/java/com/margelo/nitro/nitromap/clustering/NitroClusterEngine.kt +0 -252
  208. package/android/src/main/java/com/margelo/nitro/nitromap/clustering/QuadTree.kt +0 -195
  209. package/android/src/main/java/com/margelo/nitro/nitromap/providers/GoogleMapProvider.kt +0 -912
  210. package/android/src/main/java/com/margelo/nitro/nitromap/providers/MapProviderInterface.kt +0 -70
  211. package/cpp/QuadTree.hpp +0 -246
  212. package/ios/NitroMapConfig/HybridNitroMapConfig.swift +0 -33
  213. package/ios/Providers/GoogleMapProvider+Camera.swift +0 -164
  214. package/ios/Providers/GoogleMapProvider.swift +0 -924
  215. package/nitrogen/generated/android/c++/JClusterAnimationStyle.hpp +0 -68
  216. package/nitrogen/generated/ios/swift/ClusterAnimationStyle.swift +0 -52
  217. package/nitrogen/generated/shared/c++/ClusterAnimationStyle.hpp +0 -88
@@ -13,8 +13,11 @@ import type {
13
13
  MapProvider,
14
14
  MapStyle,
15
15
  MapType,
16
+ Point,
16
17
  Region,
17
18
  RegionChangeEvent,
19
+ UserLocationChangeEvent,
20
+ UserTrackingMode,
18
21
  } from '../types/map';
19
22
  import type {
20
23
  ClusterConfig,
@@ -23,6 +26,7 @@ import type {
23
26
  MarkerDragEvent,
24
27
  MarkerPressEvent,
25
28
  } from '../types/marker';
29
+ import type { PolylineData, PolygonData, CircleData } from '../types/overlay';
26
30
 
27
31
  /**
28
32
  * Props for the NitroMap component
@@ -49,6 +53,24 @@ export interface NitroMapProps extends HybridViewProps {
49
53
  */
50
54
  initialRegion?: Region;
51
55
 
56
+ /**
57
+ * Controlled region prop — moves the camera whenever the value changes.
58
+ *
59
+ * Unlike `initialRegion` (set once on mount) or the imperative
60
+ * `animateToRegion()` (called via ref), this is **declarative**:
61
+ * updating the state that feeds this prop re-renders and moves the camera.
62
+ *
63
+ * Pass `undefined` to stop controlling the region.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * const [region, setRegion] = useState<Region>();
68
+ * <NitroMap region={region} />
69
+ * <Button onPress={() => setRegion({ latitude: 40.7, longitude: -74, latitudeDelta: 0.05, longitudeDelta: 0.05 })} />
70
+ * ```
71
+ */
72
+ region?: Region;
73
+
52
74
  /**
53
75
  * Show the user's current location on the map
54
76
  * Requires location permissions
@@ -90,21 +112,58 @@ export interface NitroMapProps extends HybridViewProps {
90
112
  mapType?: MapType;
91
113
 
92
114
  /**
93
- * Custom JSON styling for the map
115
+ * Custom JSON styling for the map.
116
+ * Currently uses Google Maps JSON format. Future providers (Apple, Yandex)
117
+ * will need provider-specific styling approaches.
94
118
  * @see https://mapstyle.withgoogle.com/
95
119
  */
96
120
  customMapStyle?: MapStyle;
97
121
 
98
122
  /**
99
- * Show the "my location" button on the map
123
+ * Configuration for marker clustering behavior
124
+ */
125
+ clusterConfig?: ClusterConfig;
126
+
127
+ /**
128
+ * Padding around the map edges to offset the map center and controls.
129
+ * Use when UI elements (navigation bars, bottom sheets) cover parts of the map.
130
+ * Values are in pixels (React Native logical pixels).
131
+ */
132
+ mapPadding: EdgePadding;
133
+
134
+ /**
135
+ * Show real-time traffic conditions overlay on the map.
136
+ * Displays colored road segments indicating traffic flow.
137
+ * @default false
138
+ */
139
+ showsTraffic?: boolean;
140
+
141
+ /**
142
+ * Show 3D building models on the map when zoomed in.
100
143
  * @default true
101
144
  */
102
- showsMyLocationButton?: boolean;
145
+ showsBuildings?: boolean;
103
146
 
104
147
  /**
105
- * Configuration for marker clustering behavior
148
+ * Show the compass indicator on the map.
149
+ * The compass appears when the map is rotated away from north.
150
+ * @default true
106
151
  */
107
- clusterConfig?: ClusterConfig;
152
+ showsCompass?: boolean;
153
+
154
+ /**
155
+ * Minimum zoom level the user can zoom out to.
156
+ * Google Maps range: 1 (world) to 22 (building).
157
+ * @default 1
158
+ */
159
+ minZoom: number;
160
+
161
+ /**
162
+ * Maximum zoom level the user can zoom in to.
163
+ * Google Maps range: 1 (world) to 22 (building).
164
+ * @default 22
165
+ */
166
+ maxZoom: number;
108
167
 
109
168
  /**
110
169
  * Enable dark mode styling for the map
@@ -112,6 +171,41 @@ export interface NitroMapProps extends HybridViewProps {
112
171
  */
113
172
  darkMode?: boolean;
114
173
 
174
+ /**
175
+ * User tracking mode for automatic camera following.
176
+ * - `'none'` - No tracking (default)
177
+ * - `'follow'` - Camera follows the user's position
178
+ * - `'followWithHeading'` - Camera follows and rotates with heading
179
+ * Requires `showsUserLocation={true}`.
180
+ * @default 'none'
181
+ */
182
+ userTrackingMode?: UserTrackingMode;
183
+
184
+ /**
185
+ * Custom image URL for the user location marker.
186
+ * When set to a non-empty string, replaces the default blue dot with a custom marker.
187
+ * Supports remote URLs (https://) and local asset names.
188
+ * Set to `''` (empty string) to use the default blue dot.
189
+ * Requires `showsUserLocation={true}`.
190
+ * @default ''
191
+ */
192
+ userLocationImage: string;
193
+
194
+ /**
195
+ * Size of the custom user location marker in points.
196
+ * Only applies when `userLocationImage` is set.
197
+ * @default 40
198
+ */
199
+ userLocationSize: number;
200
+
201
+ /**
202
+ * Anchor point for the custom user location marker.
203
+ * Values are in 0-1 range: {x: 0, y: 0} = top-left, {x: 0.5, y: 0.5} = center.
204
+ * Only applies when `userLocationImage` is set.
205
+ * @default { x: 0.5, y: 0.5 }
206
+ */
207
+ userLocationAnchor?: Point;
208
+
115
209
  /**
116
210
  * Called when the user taps on the map (not on a marker)
117
211
  * @param event - Contains the coordinate and screen position of the tap
@@ -173,11 +267,84 @@ export interface NitroMapProps extends HybridViewProps {
173
267
  */
174
268
  onClusterPress?: (event: ClusterPressEvent) => void;
175
269
 
270
+ /**
271
+ * Called when a tappable polyline is tapped.
272
+ * Requires `tappable={true}` on the `<NitroPolyline>`.
273
+ * @param id - The polyline ID
274
+ */
275
+ onPolylinePress?: (id: string) => void;
276
+
277
+ /**
278
+ * Called when a tappable polygon is tapped.
279
+ * Requires `tappable={true}` on the `<NitroPolygon>`.
280
+ * @param id - The polygon ID
281
+ */
282
+ onPolygonPress?: (id: string) => void;
283
+
284
+ /**
285
+ * Called when a tappable circle is tapped.
286
+ * Requires `tappable={true}` on the `<NitroCircle>`.
287
+ * @param id - The circle ID
288
+ */
289
+ onCirclePress?: (id: string) => void;
290
+
176
291
  /**
177
292
  * Called when an error occurs in the map or marker operations
178
293
  * @param error - Error information with code and message
179
294
  */
180
295
  onError?: (error: MapError) => void;
296
+
297
+ /**
298
+ * Called when the user's location changes.
299
+ * Requires `showsUserLocation={true}`.
300
+ * @param event - Contains coordinate, accuracy, and heading
301
+ */
302
+ onUserLocationChange?: (event: UserLocationChangeEvent) => void;
303
+
304
+ /**
305
+ * Called when the library changes the tracking mode internally.
306
+ * For example, when the user pans the map during follow/heading mode,
307
+ * tracking is automatically disabled. Update your state accordingly:
308
+ *
309
+ * @example
310
+ * ```tsx
311
+ * onUserTrackingModeChange={(mode) => setTrackingMode(mode)}
312
+ * ```
313
+ */
314
+ onUserTrackingModeChange?: (mode: UserTrackingMode) => void;
315
+
316
+ /**
317
+ * Called when location services fail (e.g. permission denied, location unavailable).
318
+ * Requires `showsUserLocation={true}`.
319
+ *
320
+ * @example
321
+ * ```tsx
322
+ * onUserLocationError={(error) => {
323
+ * if (error.code === 'LOCATION_PERMISSION_DENIED') {
324
+ * showPermissionDialog();
325
+ * }
326
+ * }}
327
+ * ```
328
+ */
329
+ onUserLocationError?: (error: MapError) => void;
330
+
331
+ /**
332
+ * Called when the map becomes fully idle — no pending animations,
333
+ * no active user gestures, all tiles loaded.
334
+ *
335
+ * **How it differs from `onRegionChangeComplete`:**
336
+ * - `onRegionChangeComplete` fires after each individual gesture or animation ends.
337
+ * - `onMapIdle` fires once when the map is completely settled.
338
+ *
339
+ * **Use case:** Fetch data for the visible region only after the user has
340
+ * finished navigating (not during every intermediate pan/zoom).
341
+ *
342
+ * @example
343
+ * ```tsx
344
+ * onMapIdle={() => fetchListingsForRegion(currentRegion)}
345
+ * ```
346
+ */
347
+ onMapIdle?: () => void;
181
348
  }
182
349
 
183
350
  /**
@@ -204,6 +371,19 @@ export interface NitroMapMethods extends HybridViewMethods {
204
371
  animated?: boolean
205
372
  ): void;
206
373
 
374
+ /**
375
+ * Fit the map to show markers by their IDs.
376
+ * Looks up marker coordinates internally.
377
+ * @param markerIds - Array of marker IDs to fit
378
+ * @param edgePadding - Optional padding from edges
379
+ * @param animated - Whether to animate the transition (default: true)
380
+ */
381
+ fitToSuppliedMarkers(
382
+ markerIds: string[],
383
+ edgePadding?: EdgePadding,
384
+ animated?: boolean
385
+ ): void;
386
+
207
387
  /**
208
388
  * Animate the camera to a specific position
209
389
  * @param camera - Target camera configuration
@@ -235,6 +415,34 @@ export interface NitroMapMethods extends HybridViewMethods {
235
415
  */
236
416
  getMapBoundaries(): Promise<MapBoundaries>;
237
417
 
418
+ /**
419
+ * Animate the camera to the user's current location.
420
+ * Requires `showsUserLocation={true}` and location permissions.
421
+ * No-op if the user's location is not yet available.
422
+ *
423
+ * @example
424
+ * ```tsx
425
+ * <TouchableOpacity onPress={() => mapRef.current?.centerOnUserLocation()}>
426
+ * <Text>📍 My Location</Text>
427
+ * </TouchableOpacity>
428
+ * ```
429
+ */
430
+ centerOnUserLocation(): void;
431
+
432
+ /**
433
+ * Convert a geographic coordinate to a screen point.
434
+ * @param coordinate - Geographic coordinate (latitude/longitude)
435
+ * @returns Screen point in pixels (React Native logical pixels, not physical)
436
+ */
437
+ pointForCoordinate(coordinate: Coordinate): Point;
438
+
439
+ /**
440
+ * Convert a screen point to a geographic coordinate.
441
+ * @param point - Screen point in pixels (React Native logical pixels)
442
+ * @returns Geographic coordinate (latitude/longitude)
443
+ */
444
+ coordinateForPoint(point: Point): Coordinate;
445
+
238
446
  /**
239
447
  * Enable or disable dark mode styling
240
448
  * @param enabled - Whether dark mode should be enabled
@@ -271,6 +479,12 @@ export interface NitroMapMethods extends HybridViewMethods {
271
479
  */
272
480
  selectMarker(id: string): void;
273
481
 
482
+ /**
483
+ * Deselect the currently selected marker and dismiss its info window.
484
+ * No-op if no marker is selected.
485
+ */
486
+ deselectMarker(): void;
487
+
274
488
  /**
275
489
  * Remove all markers from the map
276
490
  */
@@ -287,6 +501,81 @@ export interface NitroMapMethods extends HybridViewMethods {
287
501
  * Call after dynamically adding/removing markers
288
502
  */
289
503
  refreshClusters(): void;
504
+
505
+ // ============ Polyline Methods ============
506
+
507
+ /**
508
+ * Add a polyline overlay to the map
509
+ * @param polyline - Polyline data configuration
510
+ */
511
+ addPolyline(polyline: PolylineData): void;
512
+
513
+ /**
514
+ * Update an existing polyline's properties
515
+ * @param polyline - Updated polyline data (must include existing ID)
516
+ */
517
+ updatePolyline(polyline: PolylineData): void;
518
+
519
+ /**
520
+ * Remove a polyline from the map
521
+ * @param id - ID of the polyline to remove
522
+ */
523
+ removePolyline(id: string): void;
524
+
525
+ /**
526
+ * Remove all polylines from the map
527
+ */
528
+ clearPolylines(): void;
529
+
530
+ // ============ Polygon Methods ============
531
+
532
+ /**
533
+ * Add a polygon overlay to the map
534
+ * @param polygon - Polygon data configuration
535
+ */
536
+ addPolygon(polygon: PolygonData): void;
537
+
538
+ /**
539
+ * Update an existing polygon's properties
540
+ * @param polygon - Updated polygon data (must include existing ID)
541
+ */
542
+ updatePolygon(polygon: PolygonData): void;
543
+
544
+ /**
545
+ * Remove a polygon from the map
546
+ * @param id - ID of the polygon to remove
547
+ */
548
+ removePolygon(id: string): void;
549
+
550
+ /**
551
+ * Remove all polygons from the map
552
+ */
553
+ clearPolygons(): void;
554
+
555
+ // ============ Circle Methods ============
556
+
557
+ /**
558
+ * Add a circle overlay to the map
559
+ * @param circle - Circle data configuration
560
+ */
561
+ addCircle(circle: CircleData): void;
562
+
563
+ /**
564
+ * Update an existing circle's properties
565
+ * @param circle - Updated circle data (must include existing ID)
566
+ */
567
+ updateCircle(circle: CircleData): void;
568
+
569
+ /**
570
+ * Remove a circle from the map
571
+ * @param id - ID of the circle to remove
572
+ */
573
+ removeCircle(id: string): void;
574
+
575
+ /**
576
+ * Remove all circles from the map
577
+ */
578
+ clearCircles(): void;
290
579
  }
291
580
 
292
581
  export type NitroMap = HybridView<NitroMapProps, NitroMapMethods>;
package/src/types/map.ts CHANGED
@@ -112,7 +112,12 @@ export type MapBoundaries = {
112
112
  };
113
113
 
114
114
  /**
115
- * Individual style element for Google Maps styling
115
+ * Individual style modifier for map styling.
116
+ *
117
+ * **Provider note:** Currently uses Google Maps JSON styling format.
118
+ * Apple Maps and Yandex Maps use different styling APIs and will require
119
+ * a provider-specific adapter when implemented.
120
+ * @see https://developers.google.com/maps/documentation/javascript/style-reference
116
121
  */
117
122
  export type MapStyler = {
118
123
  /** Color in hex format (e.g., "#FF0000") */
@@ -130,7 +135,12 @@ export type MapStyler = {
130
135
  };
131
136
 
132
137
  /**
133
- * Map style element targeting specific features
138
+ * Map style element targeting specific map features.
139
+ *
140
+ * **Provider note:** Uses Google Maps JSON styling format (featureType/elementType/stylers).
141
+ * Future providers will need their own styling approach:
142
+ * - Apple Maps: `MKMapConfiguration` + visual features
143
+ * - Yandex Maps: Custom style format
134
144
  * @see https://developers.google.com/maps/documentation/javascript/style-reference
135
145
  */
136
146
  export type MapStyleElement = {
@@ -143,8 +153,8 @@ export type MapStyleElement = {
143
153
  };
144
154
 
145
155
  /**
146
- * Complete map style definition
147
- * Array of style elements to customize map appearance
156
+ * Complete map style definition (Google Maps JSON format).
157
+ * Array of style elements to customize map appearance.
148
158
  * @example
149
159
  * ```ts
150
160
  * const darkStyle: MapStyle = [
@@ -164,3 +174,25 @@ export type MapError = {
164
174
  /** Human-readable error description */
165
175
  message: string;
166
176
  };
177
+
178
+ /**
179
+ * Event data when the user's location changes
180
+ */
181
+ export type UserLocationChangeEvent = {
182
+ /** The user's updated geographic coordinate */
183
+ coordinate: Coordinate;
184
+ /** Accuracy of the location in meters (may be 0 if unavailable) */
185
+ accuracy: number;
186
+ /** Heading in degrees (0-360, 0 = north; -1 if unavailable) */
187
+ heading: number;
188
+ /** Speed in meters per second (-1 if unavailable) */
189
+ speed: number;
190
+ };
191
+
192
+ /**
193
+ * User tracking mode for the map camera
194
+ * - `'none'` - No automatic camera tracking
195
+ * - `'follow'` - Camera follows the user's location
196
+ * - `'followWithHeading'` - Camera follows and rotates based on heading
197
+ */
198
+ export type UserTrackingMode = 'none' | 'follow' | 'followWithHeading';
@@ -4,37 +4,18 @@ import type { ColorValue } from '../utils/colors';
4
4
  /**
5
5
  * Visual style of the marker
6
6
  * - `'default'` - Standard Google Maps marker
7
- * - `'price'` - Simple price tag
8
7
  * - `'image'` - Custom image marker
9
8
  * - `'priceMarker'` - Full-featured price marker with currency
10
- * - `'reactView'` - React Native view marker (internal use by NitroCustomMarker)
11
- *
12
- * Note: For React Native views as markers, use the NitroCustomMarker component.
13
9
  */
14
10
  export type MarkerStyle = 'default' | 'image' | 'priceMarker';
15
11
 
16
12
  /**
17
- * Animation type for individual markers when they appear
13
+ * Animation type for markers when they appear on the map.
14
+ * Uses semantic intents — each provider maps to its best native animation.
18
15
  * - `'none'` - No animation
19
- * - `'pop'` - Pop/bounce effect
20
- * - `'fadeIn'` - Fade in animation
16
+ * - `'appear'` - Platform's native appear animation (iOS: pop, Android: drop)
21
17
  */
22
- export type MarkerAnimation = 'none' | 'pop' | 'fadeIn';
23
-
24
- /**
25
- * Animation style for cluster expand/collapse
26
- * - `'default'` - Standard Google Maps Utils animation
27
- * - `'bounce'` - Markers bounce when appearing
28
- * - `'scale'` - Scale up from 0 to full size
29
- * - `'fade'` - Fade in/out
30
- * - `'spring'` - Spring effect animation
31
- */
32
- export type ClusterAnimationStyle =
33
- | 'default'
34
- | 'bounce'
35
- | 'scale'
36
- | 'fade'
37
- | 'spring';
18
+ export type MarkerAnimation = 'none' | 'appear';
38
19
 
39
20
  /**
40
21
  * Style configuration for price markers
@@ -80,24 +61,6 @@ export type MarkerColor = {
80
61
  a: number;
81
62
  };
82
63
 
83
- /**
84
- * Configuration for price-style markers
85
- */
86
- export type PriceMarkerConfig = {
87
- /** Price text to display */
88
- price: string;
89
- /** Background color */
90
- backgroundColor: MarkerColor;
91
- /** Text color */
92
- textColor: MarkerColor;
93
- /** Font size in pixels */
94
- fontSize: number;
95
- /** Corner radius in pixels */
96
- cornerRadius: number;
97
- /** Whether marker is in selected state */
98
- selected: boolean;
99
- };
100
-
101
64
  /**
102
65
  * Configuration for image-style markers
103
66
  * Colors can be hex strings ("#FF0000", "#F00") or MarkerColor objects
@@ -129,7 +92,6 @@ export type MarkerConfig = {
129
92
  image?: ImageMarkerConfig;
130
93
  /** Price marker style config (when style is 'priceMarker') */
131
94
  priceMarker?: PriceMarkerStyle;
132
- /** React view marker config (when style is 'reactView') */
133
95
  };
134
96
 
135
97
  /**
@@ -156,10 +118,23 @@ export type MarkerData = {
156
118
  anchor: Point;
157
119
  /** Visual configuration for the marker */
158
120
  config: MarkerConfig;
121
+ /** Accessibility label read by screen readers (VoiceOver / TalkBack) */
122
+ accessibilityLabel?: string;
159
123
  /** Whether this marker should be included in clustering */
160
124
  clusteringEnabled: boolean;
161
125
  /** Animation when marker appears */
162
126
  animation: MarkerAnimation;
127
+ /**
128
+ * Animation duration in seconds.
129
+ * @default 0.3
130
+ */
131
+ animationDuration: number;
132
+ /**
133
+ * Whether the marker should animate every time it reappears on the map
134
+ * (e.g., emerging from a cluster, scrolling back into viewport).
135
+ * When false, the animation only plays on the initial mount.
136
+ */
137
+ animateOnReappear: boolean;
163
138
  };
164
139
 
165
140
  /**
@@ -239,10 +214,15 @@ export type ClusterConfig = {
239
214
  borderColor?: ColorValue;
240
215
  /** Enable cluster animations @default true */
241
216
  animatesClusters?: boolean;
217
+ /**
218
+ * Whether cluster icons should animate every time they reappear
219
+ * (e.g., during pan/zoom re-clustering).
220
+ * When false, clusters only animate on first render.
221
+ * @default true
222
+ */
223
+ animateOnReappear?: boolean;
242
224
  /** Animation duration in seconds (e.g., 0.3) @default 0.3 */
243
225
  animationDuration?: number;
244
- /** Animation style for cluster expand/collapse @default 'default' */
245
- animationStyle?: ClusterAnimationStyle;
246
226
  /**
247
227
  * When true, clusters update live during pan/zoom gestures (throttled).
248
228
  * When false, clusters only update after the gesture ends (debounced).
@@ -0,0 +1,77 @@
1
+ import type { Coordinate } from './map';
2
+ import type { MarkerColor } from './marker';
3
+
4
+ /**
5
+ * Data structure for a polyline overlay on the map.
6
+ * Represents a line connecting multiple geographic points.
7
+ */
8
+ export type PolylineData = {
9
+ /** Unique identifier for the polyline */
10
+ id: string;
11
+ /** Array of geographic coordinates that form the polyline path */
12
+ coordinates: Coordinate[];
13
+ /** Stroke color as RGBA */
14
+ strokeColor: MarkerColor;
15
+ /** Stroke width in pixels */
16
+ strokeWidth: number;
17
+ /** Whether the line follows Earth's curvature (great circle) */
18
+ geodesic: boolean;
19
+ /** Whether the line is dashed */
20
+ dashed: boolean;
21
+ /** Z-index for controlling overlay order */
22
+ zIndex: number;
23
+ /** Whether this overlay responds to tap events */
24
+ tappable: boolean;
25
+ /** Accessibility label read by screen readers (VoiceOver / TalkBack) */
26
+ accessibilityLabel?: string;
27
+ };
28
+
29
+ /**
30
+ * Data structure for a polygon overlay on the map.
31
+ * Represents a closed shape with fill and stroke.
32
+ */
33
+ export type PolygonData = {
34
+ /** Unique identifier for the polygon */
35
+ id: string;
36
+ /** Array of geographic coordinates that form the polygon boundary */
37
+ coordinates: Coordinate[];
38
+ /** Optional array of holes — each hole is an array of coordinates cut out from the fill */
39
+ holes: Coordinate[][];
40
+ /** Fill color as RGBA */
41
+ fillColor: MarkerColor;
42
+ /** Stroke color as RGBA */
43
+ strokeColor: MarkerColor;
44
+ /** Stroke width in pixels */
45
+ strokeWidth: number;
46
+ /** Z-index for controlling overlay order */
47
+ zIndex: number;
48
+ /** Whether this overlay responds to tap events */
49
+ tappable: boolean;
50
+ /** Accessibility label read by screen readers (VoiceOver / TalkBack) */
51
+ accessibilityLabel?: string;
52
+ };
53
+
54
+ /**
55
+ * Data structure for a circle overlay on the map.
56
+ * Represents a circle with center, radius, and styling.
57
+ */
58
+ export type CircleData = {
59
+ /** Unique identifier for the circle */
60
+ id: string;
61
+ /** Center coordinate of the circle */
62
+ center: Coordinate;
63
+ /** Radius in meters */
64
+ radius: number;
65
+ /** Fill color as RGBA */
66
+ fillColor: MarkerColor;
67
+ /** Stroke color as RGBA */
68
+ strokeColor: MarkerColor;
69
+ /** Stroke width in pixels */
70
+ strokeWidth: number;
71
+ /** Z-index for controlling overlay order */
72
+ zIndex: number;
73
+ /** Whether this overlay responds to tap events */
74
+ tappable: boolean;
75
+ /** Accessibility label read by screen readers (VoiceOver / TalkBack) */
76
+ accessibilityLabel?: string;
77
+ };