expo-maps 0.9.6 → 0.9.8
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 +13 -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 +39 -0
- package/android/src/main/java/expo/modules/maps/Records.kt +21 -0
- package/build/apple/AppleMaps.types.d.ts +58 -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 +38 -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 +88 -13
- package/ios/MapRecords.swift +44 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8-sources.jar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.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.8/expo.modules.maps-0.9.8.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.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.8/expo.modules.maps-0.9.8.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.maps/0.9.8/expo.modules.maps-0.9.8.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 +3 -3
- package/src/apple/AppleMaps.types.ts +64 -1
- package/src/apple/AppleMapsView.tsx +13 -2
- package/src/google/GoogleMaps.types.ts +46 -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,19 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.9.8 — 2025-04-30
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Added `id` property to markers and polylines. ([#36422](https://github.com/expo/expo/pull/36422) by [@fobos531](https://github.com/fobos531))
|
|
18
|
+
- Add polyline rendering support on Android and iOS. ([#36236](https://github.com/expo/expo/pull/36236) by [@fobos531](https://github.com/fobos531))
|
|
19
|
+
|
|
20
|
+
## 0.9.7 — 2025-04-28
|
|
21
|
+
|
|
22
|
+
### 🎉 New features
|
|
23
|
+
|
|
24
|
+
- Add polyline rendering support on Android and iOS. ([#36236](https://github.com/expo/expo/pull/36236) by [@fobos531](https://github.com/fobos531))
|
|
25
|
+
|
|
13
26
|
## 0.9.6 — 2025-04-26
|
|
14
27
|
|
|
15
28
|
### 💡 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.8'
|
|
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.8"
|
|
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,27 @@ 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
|
+
id = polyline.id,
|
|
129
|
+
coordinates.map { Coordinates(it.latitude, it.longitude) },
|
|
130
|
+
polyline.geodesic,
|
|
131
|
+
polyline.color,
|
|
132
|
+
polyline.width
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
111
139
|
for ((marker, state) in markerState.value) {
|
|
112
140
|
val icon = getIconDescriptor(marker)
|
|
113
141
|
|
|
@@ -122,6 +150,7 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
122
150
|
// We can't send icon to js, because it's not serializable
|
|
123
151
|
// So we need to remove it from the marker record
|
|
124
152
|
MarkerRecord(
|
|
153
|
+
id = marker.id,
|
|
125
154
|
title = marker.title,
|
|
126
155
|
snippet = marker.snippet,
|
|
127
156
|
coordinates = marker.coordinates
|
|
@@ -208,6 +237,16 @@ class GoogleMapsView(context: Context, appContext: AppContext) : ExpoComposeView
|
|
|
208
237
|
}
|
|
209
238
|
}
|
|
210
239
|
|
|
240
|
+
@Composable
|
|
241
|
+
private fun polylineStateFromProps() =
|
|
242
|
+
remember {
|
|
243
|
+
derivedStateOf {
|
|
244
|
+
props.polylines.value.map { polyline ->
|
|
245
|
+
polyline to polyline.coordinates.map { it.toLatLng() }
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
211
250
|
suspend fun setCameraPosition(config: SetCameraPositionConfig?) {
|
|
212
251
|
// Stop updating the camera position based on user location.
|
|
213
252
|
manualCameraControl = true
|
|
@@ -16,6 +16,7 @@ import expo.modules.kotlin.records.Record
|
|
|
16
16
|
import expo.modules.kotlin.sharedobjects.SharedRef
|
|
17
17
|
import expo.modules.kotlin.types.Either
|
|
18
18
|
import expo.modules.kotlin.types.Enumerable
|
|
19
|
+
import java.util.UUID
|
|
19
20
|
|
|
20
21
|
data class SetCameraPositionConfig(
|
|
21
22
|
@Field
|
|
@@ -45,6 +46,9 @@ data class Coordinates(
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
data class MarkerRecord(
|
|
49
|
+
@Field
|
|
50
|
+
val id: String = UUID.randomUUID().toString(),
|
|
51
|
+
|
|
48
52
|
@Field
|
|
49
53
|
val coordinates: Coordinates = Coordinates(),
|
|
50
54
|
|
|
@@ -64,6 +68,23 @@ data class MarkerRecord(
|
|
|
64
68
|
val showCallout: Boolean = true
|
|
65
69
|
) : Record
|
|
66
70
|
|
|
71
|
+
data class PolylineRecord(
|
|
72
|
+
@Field
|
|
73
|
+
val id: String = UUID.randomUUID().toString(),
|
|
74
|
+
|
|
75
|
+
@Field
|
|
76
|
+
val coordinates: List<Coordinates> = emptyList(),
|
|
77
|
+
|
|
78
|
+
@Field
|
|
79
|
+
val geodesic: Boolean = false,
|
|
80
|
+
|
|
81
|
+
@Field
|
|
82
|
+
val color: Int = 0xFF0000FF.toInt(),
|
|
83
|
+
|
|
84
|
+
@Field
|
|
85
|
+
val width: Float = 10f,
|
|
86
|
+
): Record
|
|
87
|
+
|
|
67
88
|
data class CameraPositionRecord(
|
|
68
89
|
@Field
|
|
69
90
|
val coordinates: Coordinates = Coordinates(),
|
|
@@ -1,11 +1,15 @@
|
|
|
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
|
|
7
7
|
*/
|
|
8
8
|
export type AppleMapsMarker = {
|
|
9
|
+
/**
|
|
10
|
+
* The unique identifier for the marker. This can be used to e.g. identify the clicked marker in the `onMarkerClick` event.
|
|
11
|
+
*/
|
|
12
|
+
id?: string;
|
|
9
13
|
/**
|
|
10
14
|
* The SF Symbol to display for the marker.
|
|
11
15
|
*/
|
|
@@ -63,6 +67,20 @@ export declare enum AppleMapsMapType {
|
|
|
63
67
|
*/
|
|
64
68
|
IMAGERY = "IMAGERY"
|
|
65
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The style of the polyline.
|
|
72
|
+
* @platform ios
|
|
73
|
+
*/
|
|
74
|
+
export declare enum AppleMapsContourStyle {
|
|
75
|
+
/**
|
|
76
|
+
* A straight line.
|
|
77
|
+
*/
|
|
78
|
+
STRAIGHT = "STRAIGHT",
|
|
79
|
+
/**
|
|
80
|
+
* A geodesic line.
|
|
81
|
+
*/
|
|
82
|
+
GEODESIC = "GEODESIC"
|
|
83
|
+
}
|
|
66
84
|
/**
|
|
67
85
|
* @platform ios
|
|
68
86
|
*/
|
|
@@ -79,6 +97,13 @@ export type AppleMapsProperties = {
|
|
|
79
97
|
* If true, the user can select a location on the map to get more information.
|
|
80
98
|
*/
|
|
81
99
|
selectionEnabled?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The maximum distance in meters from a tap of a polyline for it to be considered a hit.
|
|
102
|
+
* If the distance is greater than the threshold, the polyline is not considered a hit.
|
|
103
|
+
* If a hit occurs, the `onPolylineClick` event will be triggered.
|
|
104
|
+
* Defaults to 20 meters.
|
|
105
|
+
*/
|
|
106
|
+
polylineTapThreshold?: number;
|
|
82
107
|
};
|
|
83
108
|
/**
|
|
84
109
|
* @platform ios
|
|
@@ -101,6 +126,28 @@ export type AppleMapsAnnotation = {
|
|
|
101
126
|
*/
|
|
102
127
|
icon?: SharedRefType<'image'>;
|
|
103
128
|
} & AppleMapsMarker;
|
|
129
|
+
export type AppleMapsPolyline = {
|
|
130
|
+
/**
|
|
131
|
+
* The unique identifier for the polyline. This can be used to e.g. identify the clicked polyline in the `onPolylineClick` event.
|
|
132
|
+
*/
|
|
133
|
+
id?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The coordinates of the polyline.
|
|
136
|
+
*/
|
|
137
|
+
coordinates: Coordinates[];
|
|
138
|
+
/**
|
|
139
|
+
* The color of the polyline.
|
|
140
|
+
*/
|
|
141
|
+
color?: ProcessedColorValue | string;
|
|
142
|
+
/**
|
|
143
|
+
* The width of the polyline.
|
|
144
|
+
*/
|
|
145
|
+
width?: number;
|
|
146
|
+
/**
|
|
147
|
+
* The style of the polyline.
|
|
148
|
+
*/
|
|
149
|
+
contourStyle?: AppleMapsContourStyle;
|
|
150
|
+
};
|
|
104
151
|
/**
|
|
105
152
|
* @platform ios
|
|
106
153
|
*/
|
|
@@ -115,6 +162,10 @@ export type AppleMapsViewProps = {
|
|
|
115
162
|
* The array of markers to display on the map.
|
|
116
163
|
*/
|
|
117
164
|
markers?: AppleMapsMarker[];
|
|
165
|
+
/**
|
|
166
|
+
* The array of polylines to display on the map.
|
|
167
|
+
*/
|
|
168
|
+
polylines?: AppleMapsPolyline[];
|
|
118
169
|
/**
|
|
119
170
|
* The array of annotations to display on the map.
|
|
120
171
|
*/
|
|
@@ -136,8 +187,14 @@ export type AppleMapsViewProps = {
|
|
|
136
187
|
}) => void;
|
|
137
188
|
/**
|
|
138
189
|
* Lambda invoked when the marker is clicked
|
|
190
|
+
* @platform ios 18.0+
|
|
139
191
|
*/
|
|
140
192
|
onMarkerClick?: (event: AppleMapsMarker) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Lambda invoked when the polyline is clicked
|
|
195
|
+
* @platform ios 18.0+
|
|
196
|
+
*/
|
|
197
|
+
onPolylineClick?: (event: AppleMapsPolyline) => void;
|
|
141
198
|
/**
|
|
142
199
|
* Lambda invoked when the map was moved by the user.
|
|
143
200
|
*/
|
|
@@ -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,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;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;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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":"
|
|
1
|
+
{"version":3,"file":"AppleMaps.types.js","sourceRoot":"","sources":["../../src/apple/AppleMaps.types.ts"],"names":[],"mappings":"AA8DA;;;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 unique identifier for the marker. This can be used to e.g. identify the clicked marker in the `onMarkerClick` event.\n */\n id?: string;\n\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 unique identifier for the polyline. This can be used to e.g. identify the clicked polyline in the `onPolylineClick` event.\n */\n id?: string;\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,OA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M,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,iBAAiB,GAAG,WAAW,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC1D,GAAG,UAAU;QACb,mBAAmB;QACnB,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,yBAAyB;KACjD,CAAC,CAAC,CAAC;IAEJ,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,CAAC,UAAU,CACT,IAAI,KAAK,CAAC,CACV,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,SAAS,CAAC,CAAC,eAAe,CAAC,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,11 +1,15 @@
|
|
|
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
|
|
7
7
|
*/
|
|
8
8
|
export type GoogleMapsMarker = {
|
|
9
|
+
/**
|
|
10
|
+
* The unique identifier for the marker. This can be used to e.g. identify the clicked marker in the `onMarkerClick` event.
|
|
11
|
+
*/
|
|
12
|
+
id?: string;
|
|
9
13
|
/**
|
|
10
14
|
* The coordinates of the marker.
|
|
11
15
|
*/
|
|
@@ -31,6 +35,31 @@ export type GoogleMapsMarker = {
|
|
|
31
35
|
*/
|
|
32
36
|
icon?: SharedRefType<'image'>;
|
|
33
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @platform android
|
|
40
|
+
*/
|
|
41
|
+
export type GoogleMapsPolyline = {
|
|
42
|
+
/**
|
|
43
|
+
* The unique identifier for the polyline. This can be used to e.g. identify the clicked polyline in the `onPolylineClick` event.
|
|
44
|
+
*/
|
|
45
|
+
id?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The coordinates of the polyline.
|
|
48
|
+
*/
|
|
49
|
+
coordinates: Coordinates[];
|
|
50
|
+
/**
|
|
51
|
+
* The color of the polyline.
|
|
52
|
+
*/
|
|
53
|
+
color?: ProcessedColorValue | string;
|
|
54
|
+
/**
|
|
55
|
+
* The width of the polyline.
|
|
56
|
+
*/
|
|
57
|
+
width?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the polyline is geodesic.
|
|
60
|
+
*/
|
|
61
|
+
geodesic?: boolean;
|
|
62
|
+
};
|
|
34
63
|
/**
|
|
35
64
|
* @platform android
|
|
36
65
|
*/
|
|
@@ -179,6 +208,10 @@ export type GoogleMapsViewProps = {
|
|
|
179
208
|
* The array of markers to display on the map.
|
|
180
209
|
*/
|
|
181
210
|
markers?: GoogleMapsMarker[];
|
|
211
|
+
/**
|
|
212
|
+
* The array of polylines to display on the map.
|
|
213
|
+
*/
|
|
214
|
+
polylines?: GoogleMapsPolyline[];
|
|
182
215
|
/**
|
|
183
216
|
* The `MapUiSettings` to be used for UI-specific settings on the map.
|
|
184
217
|
*/
|
|
@@ -223,6 +256,10 @@ export type GoogleMapsViewProps = {
|
|
|
223
256
|
* Lambda invoked when the marker is clicked
|
|
224
257
|
*/
|
|
225
258
|
onMarkerClick?: (event: GoogleMapsMarker) => void;
|
|
259
|
+
/**
|
|
260
|
+
* Lambda invoked when the polyline is clicked.
|
|
261
|
+
*/
|
|
262
|
+
onPolylineClick?: (event: GoogleMapsPolyline) => void;
|
|
226
263
|
/**
|
|
227
264
|
* Lambda invoked when the map was moved by the user.
|
|
228
265
|
*/
|
|
@@ -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,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC/B,CA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AS,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":"AA6JA;;;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 unique identifier for the marker. This can be used to e.g. identify the clicked marker in the `onMarkerClick` event.\n */\n id?: 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 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 unique identifier for the polyline. This can be used to e.g. identify the clicked polyline in the `onPolylineClick` event.\n */\n id?: string;\n\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":"A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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"]}
|