react-native-google-maps-plus 1.6.1-dev.2 → 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.
@@ -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"
@@ -250,6 +250,8 @@ class GoogleMapsViewImpl(
250
250
  }
251
251
  }
252
252
 
253
+ val currentCamera: CameraPosition? = googleMap?.cameraPosition
254
+
253
255
  var initialProps: RNInitialProps? = null
254
256
 
255
257
  var uiSettings: RNMapUiSettings? = null
@@ -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
- view.setCamera(camera.toCameraPosition(), animated == true, durationMs?.toInt() ?: 3000)
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?.let {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-maps-plus",
3
- "version": "1.6.1-dev.2",
3
+ "version": "1.6.1-dev.3",
4
4
  "description": "React Native wrapper for Android & iOS Google Maps SDK",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",