react-native-google-maps-plus 1.6.1-dev.1 → 1.6.1-dev.3
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 +2 -0
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +9 -2
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNCameraExtension.kt +3 -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 ?: return@onUi
|
|
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(
|
|
@@ -1,14 +1,13 @@
|
|
|
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(): CameraPosition {
|
|
7
|
+
fun RNCamera.toCameraPosition(current: CameraPosition?): CameraPosition {
|
|
7
8
|
val builder = CameraPosition.builder()
|
|
8
9
|
|
|
9
|
-
center?.
|
|
10
|
-
builder.target(it.toLatLng())
|
|
11
|
-
}
|
|
10
|
+
builder.target(center?.toLatLng() ?: current?.target ?: LatLng(0.0, 0.0))
|
|
12
11
|
|
|
13
12
|
zoom?.let { builder.zoom(it.toFloat()) }
|
|
14
13
|
bearing?.let { builder.bearing(it.toFloat()) }
|
|
@@ -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))
|
package/package.json
CHANGED