react-native-google-maps-plus 1.6.1 → 1.6.2
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/android/build.gradle +2 -0
- package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +3 -0
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +9 -2
- package/android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt +28 -24
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNCameraExtension.kt +9 -13
- package/ios/GoogleMapViewImpl.swift +2 -2
- package/ios/MapHelper.swift +11 -9
- package/ios/RNGoogleMapsPlusView.swift +4 -4
- package/ios/extensions/RNCamera+Extension.swift +2 -2
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -44,6 +44,8 @@ android {
|
|
|
44
44
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
45
45
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
46
46
|
|
|
47
|
+
consumerProguardFiles "proguard-rules.pro"
|
|
48
|
+
|
|
47
49
|
externalNativeBuild {
|
|
48
50
|
cmake {
|
|
49
51
|
cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
|
|
@@ -45,7 +45,7 @@ class RNGoogleMapsPlusView(
|
|
|
45
45
|
GoogleMapOptions().apply {
|
|
46
46
|
initialProps?.mapId?.let { mapId(it) }
|
|
47
47
|
initialProps?.liteMode?.let { liteMode(it) }
|
|
48
|
-
initialProps?.camera?.let { camera(it.toCameraPosition()) }
|
|
48
|
+
initialProps?.camera?.let { camera(it.toCameraPosition(current = null)) }
|
|
49
49
|
}
|
|
50
50
|
view.initMapView(options)
|
|
51
51
|
}
|
|
@@ -361,7 +361,14 @@ class RNGoogleMapsPlusView(
|
|
|
361
361
|
animated: Boolean?,
|
|
362
362
|
durationMs: Double?,
|
|
363
363
|
) {
|
|
364
|
-
|
|
364
|
+
onUi {
|
|
365
|
+
val current = view.currentCamera
|
|
366
|
+
view.setCamera(
|
|
367
|
+
camera.toCameraPosition(current),
|
|
368
|
+
animated == true,
|
|
369
|
+
durationMs?.toInt() ?: 3000,
|
|
370
|
+
)
|
|
371
|
+
}
|
|
365
372
|
}
|
|
366
373
|
|
|
367
374
|
override fun setCameraToCoordinates(
|
|
@@ -19,40 +19,44 @@ fun Location.toRnLocation(): RNLocation =
|
|
|
19
19
|
provider = provider,
|
|
20
20
|
elapsedRealtimeNanos = elapsedRealtimeNanos.toDouble(),
|
|
21
21
|
bearingAccuracyDegrees =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
when {
|
|
23
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
|
|
24
|
+
bearingAccuracyDegrees.toDouble()
|
|
25
|
+
|
|
26
|
+
else -> null
|
|
26
27
|
},
|
|
27
28
|
speedAccuracyMetersPerSecond =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
when {
|
|
30
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
|
|
31
|
+
speedAccuracyMetersPerSecond.toDouble()
|
|
32
|
+
|
|
33
|
+
else -> null
|
|
32
34
|
},
|
|
33
35
|
verticalAccuracyMeters =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
when {
|
|
37
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
|
|
38
|
+
verticalAccuracyMeters.toDouble()
|
|
39
|
+
|
|
40
|
+
else -> null
|
|
38
41
|
},
|
|
39
42
|
mslAltitudeMeters =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
when {
|
|
44
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
|
|
45
|
+
mslAltitudeMeters
|
|
46
|
+
|
|
47
|
+
else -> null
|
|
44
48
|
},
|
|
45
49
|
mslAltitudeAccuracyMeters =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
when {
|
|
51
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
|
|
52
|
+
mslAltitudeAccuracyMeters.toDouble()
|
|
53
|
+
|
|
54
|
+
else -> null
|
|
50
55
|
},
|
|
51
56
|
isMock =
|
|
52
|
-
|
|
53
|
-
isMock
|
|
54
|
-
|
|
55
|
-
isFromMockProvider
|
|
57
|
+
when {
|
|
58
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> isMock
|
|
59
|
+
else -> isFromMockProvider
|
|
56
60
|
},
|
|
57
61
|
),
|
|
58
62
|
ios = null,
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
package com.rngooglemapsplus.extensions
|
|
2
2
|
|
|
3
3
|
import com.google.android.gms.maps.model.CameraPosition
|
|
4
|
+
import com.google.android.gms.maps.model.LatLng
|
|
4
5
|
import com.rngooglemapsplus.RNCamera
|
|
5
6
|
|
|
6
|
-
fun RNCamera.toCameraPosition(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bearing?.let { builder.bearing(it.toFloat()) }
|
|
15
|
-
tilt?.let { builder.tilt(it.toFloat()) }
|
|
16
|
-
|
|
17
|
-
return builder.build()
|
|
18
|
-
}
|
|
7
|
+
fun RNCamera.toCameraPosition(current: CameraPosition?) =
|
|
8
|
+
CameraPosition
|
|
9
|
+
.builder()
|
|
10
|
+
.target(center?.toLatLng() ?: current?.target ?: LatLng(0.0, 0.0))
|
|
11
|
+
.zoom(zoom?.toFloat() ?: current?.zoom ?: 0f)
|
|
12
|
+
.bearing(bearing?.toFloat() ?: current?.bearing ?: 0f)
|
|
13
|
+
.tilt(tilt?.toFloat() ?: current?.tilt ?: 0f)
|
|
14
|
+
.build()
|
|
@@ -278,7 +278,7 @@ GMSIndoorDisplayDelegate {
|
|
|
278
278
|
disableActions: false,
|
|
279
279
|
duration: durationMs / 1000.0
|
|
280
280
|
) {
|
|
281
|
-
mapView?.animate(to: camera)
|
|
281
|
+
self.mapView?.animate(to: camera)
|
|
282
282
|
}
|
|
283
283
|
} else {
|
|
284
284
|
let update = GMSCameraUpdate.setCamera(camera)
|
|
@@ -318,7 +318,7 @@ GMSIndoorDisplayDelegate {
|
|
|
318
318
|
disableActions: false,
|
|
319
319
|
duration: durationMs / 1000.0
|
|
320
320
|
) {
|
|
321
|
-
mapView?.animate(with: update)
|
|
321
|
+
self.mapView?.animate(with: update)
|
|
322
322
|
}
|
|
323
323
|
} else {
|
|
324
324
|
mapView?.moveCamera(update)
|
package/ios/MapHelper.swift
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import QuartzCore
|
|
2
2
|
|
|
3
|
-
@inline(__always)
|
|
3
|
+
@MainActor @inline(__always)
|
|
4
4
|
func withCATransaction(
|
|
5
5
|
disableActions: Bool = true,
|
|
6
6
|
duration: CFTimeInterval? = nil,
|
|
7
7
|
timingFunction: CAMediaTimingFunction? = nil,
|
|
8
8
|
completion: (() -> Void)? = nil,
|
|
9
|
-
_ body: () -> Void
|
|
9
|
+
_ body: @escaping @MainActor () -> Void
|
|
10
10
|
) {
|
|
11
|
-
|
|
11
|
+
onMain {
|
|
12
|
+
CATransaction.begin()
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
CATransaction.setDisableActions(disableActions)
|
|
15
|
+
duration.map { CATransaction.setAnimationDuration($0) }
|
|
16
|
+
timingFunction.map { CATransaction.setAnimationTimingFunction($0) }
|
|
17
|
+
completion.map { CATransaction.setCompletionBlock($0) }
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
body()
|
|
20
|
+
CATransaction.commit()
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
@MainActor @inline(__always)
|
|
@@ -132,19 +132,19 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
132
132
|
withCATransaction(disableActions: true) {
|
|
133
133
|
|
|
134
134
|
removed.forEach {
|
|
135
|
-
impl.removeMarker(id: $0)
|
|
136
|
-
markerBuilder.cancelIconTask($0)
|
|
135
|
+
self.impl.removeMarker(id: $0)
|
|
136
|
+
self.markerBuilder.cancelIconTask($0)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
for (id, next) in nextById {
|
|
140
140
|
if let prev = prevById[id] {
|
|
141
141
|
if !prev.markerEquals(next) {
|
|
142
|
-
impl.updateMarker(id: id) { m in
|
|
142
|
+
self.impl.updateMarker(id: id) { m in
|
|
143
143
|
self.markerBuilder.update(prev, next, m)
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
} else {
|
|
147
|
-
markerBuilder.buildIconAsync(next.id, next) { icon in
|
|
147
|
+
self.markerBuilder.buildIconAsync(next.id, next) { icon in
|
|
148
148
|
let marker = self.markerBuilder.build(next, icon: icon)
|
|
149
149
|
self.impl.addMarker(id: id, marker: marker)
|
|
150
150
|
}
|
|
@@ -4,8 +4,8 @@ import GoogleMaps
|
|
|
4
4
|
extension RNCamera {
|
|
5
5
|
func toGMSCameraPosition(current: GMSCameraPosition?) -> GMSCameraPosition {
|
|
6
6
|
let center = CLLocationCoordinate2D(
|
|
7
|
-
latitude: center?.latitude ?? current?.target.latitude ?? 0,
|
|
8
|
-
longitude: center?.longitude ?? current?.target.longitude ?? 0
|
|
7
|
+
latitude: center?.latitude ?? current?.target.latitude ?? 0.0,
|
|
8
|
+
longitude: center?.longitude ?? current?.target.longitude ?? 0.0
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
let zoom = Float(zoom ?? Double(current?.zoom ?? 0))
|