react-native-google-maps-plus 1.6.1 → 1.7.0-dev.1

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.
Files changed (31) hide show
  1. package/android/build.gradle +2 -0
  2. package/android/proguard-rules.pro +29 -0
  3. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +15 -2
  4. package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +2 -0
  5. package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +39 -0
  6. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +19 -2
  7. package/android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt +28 -24
  8. package/android/src/main/java/com/rngooglemapsplus/extensions/RNCameraExtension.kt +9 -13
  9. package/ios/GoogleMapViewImpl.swift +22 -4
  10. package/ios/MapHelper.swift +11 -9
  11. package/ios/RNGoogleMapsPlusView.swift +12 -4
  12. package/ios/extensions/RNCamera+Extension.swift +2 -2
  13. package/lib/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +2 -0
  14. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +2 -0
  15. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
  16. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +38 -0
  17. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +4 -0
  18. package/nitrogen/generated/android/c++/views/JHybridRNGoogleMapsPlusViewStateUpdater.cpp +8 -0
  19. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +28 -0
  20. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +15 -0
  21. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +14 -0
  22. package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +10 -0
  23. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +2 -0
  24. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +64 -0
  25. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.cpp +4 -0
  26. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +4 -0
  27. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.cpp +24 -0
  28. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.hpp +2 -0
  29. package/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +2 -0
  30. package/package.json +5 -4
  31. package/src/RNGoogleMapsPlusView.nitro.ts +2 -0
@@ -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"
@@ -0,0 +1,29 @@
1
+ -keep class com.google.android.gms.** { *; }
2
+ -keep interface com.google.android.gms.** { *; }
3
+ -dontwarn com.google.android.gms.**
4
+ -dontnote com.google.android.gms.**
5
+
6
+ -keep class * implements android.os.Parcelable { *; }
7
+
8
+ -keepclassmembers class **$Companion {
9
+ public *;
10
+ }
11
+
12
+ -keep class com.google.maps.android.** { *; }
13
+ -keep interface com.google.maps.android.** { *; }
14
+ -dontwarn com.google.maps.android.**
15
+
16
+ -keep @androidx.annotation.Keep class * { *; }
17
+ -keepclassmembers class * {
18
+ @androidx.annotation.Keep *;
19
+ }
20
+
21
+ -keep class com.caverock.androidsvg.** { *; }
22
+ -dontwarn com.caverock.androidsvg.**
23
+
24
+ -keepclassmembers class com.caverock.androidsvg.** {
25
+ public *;
26
+ protected *;
27
+ }
28
+
29
+ -keep class com.rngooglemapsplus.** { *; }
@@ -58,6 +58,7 @@ class GoogleMapsViewImpl(
58
58
  GoogleMap.OnCameraMoveListener,
59
59
  GoogleMap.OnCameraIdleListener,
60
60
  GoogleMap.OnMapClickListener,
61
+ GoogleMap.OnMapLongClickListener,
61
62
  GoogleMap.OnMarkerClickListener,
62
63
  GoogleMap.OnPolylineClickListener,
63
64
  GoogleMap.OnPolygonClickListener,
@@ -66,7 +67,6 @@ class GoogleMapsViewImpl(
66
67
  GoogleMap.OnIndoorStateChangeListener,
67
68
  LifecycleEventListener {
68
69
  private var initialized = false
69
- private var mapReady = false
70
70
  private var destroyed = false
71
71
  private var googleMap: GoogleMap? = null
72
72
  private var mapView: MapView? = null
@@ -128,11 +128,12 @@ class GoogleMapsViewImpl(
128
128
  googleMap?.setOnPolygonClickListener(this@GoogleMapsViewImpl)
129
129
  googleMap?.setOnCircleClickListener(this@GoogleMapsViewImpl)
130
130
  googleMap?.setOnMapClickListener(this@GoogleMapsViewImpl)
131
+ googleMap?.setOnMapLongClickListener(this@GoogleMapsViewImpl)
131
132
  googleMap?.setOnMarkerDragListener(this@GoogleMapsViewImpl)
133
+ onMapLoaded?.invoke(true)
132
134
  }
133
135
  applyProps()
134
136
  initLocationCallbacks()
135
- mapReady = true
136
137
  onMapReady?.invoke(true)
137
138
  }
138
139
  }
@@ -250,6 +251,9 @@ class GoogleMapsViewImpl(
250
251
  }
251
252
  }
252
253
 
254
+ val currentCamera: CameraPosition?
255
+ get() = googleMap?.cameraPosition
256
+
253
257
  var initialProps: RNInitialProps? = null
254
258
 
255
259
  var uiSettings: RNMapUiSettings? = null
@@ -375,9 +379,11 @@ class GoogleMapsViewImpl(
375
379
 
376
380
  var onMapError: ((RNMapErrorCode) -> Unit)? = null
377
381
  var onMapReady: ((Boolean) -> Unit)? = null
382
+ var onMapLoaded: ((Boolean) -> Unit)? = null
378
383
  var onLocationUpdate: ((RNLocation) -> Unit)? = null
379
384
  var onLocationError: ((RNLocationErrorCode) -> Unit)? = null
380
385
  var onMapPress: ((RNLatLng) -> Unit)? = null
386
+ var onMapLongPress: ((RNLatLng) -> Unit)? = null
381
387
  var onMarkerPress: ((String?) -> Unit)? = null
382
388
  var onPolylinePress: ((String?) -> Unit)? = null
383
389
  var onPolygonPress: ((String?) -> Unit)? = null
@@ -871,6 +877,7 @@ class GoogleMapsViewImpl(
871
877
  setOnPolygonClickListener(null)
872
878
  setOnCircleClickListener(null)
873
879
  setOnMapClickListener(null)
880
+ setOnMapLongClickListener(null)
874
881
  setOnMarkerDragListener(null)
875
882
  }
876
883
  googleMap = null
@@ -950,6 +957,12 @@ class GoogleMapsViewImpl(
950
957
  )
951
958
  }
952
959
 
960
+ override fun onMapLongClick(coordinates: LatLng) {
961
+ onMapLongPress?.invoke(
962
+ coordinates.toRnLatLng(),
963
+ )
964
+ }
965
+
953
966
  override fun onMarkerDragStart(marker: Marker) {
954
967
  onMarkerDragStart?.invoke(
955
968
  marker.tag?.toString(),
@@ -57,6 +57,8 @@ class LocationHandler(
57
57
  this.interval = interval ?: INTERVAL_DEFAULT
58
58
  this.minUpdateInterval = minUpdateInterval ?: MIN_UPDATE_INTERVAL
59
59
  buildLocationRequest(this.priority, this.interval, this.minUpdateInterval)
60
+ stop()
61
+ start()
60
62
  }
61
63
 
62
64
  fun showLocationDialog() {
@@ -2,9 +2,11 @@ package com.rngooglemapsplus
2
2
 
3
3
  import android.graphics.Bitmap
4
4
  import android.graphics.Canvas
5
+ import android.util.Base64
5
6
  import android.util.LruCache
6
7
  import androidx.core.graphics.createBitmap
7
8
  import com.caverock.androidsvg.SVG
9
+ import com.caverock.androidsvg.SVGExternalFileResolver
8
10
  import com.facebook.react.uimanager.PixelUtil.dpToPx
9
11
  import com.google.android.gms.maps.model.BitmapDescriptor
10
12
  import com.google.android.gms.maps.model.BitmapDescriptorFactory
@@ -20,6 +22,7 @@ import kotlinx.coroutines.SupervisorJob
20
22
  import kotlinx.coroutines.ensureActive
21
23
  import kotlinx.coroutines.launch
22
24
  import kotlinx.coroutines.withContext
25
+ import java.net.URLDecoder
23
26
  import kotlin.coroutines.coroutineContext
24
27
 
25
28
  class MapMarkerBuilder(
@@ -35,6 +38,42 @@ class MapMarkerBuilder(
35
38
 
36
39
  private val jobsById = mutableMapOf<String, Job>()
37
40
 
41
+ init {
42
+ SVG.registerExternalFileResolver(
43
+ object : SVGExternalFileResolver() {
44
+ override fun resolveImage(filename: String?): Bitmap? {
45
+ if (filename.isNullOrBlank()) return null
46
+
47
+ return runCatching {
48
+ when {
49
+ filename.startsWith("data:image/svg+xml") -> {
50
+ val svgContent =
51
+ if ("base64," in filename) {
52
+ val base64 = filename.substringAfter("base64,")
53
+ String(Base64.decode(base64, Base64.DEFAULT), Charsets.UTF_8)
54
+ } else {
55
+ URLDecoder.decode(filename.substringAfter(","), "UTF-8")
56
+ }
57
+
58
+ val svg = SVG.getFromString(svgContent)
59
+ val width = (svg.documentWidth.takeIf { it > 0 } ?: 128f).toInt()
60
+ val height = (svg.documentHeight.takeIf { it > 0 } ?: 128f).toInt()
61
+
62
+ createBitmap(width, height).apply {
63
+ Canvas(this).also(svg::renderToCanvas)
64
+ }
65
+ }
66
+
67
+ else -> null
68
+ }
69
+ }.getOrNull()
70
+ }
71
+
72
+ override fun isFormatSupported(mimeType: String?): Boolean = mimeType?.startsWith("image/") == true
73
+ },
74
+ )
75
+ }
76
+
38
77
  fun build(
39
78
  m: RNMarker,
40
79
  icon: BitmapDescriptor?,
@@ -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
  }
@@ -281,6 +281,11 @@ class RNGoogleMapsPlusView(
281
281
  view.onMapReady = cb
282
282
  }
283
283
 
284
+ override var onMapLoaded: ((Boolean) -> Unit)? = null
285
+ set(cb) {
286
+ view.onMapLoaded = cb
287
+ }
288
+
284
289
  override var onLocationUpdate: ((RNLocation) -> Unit)? = null
285
290
  set(cb) {
286
291
  view.onLocationUpdate = cb
@@ -296,6 +301,11 @@ class RNGoogleMapsPlusView(
296
301
  view.onMapPress = cb
297
302
  }
298
303
 
304
+ override var onMapLongPress: ((RNLatLng) -> Unit)? = null
305
+ set(cb) {
306
+ view.onMapLongPress = cb
307
+ }
308
+
299
309
  override var onMarkerPress: ((String?) -> Unit)? = null
300
310
  set(cb) {
301
311
  view.onMarkerPress = cb
@@ -361,7 +371,14 @@ class RNGoogleMapsPlusView(
361
371
  animated: Boolean?,
362
372
  durationMs: Double?,
363
373
  ) {
364
- view.setCamera(camera.toCameraPosition(), animated == true, durationMs?.toInt() ?: 3000)
374
+ onUi {
375
+ val current = view.currentCamera
376
+ view.setCamera(
377
+ camera.toCameraPosition(current),
378
+ animated == true,
379
+ durationMs?.toInt() ?: 3000,
380
+ )
381
+ }
365
382
  }
366
383
 
367
384
  override fun setCameraToCoordinates(
@@ -19,40 +19,44 @@ fun Location.toRnLocation(): RNLocation =
19
19
  provider = provider,
20
20
  elapsedRealtimeNanos = elapsedRealtimeNanos.toDouble(),
21
21
  bearingAccuracyDegrees =
22
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
23
- bearingAccuracyDegrees.toDouble()
24
- } else {
25
- null
22
+ when {
23
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
24
+ bearingAccuracyDegrees.toDouble()
25
+
26
+ else -> null
26
27
  },
27
28
  speedAccuracyMetersPerSecond =
28
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
29
- speedAccuracyMetersPerSecond.toDouble()
30
- } else {
31
- null
29
+ when {
30
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
31
+ speedAccuracyMetersPerSecond.toDouble()
32
+
33
+ else -> null
32
34
  },
33
35
  verticalAccuracyMeters =
34
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
35
- verticalAccuracyMeters.toDouble()
36
- } else {
37
- null
36
+ when {
37
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
38
+ verticalAccuracyMeters.toDouble()
39
+
40
+ else -> null
38
41
  },
39
42
  mslAltitudeMeters =
40
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
41
- mslAltitudeMeters
42
- } else {
43
- null
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
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
47
- mslAltitudeAccuracyMeters.toDouble()
48
- } else {
49
- null
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
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
53
- isMock
54
- } else {
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(): CameraPosition {
7
- val builder = CameraPosition.builder()
8
-
9
- center?.let {
10
- builder.target(it.toLatLng())
11
- }
12
-
13
- zoom?.let { builder.zoom(it.toFloat()) }
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()
@@ -10,7 +10,7 @@ GMSIndoorDisplayDelegate {
10
10
  private let markerBuilder: MapMarkerBuilder
11
11
  private var mapView: GMSMapView?
12
12
  private var initialized = false
13
- private var mapReady = false
13
+ private var loaded = false
14
14
  private var deInitialized = false
15
15
 
16
16
  private var pendingMarkers: [(id: String, marker: GMSMarker)] = []
@@ -75,7 +75,6 @@ GMSIndoorDisplayDelegate {
75
75
  applyProps()
76
76
  initLocationCallbacks()
77
77
  onMapReady?(true)
78
- mapReady = true
79
78
  }
80
79
 
81
80
  @MainActor
@@ -255,9 +254,11 @@ GMSIndoorDisplayDelegate {
255
254
 
256
255
  var onMapError: ((RNMapErrorCode) -> Void)?
257
256
  var onMapReady: ((Bool) -> Void)?
257
+ var onMapLoaded: ((Bool) -> Void)?
258
258
  var onLocationUpdate: ((RNLocation) -> Void)?
259
259
  var onLocationError: ((_ error: RNLocationErrorCode) -> Void)?
260
260
  var onMapPress: ((RNLatLng) -> Void)?
261
+ var onMapLongPress: ((RNLatLng) -> Void)?
261
262
  var onMarkerPress: ((String?) -> Void)?
262
263
  var onPolylinePress: ((String?) -> Void)?
263
264
  var onPolygonPress: ((String?) -> Void)?
@@ -278,7 +279,7 @@ GMSIndoorDisplayDelegate {
278
279
  disableActions: false,
279
280
  duration: durationMs / 1000.0
280
281
  ) {
281
- mapView?.animate(to: camera)
282
+ self.mapView?.animate(to: camera)
282
283
  }
283
284
  } else {
284
285
  let update = GMSCameraUpdate.setCamera(camera)
@@ -318,7 +319,7 @@ GMSIndoorDisplayDelegate {
318
319
  disableActions: false,
319
320
  duration: durationMs / 1000.0
320
321
  ) {
321
- mapView?.animate(with: update)
322
+ self.mapView?.animate(with: update)
322
323
  }
323
324
  } else {
324
325
  mapView?.moveCamera(update)
@@ -655,6 +656,12 @@ GMSIndoorDisplayDelegate {
655
656
  deinitInternal()
656
657
  }
657
658
 
659
+ func mapViewDidFinishTileRendering(_ mapView: GMSMapView) {
660
+ guard !loaded else { return }
661
+ loaded = true
662
+ onMapLoaded?(true)
663
+ }
664
+
658
665
  func mapView(_ mapView: GMSMapView, willMove gesture: Bool) {
659
666
  onMain {
660
667
  self.cameraMoveReasonIsGesture = gesture
@@ -713,6 +720,17 @@ GMSIndoorDisplayDelegate {
713
720
  }
714
721
  }
715
722
 
723
+ func mapView(
724
+ _ mapView: GMSMapView,
725
+ didLongPressAt coordinate: CLLocationCoordinate2D
726
+ ) {
727
+ onMain {
728
+ self.onMapLongPress?(
729
+ coordinate.toRNLatLng(),
730
+ )
731
+ }
732
+ }
733
+
716
734
  func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
717
735
  onMain {
718
736
  mapView.selectedMarker = marker
@@ -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
- CATransaction.begin()
11
+ onMain {
12
+ CATransaction.begin()
12
13
 
13
- CATransaction.setDisableActions(disableActions)
14
- duration.map { CATransaction.setAnimationDuration($0) }
15
- timingFunction.map { CATransaction.setAnimationTimingFunction($0) }
16
- completion.map { CATransaction.setCompletionBlock($0) }
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
- body()
19
- CATransaction.commit()
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
  }
@@ -302,6 +302,10 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
302
302
  didSet { impl.onMapReady = onMapReady }
303
303
  }
304
304
  @MainActor
305
+ var onMapLoaded: ((Bool) -> Void)? {
306
+ didSet { impl.onMapLoaded = onMapLoaded }
307
+ }
308
+ @MainActor
305
309
  var onLocationUpdate: ((RNLocation) -> Void)? {
306
310
  didSet { impl.onLocationUpdate = onLocationUpdate }
307
311
  }
@@ -314,6 +318,10 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
314
318
  didSet { impl.onMapPress = onMapPress }
315
319
  }
316
320
  @MainActor
321
+ var onMapLongPress: ((RNLatLng) -> Void)? {
322
+ didSet { impl.onMapLongPress = onMapLongPress }
323
+ }
324
+ @MainActor
317
325
  var onMarkerPress: ((String?) -> Void)? {
318
326
  didSet { impl.onMarkerPress = onMarkerPress }
319
327
  }
@@ -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))
@@ -24,9 +24,11 @@
24
24
  "locationConfig": true,
25
25
  "onMapError": true,
26
26
  "onMapReady": true,
27
+ "onMapLoaded": true,
27
28
  "onLocationUpdate": true,
28
29
  "onLocationError": true,
29
30
  "onMapPress": true,
31
+ "onMapLongPress": true,
30
32
  "onMarkerPress": true,
31
33
  "onPolylinePress": true,
32
34
  "onPolygonPress": true,
@@ -21,9 +21,11 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
21
21
  locationConfig?: RNLocationConfig;
22
22
  onMapError?: (error: RNMapErrorCode) => void;
23
23
  onMapReady?: (ready: boolean) => void;
24
+ onMapLoaded?: (loaded: boolean) => void;
24
25
  onLocationUpdate?: (location: RNLocation) => void;
25
26
  onLocationError?: (error: RNLocationErrorCode) => void;
26
27
  onMapPress?: (coordinate: RNLatLng) => void;
28
+ onMapLongPress?: (coordinate: RNLatLng) => void;
27
29
  onMarkerPress?: (id?: string | undefined) => void;
28
30
  onPolylinePress?: (id?: string | undefined) => void;
29
31
  onPolygonPress?: (id?: string | undefined) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"RNGoogleMapsPlusView.nitro.d.ts","sourceRoot":"","sources":["../../../src/RNGoogleMapsPlusView.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,QAAQ,E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,CAAC,EAAE,CACvB,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,OAAO,KACf,IAAI,CAAC;CACX;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3E,sBAAsB,CACpB,WAAW,EAAE,QAAQ,EAAE,EACvB,OAAO,CAAC,EAAE,YAAY,EACtB,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAAC;IAER,eAAe,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAE/C,eAAe,CACb,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,OAAO,GACnB,IAAI,CAAC;IAER,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAElE,kBAAkB,IAAI,IAAI,CAAC;IAE3B,oBAAoB,IAAI,IAAI,CAAC;IAE7B,yBAAyB,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEjE,6BAA6B,IAAI,OAAO,CAAC;CAC1C;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAC3C,yBAAyB,EACzB,2BAA2B,CAC5B,CAAC"}
@@ -518,6 +518,25 @@ namespace margelo::nitro::rngooglemapsplus {
518
518
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* onMapReady */)>("setOnMapReady_cxx");
519
519
  method(_javaPart, onMapReady.has_value() ? JFunc_void_bool_cxx::fromCpp(onMapReady.value()) : nullptr);
520
520
  }
521
+ std::optional<std::function<void(bool /* loaded */)>> JHybridRNGoogleMapsPlusViewSpec::getOnMapLoaded() {
522
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnMapLoaded_cxx");
523
+ auto __result = method(_javaPart);
524
+ return __result != nullptr ? std::make_optional([&]() -> std::function<void(bool /* loaded */)> {
525
+ if (__result->isInstanceOf(JFunc_void_bool_cxx::javaClassStatic())) [[likely]] {
526
+ auto downcast = jni::static_ref_cast<JFunc_void_bool_cxx::javaobject>(__result);
527
+ return downcast->cthis()->getFunction();
528
+ } else {
529
+ auto __resultRef = jni::make_global(__result);
530
+ return [__resultRef](bool loaded) -> void {
531
+ return __resultRef->invoke(loaded);
532
+ };
533
+ }
534
+ }()) : std::nullopt;
535
+ }
536
+ void JHybridRNGoogleMapsPlusViewSpec::setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) {
537
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* onMapLoaded */)>("setOnMapLoaded_cxx");
538
+ method(_javaPart, onMapLoaded.has_value() ? JFunc_void_bool_cxx::fromCpp(onMapLoaded.value()) : nullptr);
539
+ }
521
540
  std::optional<std::function<void(const RNLocation& /* location */)>> JHybridRNGoogleMapsPlusViewSpec::getOnLocationUpdate() {
522
541
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_RNLocation::javaobject>()>("getOnLocationUpdate_cxx");
523
542
  auto __result = method(_javaPart);
@@ -575,6 +594,25 @@ namespace margelo::nitro::rngooglemapsplus {
575
594
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_RNLatLng::javaobject> /* onMapPress */)>("setOnMapPress_cxx");
576
595
  method(_javaPart, onMapPress.has_value() ? JFunc_void_RNLatLng_cxx::fromCpp(onMapPress.value()) : nullptr);
577
596
  }
597
+ std::optional<std::function<void(const RNLatLng& /* coordinate */)>> JHybridRNGoogleMapsPlusViewSpec::getOnMapLongPress() {
598
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_RNLatLng::javaobject>()>("getOnMapLongPress_cxx");
599
+ auto __result = method(_javaPart);
600
+ return __result != nullptr ? std::make_optional([&]() -> std::function<void(const RNLatLng& /* coordinate */)> {
601
+ if (__result->isInstanceOf(JFunc_void_RNLatLng_cxx::javaClassStatic())) [[likely]] {
602
+ auto downcast = jni::static_ref_cast<JFunc_void_RNLatLng_cxx::javaobject>(__result);
603
+ return downcast->cthis()->getFunction();
604
+ } else {
605
+ auto __resultRef = jni::make_global(__result);
606
+ return [__resultRef](RNLatLng coordinate) -> void {
607
+ return __resultRef->invoke(coordinate);
608
+ };
609
+ }
610
+ }()) : std::nullopt;
611
+ }
612
+ void JHybridRNGoogleMapsPlusViewSpec::setOnMapLongPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapLongPress) {
613
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_RNLatLng::javaobject> /* onMapLongPress */)>("setOnMapLongPress_cxx");
614
+ method(_javaPart, onMapLongPress.has_value() ? JFunc_void_RNLatLng_cxx::fromCpp(onMapLongPress.value()) : nullptr);
615
+ }
578
616
  std::optional<std::function<void(const std::optional<std::string>& /* id */)>> JHybridRNGoogleMapsPlusViewSpec::getOnMarkerPress() {
579
617
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__optional_std__string_::javaobject>()>("getOnMarkerPress_cxx");
580
618
  auto __result = method(_javaPart);
@@ -89,12 +89,16 @@ namespace margelo::nitro::rngooglemapsplus {
89
89
  void setOnMapError(const std::optional<std::function<void(RNMapErrorCode /* error */)>>& onMapError) override;
90
90
  std::optional<std::function<void(bool /* ready */)>> getOnMapReady() override;
91
91
  void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) override;
92
+ std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() override;
93
+ void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) override;
92
94
  std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() override;
93
95
  void setOnLocationUpdate(const std::optional<std::function<void(const RNLocation& /* location */)>>& onLocationUpdate) override;
94
96
  std::optional<std::function<void(RNLocationErrorCode /* error */)>> getOnLocationError() override;
95
97
  void setOnLocationError(const std::optional<std::function<void(RNLocationErrorCode /* error */)>>& onLocationError) override;
96
98
  std::optional<std::function<void(const RNLatLng& /* coordinate */)>> getOnMapPress() override;
97
99
  void setOnMapPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapPress) override;
100
+ std::optional<std::function<void(const RNLatLng& /* coordinate */)>> getOnMapLongPress() override;
101
+ void setOnMapLongPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapLongPress) override;
98
102
  std::optional<std::function<void(const std::optional<std::string>& /* id */)>> getOnMarkerPress() override;
99
103
  void setOnMarkerPress(const std::optional<std::function<void(const std::optional<std::string>& /* id */)>>& onMarkerPress) override;
100
104
  std::optional<std::function<void(const std::optional<std::string>& /* id */)>> getOnPolylinePress() override;
@@ -116,6 +116,10 @@ void JHybridRNGoogleMapsPlusViewStateUpdater::updateViewProps(jni::alias_ref<jni
116
116
  view->setOnMapReady(props.onMapReady.value);
117
117
  // TODO: Set isDirty = false
118
118
  }
119
+ if (props.onMapLoaded.isDirty) {
120
+ view->setOnMapLoaded(props.onMapLoaded.value);
121
+ // TODO: Set isDirty = false
122
+ }
119
123
  if (props.onLocationUpdate.isDirty) {
120
124
  view->setOnLocationUpdate(props.onLocationUpdate.value);
121
125
  // TODO: Set isDirty = false
@@ -128,6 +132,10 @@ void JHybridRNGoogleMapsPlusViewStateUpdater::updateViewProps(jni::alias_ref<jni
128
132
  view->setOnMapPress(props.onMapPress.value);
129
133
  // TODO: Set isDirty = false
130
134
  }
135
+ if (props.onMapLongPress.isDirty) {
136
+ view->setOnMapLongPress(props.onMapLongPress.value);
137
+ // TODO: Set isDirty = false
138
+ }
131
139
  if (props.onMarkerPress.isDirty) {
132
140
  view->setOnMarkerPress(props.onMarkerPress.value);
133
141
  // TODO: Set isDirty = false
@@ -174,6 +174,20 @@ abstract class HybridRNGoogleMapsPlusViewSpec: HybridView() {
174
174
  onMapReady = value?.let { it }
175
175
  }
176
176
 
177
+ abstract var onMapLoaded: ((loaded: Boolean) -> Unit)?
178
+
179
+ private var onMapLoaded_cxx: Func_void_bool?
180
+ @Keep
181
+ @DoNotStrip
182
+ get() {
183
+ return onMapLoaded?.let { Func_void_bool_java(it) }
184
+ }
185
+ @Keep
186
+ @DoNotStrip
187
+ set(value) {
188
+ onMapLoaded = value?.let { it }
189
+ }
190
+
177
191
  abstract var onLocationUpdate: ((location: RNLocation) -> Unit)?
178
192
 
179
193
  private var onLocationUpdate_cxx: Func_void_RNLocation?
@@ -216,6 +230,20 @@ abstract class HybridRNGoogleMapsPlusViewSpec: HybridView() {
216
230
  onMapPress = value?.let { it }
217
231
  }
218
232
 
233
+ abstract var onMapLongPress: ((coordinate: RNLatLng) -> Unit)?
234
+
235
+ private var onMapLongPress_cxx: Func_void_RNLatLng?
236
+ @Keep
237
+ @DoNotStrip
238
+ get() {
239
+ return onMapLongPress?.let { Func_void_RNLatLng_java(it) }
240
+ }
241
+ @Keep
242
+ @DoNotStrip
243
+ set(value) {
244
+ onMapLongPress = value?.let { it }
245
+ }
246
+
219
247
  abstract var onMarkerPress: ((id: String?) -> Unit)?
220
248
 
221
249
  private var onMarkerPress_cxx: Func_void_std__optional_std__string_?
@@ -897,6 +897,21 @@ namespace margelo::nitro::rngooglemapsplus::bridge::swift {
897
897
  return *optional;
898
898
  }
899
899
 
900
+ // pragma MARK: std::optional<std::function<void(bool /* loaded */)>>
901
+ /**
902
+ * Specialized version of `std::optional<std::function<void(bool / * loaded * /)>>`.
903
+ */
904
+ using std__optional_std__function_void_bool____loaded______ = std::optional<std::function<void(bool /* loaded */)>>;
905
+ inline std::optional<std::function<void(bool /* loaded */)>> create_std__optional_std__function_void_bool____loaded______(const std::function<void(bool /* loaded */)>& value) noexcept {
906
+ return std::optional<std::function<void(bool /* loaded */)>>(value);
907
+ }
908
+ inline bool has_value_std__optional_std__function_void_bool____loaded______(const std::optional<std::function<void(bool /* loaded */)>>& optional) noexcept {
909
+ return optional.has_value();
910
+ }
911
+ inline std::function<void(bool /* loaded */)> get_std__optional_std__function_void_bool____loaded______(const std::optional<std::function<void(bool /* loaded */)>>& optional) noexcept {
912
+ return *optional;
913
+ }
914
+
900
915
  // pragma MARK: std::optional<RNLocationAndroid>
901
916
  /**
902
917
  * Specialized version of `std::optional<RNLocationAndroid>`.
@@ -322,6 +322,13 @@ namespace margelo::nitro::rngooglemapsplus {
322
322
  inline void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) noexcept override {
323
323
  _swiftPart.setOnMapReady(onMapReady);
324
324
  }
325
+ inline std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() noexcept override {
326
+ auto __result = _swiftPart.getOnMapLoaded();
327
+ return __result;
328
+ }
329
+ inline void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) noexcept override {
330
+ _swiftPart.setOnMapLoaded(onMapLoaded);
331
+ }
325
332
  inline std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() noexcept override {
326
333
  auto __result = _swiftPart.getOnLocationUpdate();
327
334
  return __result;
@@ -343,6 +350,13 @@ namespace margelo::nitro::rngooglemapsplus {
343
350
  inline void setOnMapPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapPress) noexcept override {
344
351
  _swiftPart.setOnMapPress(onMapPress);
345
352
  }
353
+ inline std::optional<std::function<void(const RNLatLng& /* coordinate */)>> getOnMapLongPress() noexcept override {
354
+ auto __result = _swiftPart.getOnMapLongPress();
355
+ return __result;
356
+ }
357
+ inline void setOnMapLongPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapLongPress) noexcept override {
358
+ _swiftPart.setOnMapLongPress(onMapLongPress);
359
+ }
346
360
  inline std::optional<std::function<void(const std::optional<std::string>& /* id */)>> getOnMarkerPress() noexcept override {
347
361
  auto __result = _swiftPart.getOnMarkerPress();
348
362
  return __result;
@@ -186,6 +186,11 @@ using namespace margelo::nitro::rngooglemapsplus::views;
186
186
  swiftPart.setOnMapReady(newViewProps.onMapReady.value);
187
187
  newViewProps.onMapReady.isDirty = false;
188
188
  }
189
+ // onMapLoaded: optional
190
+ if (newViewProps.onMapLoaded.isDirty) {
191
+ swiftPart.setOnMapLoaded(newViewProps.onMapLoaded.value);
192
+ newViewProps.onMapLoaded.isDirty = false;
193
+ }
189
194
  // onLocationUpdate: optional
190
195
  if (newViewProps.onLocationUpdate.isDirty) {
191
196
  swiftPart.setOnLocationUpdate(newViewProps.onLocationUpdate.value);
@@ -201,6 +206,11 @@ using namespace margelo::nitro::rngooglemapsplus::views;
201
206
  swiftPart.setOnMapPress(newViewProps.onMapPress.value);
202
207
  newViewProps.onMapPress.isDirty = false;
203
208
  }
209
+ // onMapLongPress: optional
210
+ if (newViewProps.onMapLongPress.isDirty) {
211
+ swiftPart.setOnMapLongPress(newViewProps.onMapLongPress.value);
212
+ newViewProps.onMapLongPress.isDirty = false;
213
+ }
204
214
  // onMarkerPress: optional
205
215
  if (newViewProps.onMarkerPress.isDirty) {
206
216
  swiftPart.setOnMarkerPress(newViewProps.onMarkerPress.value);
@@ -31,9 +31,11 @@ public protocol HybridRNGoogleMapsPlusViewSpec_protocol: HybridObject, HybridVie
31
31
  var locationConfig: RNLocationConfig? { get set }
32
32
  var onMapError: ((_ error: RNMapErrorCode) -> Void)? { get set }
33
33
  var onMapReady: ((_ ready: Bool) -> Void)? { get set }
34
+ var onMapLoaded: ((_ loaded: Bool) -> Void)? { get set }
34
35
  var onLocationUpdate: ((_ location: RNLocation) -> Void)? { get set }
35
36
  var onLocationError: ((_ error: RNLocationErrorCode) -> Void)? { get set }
36
37
  var onMapPress: ((_ coordinate: RNLatLng) -> Void)? { get set }
38
+ var onMapLongPress: ((_ coordinate: RNLatLng) -> Void)? { get set }
37
39
  var onMarkerPress: ((_ id: String?) -> Void)? { get set }
38
40
  var onPolylinePress: ((_ id: String?) -> Void)? { get set }
39
41
  var onPolygonPress: ((_ id: String?) -> Void)? { get set }
@@ -589,6 +589,38 @@ open class HybridRNGoogleMapsPlusViewSpec_cxx {
589
589
  }
590
590
  }
591
591
 
592
+ public final var onMapLoaded: bridge.std__optional_std__function_void_bool____loaded______ {
593
+ @inline(__always)
594
+ get {
595
+ return { () -> bridge.std__optional_std__function_void_bool____loaded______ in
596
+ if let __unwrappedValue = self.__implementation.onMapLoaded {
597
+ return bridge.create_std__optional_std__function_void_bool____loaded______({ () -> bridge.Func_void_bool in
598
+ let __closureWrapper = Func_void_bool(__unwrappedValue)
599
+ return bridge.create_Func_void_bool(__closureWrapper.toUnsafe())
600
+ }())
601
+ } else {
602
+ return .init()
603
+ }
604
+ }()
605
+ }
606
+ @inline(__always)
607
+ set {
608
+ self.__implementation.onMapLoaded = { () -> ((_ loaded: Bool) -> Void)? in
609
+ if bridge.has_value_std__optional_std__function_void_bool____loaded______(newValue) {
610
+ let __unwrapped = bridge.get_std__optional_std__function_void_bool____loaded______(newValue)
611
+ return { () -> (Bool) -> Void in
612
+ let __wrappedFunction = bridge.wrap_Func_void_bool(__unwrapped)
613
+ return { (__loaded: Bool) -> Void in
614
+ __wrappedFunction.call(__loaded)
615
+ }
616
+ }()
617
+ } else {
618
+ return nil
619
+ }
620
+ }()
621
+ }
622
+ }
623
+
592
624
  public final var onLocationUpdate: bridge.std__optional_std__function_void_const_RNLocation_____location______ {
593
625
  @inline(__always)
594
626
  get {
@@ -685,6 +717,38 @@ open class HybridRNGoogleMapsPlusViewSpec_cxx {
685
717
  }
686
718
  }
687
719
 
720
+ public final var onMapLongPress: bridge.std__optional_std__function_void_const_RNLatLng_____coordinate______ {
721
+ @inline(__always)
722
+ get {
723
+ return { () -> bridge.std__optional_std__function_void_const_RNLatLng_____coordinate______ in
724
+ if let __unwrappedValue = self.__implementation.onMapLongPress {
725
+ return bridge.create_std__optional_std__function_void_const_RNLatLng_____coordinate______({ () -> bridge.Func_void_RNLatLng in
726
+ let __closureWrapper = Func_void_RNLatLng(__unwrappedValue)
727
+ return bridge.create_Func_void_RNLatLng(__closureWrapper.toUnsafe())
728
+ }())
729
+ } else {
730
+ return .init()
731
+ }
732
+ }()
733
+ }
734
+ @inline(__always)
735
+ set {
736
+ self.__implementation.onMapLongPress = { () -> ((_ coordinate: RNLatLng) -> Void)? in
737
+ if bridge.has_value_std__optional_std__function_void_const_RNLatLng_____coordinate______(newValue) {
738
+ let __unwrapped = bridge.get_std__optional_std__function_void_const_RNLatLng_____coordinate______(newValue)
739
+ return { () -> (RNLatLng) -> Void in
740
+ let __wrappedFunction = bridge.wrap_Func_void_RNLatLng(__unwrapped)
741
+ return { (__coordinate: RNLatLng) -> Void in
742
+ __wrappedFunction.call(__coordinate)
743
+ }
744
+ }()
745
+ } else {
746
+ return nil
747
+ }
748
+ }()
749
+ }
750
+ }
751
+
688
752
  public final var onMarkerPress: bridge.std__optional_std__function_void_const_std__optional_std__string______id______ {
689
753
  @inline(__always)
690
754
  get {
@@ -54,12 +54,16 @@ namespace margelo::nitro::rngooglemapsplus {
54
54
  prototype.registerHybridSetter("onMapError", &HybridRNGoogleMapsPlusViewSpec::setOnMapError);
55
55
  prototype.registerHybridGetter("onMapReady", &HybridRNGoogleMapsPlusViewSpec::getOnMapReady);
56
56
  prototype.registerHybridSetter("onMapReady", &HybridRNGoogleMapsPlusViewSpec::setOnMapReady);
57
+ prototype.registerHybridGetter("onMapLoaded", &HybridRNGoogleMapsPlusViewSpec::getOnMapLoaded);
58
+ prototype.registerHybridSetter("onMapLoaded", &HybridRNGoogleMapsPlusViewSpec::setOnMapLoaded);
57
59
  prototype.registerHybridGetter("onLocationUpdate", &HybridRNGoogleMapsPlusViewSpec::getOnLocationUpdate);
58
60
  prototype.registerHybridSetter("onLocationUpdate", &HybridRNGoogleMapsPlusViewSpec::setOnLocationUpdate);
59
61
  prototype.registerHybridGetter("onLocationError", &HybridRNGoogleMapsPlusViewSpec::getOnLocationError);
60
62
  prototype.registerHybridSetter("onLocationError", &HybridRNGoogleMapsPlusViewSpec::setOnLocationError);
61
63
  prototype.registerHybridGetter("onMapPress", &HybridRNGoogleMapsPlusViewSpec::getOnMapPress);
62
64
  prototype.registerHybridSetter("onMapPress", &HybridRNGoogleMapsPlusViewSpec::setOnMapPress);
65
+ prototype.registerHybridGetter("onMapLongPress", &HybridRNGoogleMapsPlusViewSpec::getOnMapLongPress);
66
+ prototype.registerHybridSetter("onMapLongPress", &HybridRNGoogleMapsPlusViewSpec::setOnMapLongPress);
63
67
  prototype.registerHybridGetter("onMarkerPress", &HybridRNGoogleMapsPlusViewSpec::getOnMarkerPress);
64
68
  prototype.registerHybridSetter("onMarkerPress", &HybridRNGoogleMapsPlusViewSpec::setOnMarkerPress);
65
69
  prototype.registerHybridGetter("onPolylinePress", &HybridRNGoogleMapsPlusViewSpec::getOnPolylinePress);
@@ -159,12 +159,16 @@ namespace margelo::nitro::rngooglemapsplus {
159
159
  virtual void setOnMapError(const std::optional<std::function<void(RNMapErrorCode /* error */)>>& onMapError) = 0;
160
160
  virtual std::optional<std::function<void(bool /* ready */)>> getOnMapReady() = 0;
161
161
  virtual void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) = 0;
162
+ virtual std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() = 0;
163
+ virtual void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) = 0;
162
164
  virtual std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() = 0;
163
165
  virtual void setOnLocationUpdate(const std::optional<std::function<void(const RNLocation& /* location */)>>& onLocationUpdate) = 0;
164
166
  virtual std::optional<std::function<void(RNLocationErrorCode /* error */)>> getOnLocationError() = 0;
165
167
  virtual void setOnLocationError(const std::optional<std::function<void(RNLocationErrorCode /* error */)>>& onLocationError) = 0;
166
168
  virtual std::optional<std::function<void(const RNLatLng& /* coordinate */)>> getOnMapPress() = 0;
167
169
  virtual void setOnMapPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapPress) = 0;
170
+ virtual std::optional<std::function<void(const RNLatLng& /* coordinate */)>> getOnMapLongPress() = 0;
171
+ virtual void setOnMapLongPress(const std::optional<std::function<void(const RNLatLng& /* coordinate */)>>& onMapLongPress) = 0;
168
172
  virtual std::optional<std::function<void(const std::optional<std::string>& /* id */)>> getOnMarkerPress() = 0;
169
173
  virtual void setOnMarkerPress(const std::optional<std::function<void(const std::optional<std::string>& /* id */)>>& onMarkerPress) = 0;
170
174
  virtual std::optional<std::function<void(const std::optional<std::string>& /* id */)>> getOnPolylinePress() = 0;
@@ -225,6 +225,16 @@ namespace margelo::nitro::rngooglemapsplus::views {
225
225
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapReady: ") + exc.what());
226
226
  }
227
227
  }()),
228
+ onMapLoaded([&]() -> CachedProp<std::optional<std::function<void(bool /* loaded */)>>> {
229
+ try {
230
+ const react::RawValue* rawValue = rawProps.at("onMapLoaded", nullptr, nullptr);
231
+ if (rawValue == nullptr) return sourceProps.onMapLoaded;
232
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
233
+ return CachedProp<std::optional<std::function<void(bool /* loaded */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapLoaded);
234
+ } catch (const std::exception& exc) {
235
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapLoaded: ") + exc.what());
236
+ }
237
+ }()),
228
238
  onLocationUpdate([&]() -> CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> {
229
239
  try {
230
240
  const react::RawValue* rawValue = rawProps.at("onLocationUpdate", nullptr, nullptr);
@@ -255,6 +265,16 @@ namespace margelo::nitro::rngooglemapsplus::views {
255
265
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapPress: ") + exc.what());
256
266
  }
257
267
  }()),
268
+ onMapLongPress([&]() -> CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> {
269
+ try {
270
+ const react::RawValue* rawValue = rawProps.at("onMapLongPress", nullptr, nullptr);
271
+ if (rawValue == nullptr) return sourceProps.onMapLongPress;
272
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
273
+ return CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapLongPress);
274
+ } catch (const std::exception& exc) {
275
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapLongPress: ") + exc.what());
276
+ }
277
+ }()),
258
278
  onMarkerPress([&]() -> CachedProp<std::optional<std::function<void(const std::optional<std::string>& /* id */)>>> {
259
279
  try {
260
280
  const react::RawValue* rawValue = rawProps.at("onMarkerPress", nullptr, nullptr);
@@ -408,9 +428,11 @@ namespace margelo::nitro::rngooglemapsplus::views {
408
428
  locationConfig(other.locationConfig),
409
429
  onMapError(other.onMapError),
410
430
  onMapReady(other.onMapReady),
431
+ onMapLoaded(other.onMapLoaded),
411
432
  onLocationUpdate(other.onLocationUpdate),
412
433
  onLocationError(other.onLocationError),
413
434
  onMapPress(other.onMapPress),
435
+ onMapLongPress(other.onMapLongPress),
414
436
  onMarkerPress(other.onMarkerPress),
415
437
  onPolylinePress(other.onPolylinePress),
416
438
  onPolygonPress(other.onPolygonPress),
@@ -447,9 +469,11 @@ namespace margelo::nitro::rngooglemapsplus::views {
447
469
  case hashString("locationConfig"): return true;
448
470
  case hashString("onMapError"): return true;
449
471
  case hashString("onMapReady"): return true;
472
+ case hashString("onMapLoaded"): return true;
450
473
  case hashString("onLocationUpdate"): return true;
451
474
  case hashString("onLocationError"): return true;
452
475
  case hashString("onMapPress"): return true;
476
+ case hashString("onMapLongPress"): return true;
453
477
  case hashString("onMarkerPress"): return true;
454
478
  case hashString("onPolylinePress"): return true;
455
479
  case hashString("onPolygonPress"): return true;
@@ -85,9 +85,11 @@ namespace margelo::nitro::rngooglemapsplus::views {
85
85
  CachedProp<std::optional<RNLocationConfig>> locationConfig;
86
86
  CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>> onMapError;
87
87
  CachedProp<std::optional<std::function<void(bool /* ready */)>>> onMapReady;
88
+ CachedProp<std::optional<std::function<void(bool /* loaded */)>>> onMapLoaded;
88
89
  CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> onLocationUpdate;
89
90
  CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>> onLocationError;
90
91
  CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> onMapPress;
92
+ CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> onMapLongPress;
91
93
  CachedProp<std::optional<std::function<void(const std::optional<std::string>& /* id */)>>> onMarkerPress;
92
94
  CachedProp<std::optional<std::function<void(const std::optional<std::string>& /* id */)>>> onPolylinePress;
93
95
  CachedProp<std::optional<std::function<void(const std::optional<std::string>& /* id */)>>> onPolygonPress;
@@ -24,9 +24,11 @@
24
24
  "locationConfig": true,
25
25
  "onMapError": true,
26
26
  "onMapReady": true,
27
+ "onMapLoaded": true,
27
28
  "onLocationUpdate": true,
28
29
  "onLocationError": true,
29
30
  "onMapPress": true,
31
+ "onMapLongPress": true,
30
32
  "onMarkerPress": true,
31
33
  "onPolylinePress": true,
32
34
  "onPolygonPress": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-maps-plus",
3
- "version": "1.6.1",
3
+ "version": "1.7.0-dev.1",
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",
@@ -52,6 +52,7 @@
52
52
  "android/fix-prefab.gradle",
53
53
  "android/gradle.properties",
54
54
  "android/CMakeLists.txt",
55
+ "android/proguard-rules.pro",
55
56
  "android/src",
56
57
  "ios/**/*.h",
57
58
  "ios/**/*.m",
@@ -88,8 +89,8 @@
88
89
  "@semantic-release/git": "10.0.1",
89
90
  "@semantic-release/npm": "13.1.1",
90
91
  "@types/jest": "30.0.0",
91
- "@types/react": "19.2.2",
92
- "clang-format-node": "2.0.2",
92
+ "@types/react": "19.1.1",
93
+ "clang-format-node": "2.0.3",
93
94
  "conventional-changelog-conventionalcommits": "9.1.0",
94
95
  "del-cli": "7.0.0",
95
96
  "eslint": "9.38.0",
@@ -100,7 +101,7 @@
100
101
  "lefthook": "2.0.0",
101
102
  "nitrogen": "0.30.2",
102
103
  "prettier": "3.6.2",
103
- "react": "19.2.0",
104
+ "react": "19.1.1",
104
105
  "react-native": "0.82.1",
105
106
  "react-native-builder-bob": "0.40.13",
106
107
  "react-native-nitro-modules": "0.30.2",
@@ -51,9 +51,11 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
51
51
  locationConfig?: RNLocationConfig;
52
52
  onMapError?: (error: RNMapErrorCode) => void;
53
53
  onMapReady?: (ready: boolean) => void;
54
+ onMapLoaded?: (loaded: boolean) => void;
54
55
  onLocationUpdate?: (location: RNLocation) => void;
55
56
  onLocationError?: (error: RNLocationErrorCode) => void;
56
57
  onMapPress?: (coordinate: RNLatLng) => void;
58
+ onMapLongPress?: (coordinate: RNLatLng) => void;
57
59
  onMarkerPress?: (id?: string | undefined) => void;
58
60
  onPolylinePress?: (id?: string | undefined) => void;
59
61
  onPolygonPress?: (id?: string | undefined) => void;