expo-maps 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/maps/GoogleMapsModule.kt +1 -1
- package/android/src/main/java/expo/modules/maps/GoogleMapsView.kt +37 -0
- package/android/src/main/java/expo/modules/maps/Records.kt +14 -0
- package/build/apple/AppleMaps.types.d.ts +50 -1
- package/build/apple/AppleMaps.types.d.ts.map +1 -1
- package/build/apple/AppleMaps.types.js +15 -0
- package/build/apple/AppleMaps.types.js.map +1 -1
- package/build/apple/AppleMapsView.d.ts.map +1 -1
- package/build/apple/AppleMapsView.js +8 -3
- package/build/apple/AppleMapsView.js.map +1 -1
- package/build/google/GoogleMaps.types.d.ts +30 -1
- package/build/google/GoogleMaps.types.d.ts.map +1 -1
- package/build/google/GoogleMaps.types.js.map +1 -1
- package/build/google/GoogleMapsView.d.ts.map +1 -1
- package/build/google/GoogleMapsView.js +8 -3
- package/build/google/GoogleMapsView.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/AppleMapsView.swift +3 -1
- package/ios/AppleMapsViewiOS17.swift +5 -0
- package/ios/AppleMapsViewiOS18.swift +87 -13
- package/ios/MapRecords.swift +44 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/{0.9.6/expo.modules.maps-0.9.6.module → 0.9.7/expo.modules.maps-0.9.7.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/{0.9.6/expo.modules.maps-0.9.6.pom → 0.9.7/expo.modules.maps-0.9.7.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.7/expo.modules.maps-0.9.7.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/apple/AppleMaps.types.ts +55 -1
- package/src/apple/AppleMapsView.tsx +13 -2
- package/src/google/GoogleMaps.types.ts +36 -1
- package/src/google/GoogleMapsView.tsx +11 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.6/expo.modules.maps-0.9.6.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.9.7 — 2025-04-28
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Add polyline rendering support on Android and iOS. ([#36236](https://github.com/expo/expo/pull/36236) by [@fobos531](https://github.com/fobos531))
|
|
18
|
+
|
|
13
19
|
## 0.9.6 — 2025-04-26
|
|
14
20
|
|
|
15
21
|
### 💡 Others
|
package/android/build.gradle
CHANGED
|
@@ -14,13 +14,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
14
14
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
15
15
|
|
|
16
16
|
group = 'host.exp.exponent'
|
|
17
|
-
version = '0.9.
|
|
17
|
+
version = '0.9.7'
|
|
18
18
|
|
|
19
19
|
android {
|
|
20
20
|
namespace "expo.modules.maps"
|
|
21
21
|
defaultConfig {
|
|
22
22
|
versionCode 1
|
|
23
|
-
versionName "0.9.
|
|
23
|
+
versionName "0.9.7"
|
|
24
24
|
}
|
|
25
25
|
buildFeatures {
|
|
26
26
|
compose true
|
|
@@ -9,7 +9,7 @@ class GoogleMapsModule : Module() {
|
|
|
9
9
|
Name("ExpoGoogleMaps")
|
|
10
10
|
|
|
11
11
|
View(GoogleMapsView::class) {
|
|
12
|
-
Events("onMapLoaded", "onMapClick", "onMapLongClick", "onPOIClick", "onMarkerClick", "onCameraMove")
|
|
12
|
+
Events("onMapLoaded", "onMapClick", "onMapLongClick", "onPOIClick", "onMarkerClick", "onCameraMove", "onPolylineClick")
|
|
13
13
|
|
|
14
14
|
AsyncFunction("setCameraPosition") Coroutine { view: GoogleMapsView, config: SetCameraPositionConfig? ->
|
|
15
15
|
view.setCameraPosition(config)
|
|
@@ -12,9 +12,11 @@ import androidx.compose.runtime.Composable
|
|
|
12
12
|
import androidx.compose.runtime.LaunchedEffect
|
|
13
13
|
import androidx.compose.runtime.MutableState
|
|
14
14
|
import androidx.compose.runtime.derivedStateOf
|
|
15
|
+
import androidx.compose.runtime.getValue
|
|
15
16
|
import androidx.compose.runtime.mutableStateOf
|
|
16
17
|
import androidx.compose.runtime.remember
|
|
17
18
|
import androidx.compose.ui.Modifier
|
|
19
|
+
import androidx.compose.ui.graphics.Color
|
|
18
20
|
import com.google.android.gms.maps.CameraUpdateFactory
|
|
19
21
|
import com.google.android.gms.maps.LocationSource
|
|
20
22
|
import com.google.android.gms.maps.model.BitmapDescriptor
|
|
@@ -26,6 +28,7 @@ import com.google.maps.android.compose.CameraPositionState
|
|
|
26
28
|
import com.google.maps.android.compose.GoogleMap
|
|
27
29
|
import com.google.maps.android.compose.Marker
|
|
28
30
|
import com.google.maps.android.compose.MarkerState
|
|
31
|
+
import com.google.maps.android.compose.Polyline
|
|
29
32
|
import expo.modules.kotlin.AppContext
|
|
30
33
|
import expo.modules.kotlin.apifeatures.EitherType
|
|
31
34
|
import expo.modules.kotlin.sharedobjects.SharedRef
|
|
@@ -34,11 +37,13 @@ import expo.modules.kotlin.viewevent.EventDispatcher
|
|
|
34
37
|
import expo.modules.kotlin.views.ComposeProps
|
|
35
38
|
import expo.modules.kotlin.views.ExpoComposeView
|
|
36
39
|
import kotlinx.coroutines.launch
|
|
40
|
+
import androidx.core.graphics.toColorInt
|
|
37
41
|
|
|
38
42
|
data class GoogleMapsViewProps(
|
|
39
43
|
val userLocation: MutableState<UserLocationRecord> = mutableStateOf(UserLocationRecord()),
|
|
40
44
|
val cameraPosition: MutableState<CameraPositionRecord> = mutableStateOf(CameraPositionRecord()),
|
|
41
45
|
val markers: MutableState<List<MarkerRecord>> = mutableStateOf(listOf()),
|
|
46
|
+
val polylines: MutableState<List<PolylineRecord>> = mutableStateOf(listOf()),
|
|
42
47
|
val uiSettings: MutableState<MapUiSettingsRecord> = mutableStateOf(MapUiSettingsRecord()),
|
|
43
48
|
val properties: MutableState<MapPropertiesRecord> = mutableStateOf(MapPropertiesRecord()),
|
|
44
49
|
val colorScheme: MutableState<MapColorSchemeEnum> = mutableStateOf(MapColorSchemeEnum.FOLLOW_SYSTEM)
|
|
@@ -54,6 +59,7 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
54
59
|
private val onMapLongClick by EventDispatcher<Coordinates>()
|
|
55
60
|
private val onPOIClick by EventDispatcher<POIRecord>()
|
|
56
61
|
private val onMarkerClick by EventDispatcher<MarkerRecord>()
|
|
62
|
+
private val onPolylineClick by EventDispatcher<PolylineRecord>()
|
|
57
63
|
|
|
58
64
|
private val onCameraMove by EventDispatcher<CameraMoveEvent>()
|
|
59
65
|
|
|
@@ -67,6 +73,7 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
67
73
|
cameraState = updateCameraState()
|
|
68
74
|
val markerState = markerStateFromProps()
|
|
69
75
|
val locationSource = locationSourceFromProps()
|
|
76
|
+
val polylineState by polylineStateFromProps()
|
|
70
77
|
|
|
71
78
|
GoogleMap(
|
|
72
79
|
modifier = Modifier.fillMaxSize(),
|
|
@@ -108,6 +115,26 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
108
115
|
mapColorScheme = props.colorScheme.value.toComposeMapColorScheme(),
|
|
109
116
|
locationSource = locationSource
|
|
110
117
|
) {
|
|
118
|
+
polylineState.forEach { (polyline, coordinates) ->
|
|
119
|
+
Polyline(
|
|
120
|
+
points = coordinates,
|
|
121
|
+
color = Color(polyline.color),
|
|
122
|
+
geodesic = polyline.geodesic,
|
|
123
|
+
width = polyline.width,
|
|
124
|
+
clickable = true,
|
|
125
|
+
onClick = {
|
|
126
|
+
onPolylineClick(
|
|
127
|
+
PolylineRecord(
|
|
128
|
+
coordinates.map { Coordinates(it.latitude, it.longitude) },
|
|
129
|
+
polyline.geodesic,
|
|
130
|
+
polyline.color,
|
|
131
|
+
polyline.width
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
111
138
|
for ((marker, state) in markerState.value) {
|
|
112
139
|
val icon = getIconDescriptor(marker)
|
|
113
140
|
|
|
@@ -208,6 +235,16 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
208
235
|
}
|
|
209
236
|
}
|
|
210
237
|
|
|
238
|
+
@Composable
|
|
239
|
+
private fun polylineStateFromProps() =
|
|
240
|
+
remember {
|
|
241
|
+
derivedStateOf {
|
|
242
|
+
props.polylines.value.map { polyline ->
|
|
243
|
+
polyline to polyline.coordinates.map { it.toLatLng() }
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
211
248
|
suspend fun setCameraPosition(config: SetCameraPositionConfig?) {
|
|
212
249
|
// Stop updating the camera position based on user location.
|
|
213
250
|
manualCameraControl = true
|
|
@@ -64,6 +64,20 @@ data class MarkerRecord(
|
|
|
64
64
|
val showCallout: Boolean = true
|
|
65
65
|
) : Record
|
|
66
66
|
|
|
67
|
+
data class PolylineRecord(
|
|
68
|
+
@Field
|
|
69
|
+
val coordinates: List<Coordinates> = emptyList(),
|
|
70
|
+
|
|
71
|
+
@Field
|
|
72
|
+
val geodesic: Boolean = false,
|
|
73
|
+
|
|
74
|
+
@Field
|
|
75
|
+
val color: Int = 0xFF0000FF.toInt(),
|
|
76
|
+
|
|
77
|
+
@Field
|
|
78
|
+
val width: Float = 10f,
|
|
79
|
+
): Record
|
|
80
|
+
|
|
67
81
|
data class CameraPositionRecord(
|
|
68
82
|
@Field
|
|
69
83
|
val coordinates: Coordinates = Coordinates(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SharedRefType } from 'expo';
|
|
2
2
|
import type { Ref } from 'react';
|
|
3
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { ProcessedColorValue, StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import { CameraPosition, Coordinates } from '../shared.types';
|
|
5
5
|
/**
|
|
6
6
|
* @platform ios
|
|
@@ -63,6 +63,20 @@ export declare enum AppleMapsMapType {
|
|
|
63
63
|
*/
|
|
64
64
|
IMAGERY = "IMAGERY"
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* The style of the polyline.
|
|
68
|
+
* @platform ios
|
|
69
|
+
*/
|
|
70
|
+
export declare enum AppleMapsContourStyle {
|
|
71
|
+
/**
|
|
72
|
+
* A straight line.
|
|
73
|
+
*/
|
|
74
|
+
STRAIGHT = "STRAIGHT",
|
|
75
|
+
/**
|
|
76
|
+
* A geodesic line.
|
|
77
|
+
*/
|
|
78
|
+
GEODESIC = "GEODESIC"
|
|
79
|
+
}
|
|
66
80
|
/**
|
|
67
81
|
* @platform ios
|
|
68
82
|
*/
|
|
@@ -79,6 +93,13 @@ export type AppleMapsProperties = {
|
|
|
79
93
|
* If true, the user can select a location on the map to get more information.
|
|
80
94
|
*/
|
|
81
95
|
selectionEnabled?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The maximum distance in meters from a tap of a polyline for it to be considered a hit.
|
|
98
|
+
* If the distance is greater than the threshold, the polyline is not considered a hit.
|
|
99
|
+
* If a hit occurs, the `onPolylineClick` event will be triggered.
|
|
100
|
+
* Defaults to 20 meters.
|
|
101
|
+
*/
|
|
102
|
+
polylineTapThreshold?: number;
|
|
82
103
|
};
|
|
83
104
|
/**
|
|
84
105
|
* @platform ios
|
|
@@ -101,6 +122,24 @@ export type AppleMapsAnnotation = {
|
|
|
101
122
|
*/
|
|
102
123
|
icon?: SharedRefType<'image'>;
|
|
103
124
|
} & AppleMapsMarker;
|
|
125
|
+
export type AppleMapsPolyline = {
|
|
126
|
+
/**
|
|
127
|
+
* The coordinates of the polyline.
|
|
128
|
+
*/
|
|
129
|
+
coordinates: Coordinates[];
|
|
130
|
+
/**
|
|
131
|
+
* The color of the polyline.
|
|
132
|
+
*/
|
|
133
|
+
color?: ProcessedColorValue | string;
|
|
134
|
+
/**
|
|
135
|
+
* The width of the polyline.
|
|
136
|
+
*/
|
|
137
|
+
width?: number;
|
|
138
|
+
/**
|
|
139
|
+
* The style of the polyline.
|
|
140
|
+
*/
|
|
141
|
+
contourStyle?: AppleMapsContourStyle;
|
|
142
|
+
};
|
|
104
143
|
/**
|
|
105
144
|
* @platform ios
|
|
106
145
|
*/
|
|
@@ -115,6 +154,10 @@ export type AppleMapsViewProps = {
|
|
|
115
154
|
* The array of markers to display on the map.
|
|
116
155
|
*/
|
|
117
156
|
markers?: AppleMapsMarker[];
|
|
157
|
+
/**
|
|
158
|
+
* The array of polylines to display on the map.
|
|
159
|
+
*/
|
|
160
|
+
polylines?: AppleMapsPolyline[];
|
|
118
161
|
/**
|
|
119
162
|
* The array of annotations to display on the map.
|
|
120
163
|
*/
|
|
@@ -136,8 +179,14 @@ export type AppleMapsViewProps = {
|
|
|
136
179
|
}) => void;
|
|
137
180
|
/**
|
|
138
181
|
* Lambda invoked when the marker is clicked
|
|
182
|
+
* @platform ios 18.0+
|
|
139
183
|
*/
|
|
140
184
|
onMarkerClick?: (event: AppleMapsMarker) => void;
|
|
185
|
+
/**
|
|
186
|
+
* Lambda invoked when the polyline is clicked
|
|
187
|
+
* @platform ios 18.0+
|
|
188
|
+
*/
|
|
189
|
+
onPolylineClick?: (event: AppleMapsPolyline) => void;
|
|
141
190
|
/**
|
|
142
191
|
* Lambda invoked when the map was moved by the user.
|
|
143
192
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppleMaps.types.d.ts","sourceRoot":"","sources":["../../src/apple/AppleMaps.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AppleMaps.types.d.ts","sourceRoot":"","sources":["../../src/apple/AppleMaps.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,kBAAkB,CAAC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7B;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEhC;;OAEG;IACH,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAEpC;;OAEG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAEjC;;OAEG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAEjC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAE3D;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAEjD;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAErD;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,WAAW,EAAE,WAAW,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;CACtD,CAAC"}
|
|
@@ -17,4 +17,19 @@ export var AppleMapsMapType;
|
|
|
17
17
|
*/
|
|
18
18
|
AppleMapsMapType["IMAGERY"] = "IMAGERY";
|
|
19
19
|
})(AppleMapsMapType || (AppleMapsMapType = {}));
|
|
20
|
+
/**
|
|
21
|
+
* The style of the polyline.
|
|
22
|
+
* @platform ios
|
|
23
|
+
*/
|
|
24
|
+
export var AppleMapsContourStyle;
|
|
25
|
+
(function (AppleMapsContourStyle) {
|
|
26
|
+
/**
|
|
27
|
+
* A straight line.
|
|
28
|
+
*/
|
|
29
|
+
AppleMapsContourStyle["STRAIGHT"] = "STRAIGHT";
|
|
30
|
+
/**
|
|
31
|
+
* A geodesic line.
|
|
32
|
+
*/
|
|
33
|
+
AppleMapsContourStyle["GEODESIC"] = "GEODESIC";
|
|
34
|
+
})(AppleMapsContourStyle || (AppleMapsContourStyle = {}));
|
|
20
35
|
//# sourceMappingURL=AppleMaps.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppleMaps.types.js","sourceRoot":"","sources":["../../src/apple/AppleMaps.types.ts"],"names":[],"mappings":"AAyDA;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,yCAAqB,CAAA;IACrB;;OAEG;IACH,uCAAmB,CAAA;AACrB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B","sourcesContent":["import type { SharedRefType } from 'expo';\nimport type { Ref } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { CameraPosition, Coordinates } from '../shared.types';\n\n/**\n * @platform ios\n */\nexport type AppleMapsMarker = {\n /**\n * The SF Symbol to display for the marker.\n */\n systemImage?: string;\n\n /**\n * The coordinates of the marker.\n */\n coordinates?: Coordinates;\n\n /**\n * The title of the marker, displayed in the callout when the marker is clicked.\n */\n title?: string;\n\n /**\n * The tint color of the marker.\n */\n tintColor?: string;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsUISettings = {\n /**\n * Whether the compass is enabled on the map.\n * If enabled, the compass is only visible when the map is rotated.\n */\n compassEnabled?: boolean;\n\n /**\n * Whether the my location button is visible.\n */\n myLocationButtonEnabled?: boolean;\n\n /**\n * Whether the scale bar is displayed when zooming.\n */\n scaleBarEnabled?: boolean;\n\n /**\n * Whether the user is allowed to change the pitch type.\n */\n togglePitchEnabled?: boolean;\n};\n\n/**\n * The type of map to display.\n * @platform ios\n */\nexport enum AppleMapsMapType {\n /**\n * A satellite image of the area with road and road name layers on top.\n */\n HYBRID = 'HYBRID',\n /**\n * A street map that shows the position of all roads and some road names.\n */\n STANDARD = 'STANDARD',\n /**\n * A satellite image of the area.\n */\n IMAGERY = 'IMAGERY',\n}\n\n/**\n * @platform ios\n */\nexport type AppleMapsProperties = {\n /**\n * Whether the traffic layer is enabled on the map.\n */\n isTrafficEnabled?: boolean;\n\n /**\n * Defines which map type should be used.\n */\n mapType?: AppleMapsMapType;\n\n /**\n * If true, the user can select a location on the map to get more information.\n */\n selectionEnabled?: boolean;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsAnnotation = {\n /**\n * The background color of the annotation.\n */\n backgroundColor?: string;\n /**\n * The text to display in the annotation.\n */\n text?: string;\n /**\n * The text color of the annotation.\n */\n textColor?: string;\n /**\n * The custom icon to display in the annotation.\n */\n icon?: SharedRefType<'image'>;\n} & AppleMapsMarker;\n\n/**\n * @platform ios\n */\nexport type AppleMapsViewProps = {\n ref?: Ref<AppleMapsViewType>;\n style?: StyleProp<ViewStyle>;\n\n /**\n * The initial camera position of the map.\n */\n cameraPosition?: CameraPosition;\n\n /**\n * The array of markers to display on the map.\n */\n markers?: AppleMapsMarker[];\n\n /**\n * The array of annotations to display on the map.\n */\n annotations?: AppleMapsAnnotation[];\n\n /**\n * The `MapUiSettings` to be used for UI-specific settings on the map.\n */\n uiSettings?: AppleMapsUISettings;\n\n /**\n * The properties for the map.\n */\n properties?: AppleMapsProperties;\n\n /**\n * Lambda invoked when the user clicks on the map.\n * It won't be invoked if the user clicks on POI or a marker.\n */\n onMapClick?: (event: { coordinates: Coordinates }) => void;\n\n /**\n * Lambda invoked when the marker is clicked\n */\n onMarkerClick?: (event: AppleMapsMarker) => void;\n\n /**\n * Lambda invoked when the map was moved by the user.\n */\n onCameraMove?: (event: {\n coordinates: Coordinates;\n zoom: number;\n tilt: number;\n bearing: number;\n }) => void;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsViewType = {\n /**\n * Update camera position.\n * Animation duration is not supported on iOS.\n *\n * @param config New camera postion.\n */\n setCameraPosition: (config?: CameraPosition) => void;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"AppleMaps.types.js","sourceRoot":"","sources":["../../src/apple/AppleMaps.types.ts"],"names":[],"mappings":"AAyDA;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,yCAAqB,CAAA;IACrB;;OAEG;IACH,uCAAmB,CAAA;AACrB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,8CAAqB,CAAA;IACrB;;OAEG;IACH,8CAAqB,CAAA;AACvB,CAAC,EATW,qBAAqB,KAArB,qBAAqB,QAShC","sourcesContent":["import type { SharedRefType } from 'expo';\nimport type { Ref } from 'react';\nimport type { ProcessedColorValue, StyleProp, ViewStyle } from 'react-native';\n\nimport { CameraPosition, Coordinates } from '../shared.types';\n\n/**\n * @platform ios\n */\nexport type AppleMapsMarker = {\n /**\n * The SF Symbol to display for the marker.\n */\n systemImage?: string;\n\n /**\n * The coordinates of the marker.\n */\n coordinates?: Coordinates;\n\n /**\n * The title of the marker, displayed in the callout when the marker is clicked.\n */\n title?: string;\n\n /**\n * The tint color of the marker.\n */\n tintColor?: string;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsUISettings = {\n /**\n * Whether the compass is enabled on the map.\n * If enabled, the compass is only visible when the map is rotated.\n */\n compassEnabled?: boolean;\n\n /**\n * Whether the my location button is visible.\n */\n myLocationButtonEnabled?: boolean;\n\n /**\n * Whether the scale bar is displayed when zooming.\n */\n scaleBarEnabled?: boolean;\n\n /**\n * Whether the user is allowed to change the pitch type.\n */\n togglePitchEnabled?: boolean;\n};\n\n/**\n * The type of map to display.\n * @platform ios\n */\nexport enum AppleMapsMapType {\n /**\n * A satellite image of the area with road and road name layers on top.\n */\n HYBRID = 'HYBRID',\n /**\n * A street map that shows the position of all roads and some road names.\n */\n STANDARD = 'STANDARD',\n /**\n * A satellite image of the area.\n */\n IMAGERY = 'IMAGERY',\n}\n\n/**\n * The style of the polyline.\n * @platform ios\n */\nexport enum AppleMapsContourStyle {\n /**\n * A straight line.\n */\n STRAIGHT = 'STRAIGHT',\n /**\n * A geodesic line.\n */\n GEODESIC = 'GEODESIC',\n}\n\n/**\n * @platform ios\n */\nexport type AppleMapsProperties = {\n /**\n * Whether the traffic layer is enabled on the map.\n */\n isTrafficEnabled?: boolean;\n\n /**\n * Defines which map type should be used.\n */\n mapType?: AppleMapsMapType;\n\n /**\n * If true, the user can select a location on the map to get more information.\n */\n selectionEnabled?: boolean;\n\n /**\n * The maximum distance in meters from a tap of a polyline for it to be considered a hit.\n * If the distance is greater than the threshold, the polyline is not considered a hit.\n * If a hit occurs, the `onPolylineClick` event will be triggered.\n * Defaults to 20 meters.\n */\n polylineTapThreshold?: number;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsAnnotation = {\n /**\n * The background color of the annotation.\n */\n backgroundColor?: string;\n /**\n * The text to display in the annotation.\n */\n text?: string;\n /**\n * The text color of the annotation.\n */\n textColor?: string;\n /**\n * The custom icon to display in the annotation.\n */\n icon?: SharedRefType<'image'>;\n} & AppleMapsMarker;\n\nexport type AppleMapsPolyline = {\n /**\n * The coordinates of the polyline.\n */\n coordinates: Coordinates[];\n /**\n * The color of the polyline.\n */\n color?: ProcessedColorValue | string;\n /**\n * The width of the polyline.\n */\n width?: number;\n /**\n * The style of the polyline.\n */\n contourStyle?: AppleMapsContourStyle;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsViewProps = {\n ref?: Ref<AppleMapsViewType>;\n style?: StyleProp<ViewStyle>;\n\n /**\n * The initial camera position of the map.\n */\n cameraPosition?: CameraPosition;\n\n /**\n * The array of markers to display on the map.\n */\n markers?: AppleMapsMarker[];\n\n /**\n * The array of polylines to display on the map.\n */\n polylines?: AppleMapsPolyline[];\n\n /**\n * The array of annotations to display on the map.\n */\n annotations?: AppleMapsAnnotation[];\n\n /**\n * The `MapUiSettings` to be used for UI-specific settings on the map.\n */\n uiSettings?: AppleMapsUISettings;\n\n /**\n * The properties for the map.\n */\n properties?: AppleMapsProperties;\n\n /**\n * Lambda invoked when the user clicks on the map.\n * It won't be invoked if the user clicks on POI or a marker.\n */\n onMapClick?: (event: { coordinates: Coordinates }) => void;\n\n /**\n * Lambda invoked when the marker is clicked\n * @platform ios 18.0+\n */\n onMarkerClick?: (event: AppleMapsMarker) => void;\n\n /**\n * Lambda invoked when the polyline is clicked\n * @platform ios 18.0+\n */\n onPolylineClick?: (event: AppleMapsPolyline) => void;\n\n /**\n * Lambda invoked when the map was moved by the user.\n */\n onCameraMove?: (event: {\n coordinates: Coordinates;\n zoom: number;\n tilt: number;\n bearing: number;\n }) => void;\n};\n\n/**\n * @platform ios\n */\nexport type AppleMapsViewType = {\n /**\n * Update camera position.\n * Animation duration is not supported on iOS.\n *\n * @param config New camera postion.\n */\n setCameraPosition: (config?: CameraPosition) => void;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppleMapsView.d.ts","sourceRoot":"","sources":["../../src/apple/AppleMapsView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAkB/E;;GAEG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"AppleMapsView.d.ts","sourceRoot":"","sources":["../../src/apple/AppleMapsView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAkB/E;;GAEG;AACH,eAAO,MAAM,aAAa,2GA6CzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
3
|
+
import { Platform, processColor } from 'react-native';
|
|
4
4
|
let NativeView;
|
|
5
5
|
if (Platform.OS === 'ios') {
|
|
6
6
|
NativeView = requireNativeView('ExpoAppleMaps');
|
|
@@ -15,7 +15,7 @@ function useNativeEvent(userHandler) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @platform ios
|
|
17
17
|
*/
|
|
18
|
-
export const AppleMapsView = React.forwardRef(({ onMapClick, onMarkerClick, onCameraMove, annotations, ...props }, ref) => {
|
|
18
|
+
export const AppleMapsView = React.forwardRef(({ onMapClick, onMarkerClick, onCameraMove, onPolylineClick, annotations, polylines, ...props }, ref) => {
|
|
19
19
|
const nativeRef = React.useRef(null);
|
|
20
20
|
React.useImperativeHandle(ref, () => ({
|
|
21
21
|
setCameraPosition(config) {
|
|
@@ -25,6 +25,11 @@ export const AppleMapsView = React.forwardRef(({ onMapClick, onMarkerClick, onCa
|
|
|
25
25
|
const onNativeMapClick = useNativeEvent(onMapClick);
|
|
26
26
|
const onNativeMarkerClick = useNativeEvent(onMarkerClick);
|
|
27
27
|
const onNativeCameraMove = useNativeEvent(onCameraMove);
|
|
28
|
+
const onNativePolylineClick = useNativeEvent(onPolylineClick);
|
|
29
|
+
const parsedPolylines = polylines?.map((polyline) => ({
|
|
30
|
+
...polyline,
|
|
31
|
+
color: processColor(polyline.color) ?? undefined,
|
|
32
|
+
}));
|
|
28
33
|
const parsedAnnotations = annotations?.map((annotation) => ({
|
|
29
34
|
...annotation,
|
|
30
35
|
// @ts-expect-error
|
|
@@ -33,6 +38,6 @@ export const AppleMapsView = React.forwardRef(({ onMapClick, onMarkerClick, onCa
|
|
|
33
38
|
if (!NativeView) {
|
|
34
39
|
return null;
|
|
35
40
|
}
|
|
36
|
-
return (<NativeView {...props} ref={nativeRef} annotations={parsedAnnotations} onMapClick={onNativeMapClick} onMarkerClick={onNativeMarkerClick} onCameraMove={onNativeCameraMove}/>);
|
|
41
|
+
return (<NativeView {...props} ref={nativeRef} polylines={parsedPolylines} annotations={parsedAnnotations} onMapClick={onNativeMapClick} onMarkerClick={onNativeMarkerClick} onCameraMove={onNativeCameraMove} onPolylineClick={onNativePolylineClick}/>);
|
|
37
42
|
});
|
|
38
43
|
//# sourceMappingURL=AppleMapsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppleMapsView.js","sourceRoot":"","sources":["../../src/apple/AppleMapsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AppleMapsView.js","sourceRoot":"","sources":["../../src/apple/AppleMapsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKtD,IAAI,UAA0D,CAAC;AAE/D,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;IAC1B,UAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,cAAc,CAAI,WAA+B;IACxD,OAAO,KAAK,CAAC,WAAW;IACtB,sGAAsG;IACtG,CAAC,KAAU,EAAE,EAAE;QACb,WAAW,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM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AAC,CAC3B,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAC/B,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAC7B,aAAa,CAAC,CAAC,mBAAmB,CAAC,CACnC,YAAY,CAAC,CAAC,kBAAkB,CAAC,CACjC,eAAe,CAAC,CAAC,qBAAqB,CAAC,EACvC,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { Platform, processColor } from 'react-native';\n\nimport { CameraPosition } from '../shared.types';\nimport type { AppleMapsViewProps, AppleMapsViewType } from './AppleMaps.types';\n\nlet NativeView: React.ComponentType<AppleMapsViewProps> | null;\n\nif (Platform.OS === 'ios') {\n NativeView = requireNativeView('ExpoAppleMaps');\n}\n\nfunction useNativeEvent<T>(userHandler?: (data: T) => void) {\n return React.useCallback(\n // TODO(@kitten): We unwrap a native payload here, but this isn't reflected in NativeView's prop types\n (event: any) => {\n userHandler?.(event.nativeEvent);\n },\n [userHandler]\n );\n}\n\n/**\n * @platform ios\n */\nexport const AppleMapsView = React.forwardRef<AppleMapsViewType, AppleMapsViewProps>(\n (\n { onMapClick, onMarkerClick, onCameraMove, onPolylineClick, annotations, polylines, ...props },\n ref\n ) => {\n const nativeRef = React.useRef<AppleMapsViewType>(null);\n React.useImperativeHandle(ref, () => ({\n setCameraPosition(config?: CameraPosition) {\n nativeRef.current?.setCameraPosition(config);\n },\n }));\n\n const onNativeMapClick = useNativeEvent(onMapClick);\n const onNativeMarkerClick = useNativeEvent(onMarkerClick);\n const onNativeCameraMove = useNativeEvent(onCameraMove);\n const onNativePolylineClick = useNativeEvent(onPolylineClick);\n\n const parsedPolylines = polylines?.map((polyline) => ({\n ...polyline,\n color: processColor(polyline.color) ?? undefined,\n }));\n\n const parsedAnnotations = annotations?.map((annotation) => ({\n ...annotation,\n // @ts-expect-error\n icon: annotation.icon?.__expo_shared_object_id__,\n }));\n\n if (!NativeView) {\n return null;\n }\n\n return (\n <NativeView\n {...props}\n ref={nativeRef}\n polylines={parsedPolylines}\n annotations={parsedAnnotations}\n onMapClick={onNativeMapClick}\n onMarkerClick={onNativeMarkerClick}\n onCameraMove={onNativeCameraMove}\n onPolylineClick={onNativePolylineClick}\n />\n );\n }\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SharedRefType } from 'expo';
|
|
2
2
|
import type { Ref } from 'react';
|
|
3
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { ProcessedColorValue, StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import { CameraPosition, Coordinates } from '../shared.types';
|
|
5
5
|
/**
|
|
6
6
|
* @platform android
|
|
@@ -31,6 +31,27 @@ export type GoogleMapsMarker = {
|
|
|
31
31
|
*/
|
|
32
32
|
icon?: SharedRefType<'image'>;
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* @platform android
|
|
36
|
+
*/
|
|
37
|
+
export type GoogleMapsPolyline = {
|
|
38
|
+
/**
|
|
39
|
+
* The coordinates of the polyline.
|
|
40
|
+
*/
|
|
41
|
+
coordinates: Coordinates[];
|
|
42
|
+
/**
|
|
43
|
+
* The color of the polyline.
|
|
44
|
+
*/
|
|
45
|
+
color?: ProcessedColorValue | string;
|
|
46
|
+
/**
|
|
47
|
+
* The width of the polyline.
|
|
48
|
+
*/
|
|
49
|
+
width?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the polyline is geodesic.
|
|
52
|
+
*/
|
|
53
|
+
geodesic?: boolean;
|
|
54
|
+
};
|
|
34
55
|
/**
|
|
35
56
|
* @platform android
|
|
36
57
|
*/
|
|
@@ -179,6 +200,10 @@ export type GoogleMapsViewProps = {
|
|
|
179
200
|
* The array of markers to display on the map.
|
|
180
201
|
*/
|
|
181
202
|
markers?: GoogleMapsMarker[];
|
|
203
|
+
/**
|
|
204
|
+
* The array of polylines to display on the map.
|
|
205
|
+
*/
|
|
206
|
+
polylines?: GoogleMapsPolyline[];
|
|
182
207
|
/**
|
|
183
208
|
* The `MapUiSettings` to be used for UI-specific settings on the map.
|
|
184
209
|
*/
|
|
@@ -223,6 +248,10 @@ export type GoogleMapsViewProps = {
|
|
|
223
248
|
* Lambda invoked when the marker is clicked
|
|
224
249
|
*/
|
|
225
250
|
onMarkerClick?: (event: GoogleMapsMarker) => void;
|
|
251
|
+
/**
|
|
252
|
+
* Lambda invoked when the polyline is clicked.
|
|
253
|
+
*/
|
|
254
|
+
onPolylineClick?: (event: GoogleMapsPolyline) => void;
|
|
226
255
|
/**
|
|
227
256
|
* Lambda invoked when the map was moved by the user.
|
|
228
257
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.types.d.ts","sourceRoot":"","sources":["../../src/google/GoogleMaps.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleMaps.types.d.ts","sourceRoot":"","sources":["../../src/google/GoogleMaps.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;O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ACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,wBAAwB,CAAC;IACnC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.types.js","sourceRoot":"","sources":["../../src/google/GoogleMaps.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GoogleMaps.types.js","sourceRoot":"","sources":["../../src/google/GoogleMaps.types.ts"],"names":[],"mappings":"AAmJA;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAiBX;AAjBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,sCAAiB,CAAA;IACjB;;OAEG;IACH,sCAAiB,CAAA;IACjB;;OAEG;IACH,4CAAuB,CAAA;IACvB;;OAEG;IACH,wCAAmB,CAAA;AACrB,CAAC,EAjBW,iBAAiB,KAAjB,iBAAiB,QAiB5B;AA+CD;;GAEG;AACH,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,wDAA+B,CAAA;AACjC,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC","sourcesContent":["import type { SharedRefType } from 'expo';\nimport type { Ref } from 'react';\nimport type { ProcessedColorValue, StyleProp, ViewStyle } from 'react-native';\n\nimport { CameraPosition, Coordinates } from '../shared.types';\n\n/**\n * @platform android\n */\nexport type GoogleMapsMarker = {\n /**\n * The coordinates of the marker.\n */\n coordinates?: Coordinates;\n\n /**\n * The title of the marker, displayed in the callout when the marker is clicked.\n */\n title?: string;\n\n /**\n * The snippet of the marker, Displayed in the callout when the marker is clicked.\n */\n snippet?: string;\n\n /**\n * Whether the marker is draggable.\n */\n draggable?: boolean;\n\n /**\n * Whether the callout should be shown when the marker is clicked.\n */\n showCallout?: boolean;\n\n /**\n * The custom icon to display for the marker.\n */\n icon?: SharedRefType<'image'>;\n};\n\n/**\n * @platform android\n */\nexport type GoogleMapsPolyline = {\n /**\n * The coordinates of the polyline.\n */\n coordinates: Coordinates[];\n\n /**\n * The color of the polyline.\n */\n color?: ProcessedColorValue | string;\n\n /**\n * The width of the polyline.\n */\n width?: number;\n\n /**\n * Whether the polyline is geodesic.\n */\n geodesic?: boolean;\n};\n\n/**\n * @platform android\n */\nexport type GoogleMapsUserLocation = {\n /**\n * User location coordinates.\n */\n coordinates: Coordinates;\n\n /**\n * Should the camera follow the users' location.\n */\n followUserLocation: boolean;\n};\n\n/**\n * @platform android\n */\nexport type GoogleMapsUISettings = {\n /**\n * Whether the compass is enabled on the map.\n * If enabled, the compass is only visible when the map is rotated.\n */\n compassEnabled?: boolean;\n\n /**\n * Whether the indoor level picker is enabled .\n */\n indoorLevelPickerEnabled?: boolean;\n\n /**\n * Whether the map toolbar is visible.\n */\n mapToolbarEnabled?: boolean;\n\n /**\n * Whether the my location button is visible.\n */\n myLocationButtonEnabled?: boolean;\n\n /**\n * Whether rotate gestures are enabled.\n */\n rotationGesturesEnabled?: boolean;\n\n /**\n * Whether the scroll gestures are enabled.\n */\n scrollGesturesEnabled?: boolean;\n\n /**\n * Whether the scroll gestures are enabled during rotation or zoom.\n */\n scrollGesturesEnabledDuringRotateOrZoom?: boolean;\n\n /**\n * Whether the tilt gestures are enabled.\n */\n tiltGesturesEnabled?: boolean;\n\n /**\n * Whether the zoom controls are visible.\n */\n zoomControlsEnabled?: boolean;\n\n /**\n * Whether the zoom gestures are enabled.\n */\n zoomGesturesEnabled?: boolean;\n\n /**\n * Whether the scale bar is displayed when zooming.\n */\n scaleBarEnabled?: boolean;\n\n /**\n * Whether the user is allowed to change the pitch type.\n */\n togglePitchEnabled?: boolean;\n};\n\n/**\n * The type of map to display.\n * @platform android\n */\nexport enum GoogleMapsMapType {\n /**\n * Satellite imagery with roads and points of interest overlayed.\n */\n HYBRID = 'HYBRID',\n /**\n * Standard road map.\n */\n NORMAL = 'NORMAL',\n /**\n * Satellite imagery.\n */\n SATELLITE = 'SATELLITE',\n /**\n * Topographic data.\n */\n TERRAIN = 'TERRAIN',\n}\n\n/**\n * @platform android\n */\nexport type GoogleMapsProperties = {\n /**\n * Whether the building layer is enabled on the map.\n */\n isBuildingEnabled?: boolean;\n\n /**\n * Whether the indoor layer is enabled on the map.\n */\n isIndoorEnabled?: boolean;\n\n /**\n * Whether finding the user's location is enabled on the map.\n */\n isMyLocationEnabled?: boolean;\n\n /**\n * Whether the traffic layer is enabled on the map.\n */\n isTrafficEnabled?: boolean;\n\n /**\n * Defines which map type should be used.\n */\n mapType?: GoogleMapsMapType;\n\n /**\n * If true, the user can select a location on the map to get more information.\n */\n selectionEnabled?: boolean;\n\n /**\n * The maximum zoom level for the map.\n */\n maxZoomPreference?: number;\n\n /**\n * The minimum zoom level for the map.\n */\n minZoomPreference?: number;\n};\n\n/**\n * @platform android\n */\nexport enum GoogleMapsColorScheme {\n LIGHT = 'LIGHT',\n DARK = 'DARK',\n FOLLOW_SYSTEM = 'FOLLOW_SYSTEM',\n}\n\n/**\n * @platform android\n */\nexport type GoogleMapsViewProps = {\n ref?: Ref<GoogleMapsViewType>;\n style?: StyleProp<ViewStyle>;\n\n /**\n * The initial camera position of the map.\n */\n cameraPosition?: CameraPosition;\n\n /**\n * The array of markers to display on the map.\n */\n markers?: GoogleMapsMarker[];\n\n /**\n * The array of polylines to display on the map.\n */\n polylines?: GoogleMapsPolyline[];\n\n /**\n * The `MapUiSettings` to be used for UI-specific settings on the map.\n */\n uiSettings?: GoogleMapsUISettings;\n\n /**\n * The properties for the map.\n */\n properties?: GoogleMapsProperties;\n\n /**\n * Defines the color scheme for the map.\n */\n colorScheme?: GoogleMapsColorScheme;\n\n /**\n * User location, overrides default behavior.\n */\n userLocation?: GoogleMapsUserLocation;\n\n /**\n * Lambda invoked when the map is loaded.\n */\n onMapLoaded?: () => void;\n\n /**\n * Lambda invoked when the user clicks on the map.\n * It won't be invoked if the user clicks on POI or a marker.\n */\n onMapClick?: (event: { coordinates: Coordinates }) => void;\n\n /**\n * Lambda invoked when the user long presses on the map.\n */\n onMapLongClick?: (event: { coordinates: Coordinates }) => void;\n\n /**\n * Lambda invoked when a POI is clicked.\n */\n onPOIClick?: (event: { name: string; coordinates: Coordinates }) => void;\n\n /**\n * Lambda invoked when the marker is clicked\n */\n onMarkerClick?: (event: GoogleMapsMarker) => void;\n\n /**\n * Lambda invoked when the polyline is clicked.\n */\n onPolylineClick?: (event: GoogleMapsPolyline) => void;\n\n /**\n * Lambda invoked when the map was moved by the user.\n */\n onCameraMove?: (event: {\n coordinates: Coordinates;\n zoom: number;\n tilt: number;\n bearing: number;\n }) => void;\n};\n\n/**\n * @platform android\n */\nexport type SetCameraPositionConfig = CameraPosition & {\n /**\n * The duration of the animation in milliseconds.\n */\n duration?: number;\n};\n\n/**\n * @platform android\n */\nexport type GoogleMapsViewType = {\n /**\n * Update camera position.\n * @param config New camera position config.\n */\n setCameraPosition: (config?: SetCameraPositionConfig) => void;\n};\n\n/**\n * @platform android\n */\nexport type StreetViewCameraPosition = {\n coordinates: Coordinates;\n zoom?: number;\n tilt?: number;\n bearing?: number;\n};\n\n/**\n * @platform android\n */\nexport type GoogleStreetViewProps = {\n style?: StyleProp<ViewStyle>;\n position: StreetViewCameraPosition;\n isPanningGesturesEnabled?: boolean;\n isStreetNamesEnabled?: boolean;\n isUserNavigationEnabled?: boolean;\n isZoomGesturesEnabled?: boolean;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsView.d.ts","sourceRoot":"","sources":["../../src/google/GoogleMapsView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAkB5B;;GAEG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"GoogleMapsView.d.ts","sourceRoot":"","sources":["../../src/google/GoogleMapsView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAkB5B;;GAEG;AACH,eAAO,MAAM,cAAc,6GA+D1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
3
|
+
import { Platform, processColor } from 'react-native';
|
|
4
4
|
let NativeView = null;
|
|
5
5
|
if (Platform.OS === 'android') {
|
|
6
6
|
NativeView = requireNativeView('ExpoGoogleMaps');
|
|
@@ -15,7 +15,7 @@ function useNativeEvent(userHandler) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @platform android
|
|
17
17
|
*/
|
|
18
|
-
export const GoogleMapsView = React.forwardRef(({ onMapLoaded, onMapClick, onMapLongClick, onPOIClick, onMarkerClick, onCameraMove, markers, ...props }, ref) => {
|
|
18
|
+
export const GoogleMapsView = React.forwardRef(({ onMapLoaded, onMapClick, onMapLongClick, onPOIClick, onMarkerClick, onPolylineClick, onCameraMove, markers, polylines, ...props }, ref) => {
|
|
19
19
|
const nativeRef = React.useRef(null);
|
|
20
20
|
React.useImperativeHandle(ref, () => ({
|
|
21
21
|
setCameraPosition(config) {
|
|
@@ -30,6 +30,11 @@ export const GoogleMapsView = React.forwardRef(({ onMapLoaded, onMapClick, onMap
|
|
|
30
30
|
const onNativePOIClick = useNativeEvent(onPOIClick);
|
|
31
31
|
const onNativeMarkerClick = useNativeEvent(onMarkerClick);
|
|
32
32
|
const onNativeCameraMove = useNativeEvent(onCameraMove);
|
|
33
|
+
const onNativePolylineClick = useNativeEvent(onPolylineClick);
|
|
34
|
+
const parsedPolylines = polylines?.map((polyline) => ({
|
|
35
|
+
...polyline,
|
|
36
|
+
color: processColor(polyline.color) ?? undefined,
|
|
37
|
+
}));
|
|
33
38
|
const parsedMarkers = markers?.map((marker) => ({
|
|
34
39
|
...marker,
|
|
35
40
|
// @ts-expect-error
|
|
@@ -38,6 +43,6 @@ export const GoogleMapsView = React.forwardRef(({ onMapLoaded, onMapClick, onMap
|
|
|
38
43
|
if (!NativeView) {
|
|
39
44
|
return null;
|
|
40
45
|
}
|
|
41
|
-
return (<NativeView {...props} ref={nativeRef} markers={parsedMarkers} onMapLoaded={onNativeMapLoaded} onMapClick={onNativeMapClick} onMapLongClick={onNativeMapLongClick} onPOIClick={onNativePOIClick} onMarkerClick={onNativeMarkerClick} onCameraMove={onNativeCameraMove}/>);
|
|
46
|
+
return (<NativeView {...props} ref={nativeRef} markers={parsedMarkers} polylines={parsedPolylines} onMapLoaded={onNativeMapLoaded} onMapClick={onNativeMapClick} onMapLongClick={onNativeMapLongClick} onPOIClick={onNativePOIClick} onMarkerClick={onNativeMarkerClick} onCameraMove={onNativeCameraMove} onPolylineClick={onNativePolylineClick}/>);
|
|
42
47
|
});
|
|
43
48
|
//# sourceMappingURL=GoogleMapsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsView.js","sourceRoot":"","sources":["../../src/google/GoogleMapsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleMapsView.js","sourceRoot":"","sources":["../../src/google/GoogleMapsView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE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AAC;IAC5D,MAAM,gBAAgB,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IACpD,MAAM,mBAAmB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1D,MAAM,kBAAkB,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IACxD,MAAM,qBAAqB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;IAE9D,MAAM,eAAe,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpD,GAAG,QAAQ;QACX,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS;KACjD,CAAC,CAAC,CAAC;IAEJ,MAAM,aAAa,GAAG,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9C,GAAG,MAAM;QACT,mBAAmB;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,yBAAyB;KAC7C,CAAC,CAAC,CAAC;IAEJ,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,UAAU,CACT,IAAI,KAAK,CAAC,CACV,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,CAAC,CAAC,aAAa,CAAC,CACvB,SAAS,CAAC,CAAC,eAAe,CAAC,CAC3B,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAC/B,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAC7B,cAAc,CAAC,CAAC,oBAAoB,CAAC,CACrC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAC7B,aAAa,CAAC,CAAC,mBAAmB,CAAC,CACnC,YAAY,CAAC,CAAC,kBAAkB,CAAC,CACjC,eAAe,CAAC,CAAC,qBAAqB,CAAC,EACvC,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { Platform, processColor } from 'react-native';\n\nimport type {\n GoogleMapsViewProps,\n GoogleMapsViewType,\n SetCameraPositionConfig,\n} from './GoogleMaps.types';\n\nlet NativeView: React.ComponentType<GoogleMapsViewProps> | null = null;\n\nif (Platform.OS === 'android') {\n NativeView = requireNativeView('ExpoGoogleMaps');\n}\n\nfunction useNativeEvent<T>(userHandler?: (data: T) => void) {\n return React.useCallback(\n // TODO(@kitten): We unwrap a native payload here, but this isn't reflected in NativeView's prop types\n (event: any) => {\n userHandler?.(event.nativeEvent);\n },\n [userHandler]\n );\n}\n\n/**\n * @platform android\n */\nexport const GoogleMapsView = React.forwardRef<GoogleMapsViewType, GoogleMapsViewProps>(\n (\n {\n onMapLoaded,\n onMapClick,\n onMapLongClick,\n onPOIClick,\n onMarkerClick,\n onPolylineClick,\n onCameraMove,\n markers,\n polylines,\n ...props\n },\n ref\n ) => {\n const nativeRef = React.useRef<GoogleMapsViewType>(null);\n React.useImperativeHandle(ref, () => ({\n setCameraPosition(config?: SetCameraPositionConfig) {\n nativeRef.current?.setCameraPosition(config);\n },\n }));\n\n const onNativeMapLoaded = React.useCallback(() => {\n onMapLoaded?.();\n }, [onMapLoaded]);\n const onNativeMapClick = useNativeEvent(onMapClick);\n const onNativeMapLongClick = useNativeEvent(onMapLongClick);\n const onNativePOIClick = useNativeEvent(onPOIClick);\n const onNativeMarkerClick = useNativeEvent(onMarkerClick);\n const onNativeCameraMove = useNativeEvent(onCameraMove);\n const onNativePolylineClick = useNativeEvent(onPolylineClick);\n\n const parsedPolylines = polylines?.map((polyline) => ({\n ...polyline,\n color: processColor(polyline.color) ?? undefined,\n }));\n\n const parsedMarkers = markers?.map((marker) => ({\n ...marker,\n // @ts-expect-error\n icon: marker.icon?.__expo_shared_object_id__,\n }));\n\n if (!NativeView) {\n return null;\n }\n return (\n <NativeView\n {...props}\n ref={nativeRef}\n markers={parsedMarkers}\n polylines={parsedPolylines}\n onMapLoaded={onNativeMapLoaded}\n onMapClick={onNativeMapClick}\n onMapLongClick={onNativeMapLongClick}\n onPOIClick={onNativePOIClick}\n onMarkerClick={onNativeMarkerClick}\n onCameraMove={onNativeCameraMove}\n onPolylineClick={onNativePolylineClick}\n />\n );\n }\n);\n"]}
|
package/expo-module.config.json
CHANGED
package/ios/AppleMapsView.swift
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// Copyright 2025-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import SwiftUI
|
|
4
3
|
import ExpoModulesCore
|
|
5
4
|
import MapKit
|
|
5
|
+
import SwiftUI
|
|
6
6
|
|
|
7
7
|
class AppleMapsViewProps: ExpoSwiftUI.ViewProps {
|
|
8
8
|
@Field var markers: [MapMarker] = []
|
|
9
9
|
@Field var annotations: [MapAnnotation] = []
|
|
10
|
+
@Field var polylines: [ExpoAppleMapPolyline] = []
|
|
10
11
|
@Field var cameraPosition: CameraPosition
|
|
11
12
|
@Field var uiSettings: MapUISettings = MapUISettings()
|
|
12
13
|
@Field var properties: MapProperties = MapProperties()
|
|
13
14
|
let onMapClick = EventDispatcher()
|
|
14
15
|
let onMarkerClick = EventDispatcher()
|
|
16
|
+
let onPolylineClick = EventDispatcher()
|
|
15
17
|
let onCameraMove = EventDispatcher()
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -28,6 +28,11 @@ struct AppleMapsViewiOS17: View, AppleMapsViewProtocol {
|
|
|
28
28
|
.tint(marker.tintColor)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
ForEach(props.polylines) { polyline in
|
|
32
|
+
MapPolyline(coordinates: polyline.clLocationCoordinates2D)
|
|
33
|
+
.stroke(polyline.color, lineWidth: polyline.width)
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
ForEach(props.annotations) { annotation in
|
|
32
37
|
Annotation(
|
|
33
38
|
annotation.title,
|