react-native-google-maps-plus 1.7.0-dev.7 → 1.7.0-dev.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.
Files changed (25) hide show
  1. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +18 -4
  2. package/android/src/main/java/com/rngooglemapsplus/MapHeatmapBuilder.kt +1 -1
  3. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +1 -1
  4. package/ios/GoogleMapViewImpl.swift +8 -2
  5. package/ios/MapHeatmapBuilder.swift +1 -1
  6. package/ios/RNGoogleMapsPlusView.swift +5 -5
  7. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +1 -1
  8. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
  9. package/nitrogen/generated/android/RNGoogleMapsPlusOnLoad.cpp +2 -0
  10. package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera.hpp +83 -0
  11. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +19 -18
  12. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +2 -2
  13. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/Func_void_RNRegion_RNCamera.kt +81 -0
  14. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +3 -3
  15. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.cpp +8 -0
  16. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +29 -7
  17. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +8 -8
  18. package/nitrogen/generated/ios/swift/Func_void_RNRegion_RNCamera.swift +47 -0
  19. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +1 -1
  20. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +12 -12
  21. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +8 -8
  22. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.cpp +2 -2
  23. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.hpp +3 -3
  24. package/package.json +4 -2
  25. package/src/RNGoogleMapsPlusView.nitro.ts +1 -1
@@ -76,6 +76,7 @@ class GoogleMapsViewImpl(
76
76
  GoogleMap.OnMyLocationButtonClickListener,
77
77
  LifecycleEventListener {
78
78
  private var initialized = false
79
+ private var loaded = false
79
80
  private var destroyed = false
80
81
  private var googleMap: GoogleMap? = null
81
82
  private var mapView: MapView? = null
@@ -141,7 +142,11 @@ class GoogleMapsViewImpl(
141
142
  googleMap?.setOnInfoWindowLongClickListener(this@GoogleMapsViewImpl)
142
143
  googleMap?.setOnMyLocationClickListener(this@GoogleMapsViewImpl)
143
144
  googleMap?.setOnMyLocationButtonClickListener(this@GoogleMapsViewImpl)
144
- onMapLoaded?.invoke(true)
145
+ loaded = true
146
+ onMapLoaded?.invoke(
147
+ map.projection.visibleRegion.toRnRegion(),
148
+ map.cameraPosition.toRnCamera(),
149
+ )
145
150
  }
146
151
  applyProps()
147
152
  initLocationCallbacks()
@@ -151,6 +156,7 @@ class GoogleMapsViewImpl(
151
156
 
152
157
  override fun onCameraMoveStarted(reason: Int) =
153
158
  onUi {
159
+ if (!loaded) return@onUi
154
160
  cameraMoveReason = reason
155
161
  val visibleRegion = googleMap?.projection?.visibleRegion ?: return@onUi
156
162
  val cameraPosition = googleMap?.cameraPosition ?: return@onUi
@@ -163,6 +169,7 @@ class GoogleMapsViewImpl(
163
169
 
164
170
  override fun onCameraMove() =
165
171
  onUi {
172
+ if (!loaded) return@onUi
166
173
  val visibleRegion = googleMap?.projection?.visibleRegion ?: return@onUi
167
174
  val cameraPosition = googleMap?.cameraPosition ?: return@onUi
168
175
  val gesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason
@@ -175,6 +182,7 @@ class GoogleMapsViewImpl(
175
182
 
176
183
  override fun onCameraIdle() =
177
184
  onUi {
185
+ if (!loaded) return@onUi
178
186
  val visibleRegion = googleMap?.projection?.visibleRegion ?: return@onUi
179
187
  val cameraPosition = googleMap?.cameraPosition ?: return@onUi
180
188
  val gesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason
@@ -354,7 +362,7 @@ class GoogleMapsViewImpl(
354
362
 
355
363
  var onMapError: ((RNMapErrorCode) -> Unit)? = null
356
364
  var onMapReady: ((Boolean) -> Unit)? = null
357
- var onMapLoaded: ((Boolean) -> Unit)? = null
365
+ var onMapLoaded: ((RNRegion, RNCamera) -> Unit)? = null
358
366
  var onLocationUpdate: ((RNLocation) -> Unit)? = null
359
367
  var onLocationError: ((RNLocationErrorCode) -> Unit)? = null
360
368
  var onMapPress: ((RNLatLng) -> Unit)? = null
@@ -694,7 +702,10 @@ class GoogleMapsViewImpl(
694
702
 
695
703
  fun removeHeatmap(id: String) =
696
704
  onUi {
697
- heatmapsById.remove(id)?.remove()
705
+ heatmapsById.remove(id)?.let { heatMap ->
706
+ heatMap.clearTileCache()
707
+ heatMap.remove()
708
+ }
698
709
  }
699
710
 
700
711
  fun clearHeatmaps() =
@@ -764,7 +775,10 @@ class GoogleMapsViewImpl(
764
775
 
765
776
  fun removeUrlTileOverlay(id: String) =
766
777
  onUi {
767
- urlTileOverlaysById.remove(id)?.remove()
778
+ urlTileOverlaysById.remove(id)?.let { urlTileOverlay ->
779
+ urlTileOverlay.clearTileCache()
780
+ urlTileOverlay.remove()
781
+ }
768
782
  }
769
783
 
770
784
  fun clearUrlTileOverlays() =
@@ -19,7 +19,7 @@ class MapHeatmapBuilder {
19
19
  heatmap.gradient?.let {
20
20
  val colors = it.colors.map { c -> c.toColor() }.toIntArray()
21
21
  val startPoints = it.startPoints.map { p -> p.toFloat() }.toFloatArray()
22
- gradient(Gradient(colors, startPoints))
22
+ gradient(Gradient(colors, startPoints, it.colorMapSize.toInt()))
23
23
  }
24
24
  }.build()
25
25
 
@@ -295,7 +295,7 @@ class RNGoogleMapsPlusView(
295
295
  view.onMapReady = cb
296
296
  }
297
297
 
298
- override var onMapLoaded: ((Boolean) -> Unit)? = null
298
+ override var onMapLoaded: ((RNRegion, RNCamera) -> Unit)? = null
299
299
  set(cb) {
300
300
  view.onMapLoaded = cb
301
301
  }
@@ -261,7 +261,7 @@ GMSIndoorDisplayDelegate {
261
261
 
262
262
  var onMapError: ((RNMapErrorCode) -> Void)?
263
263
  var onMapReady: ((Bool) -> Void)?
264
- var onMapLoaded: ((Bool) -> Void)?
264
+ var onMapLoaded: ((RNRegion, RNCamera) -> Void)?
265
265
  var onLocationUpdate: ((RNLocation) -> Void)?
266
266
  var onLocationError: ((_ error: RNLocationErrorCode) -> Void)?
267
267
  var onMapPress: ((RNLatLng) -> Void)?
@@ -703,10 +703,14 @@ GMSIndoorDisplayDelegate {
703
703
  func mapViewDidFinishTileRendering(_ mapView: GMSMapView) {
704
704
  guard !loaded else { return }
705
705
  loaded = true
706
- onMapLoaded?(true)
706
+ let visibleRegion = mapView.projection.visibleRegion().toRNRegion()
707
+ let camera = mapView.camera.toRNCamera()
708
+
709
+ self.onMapLoaded?(visibleRegion, camera)
707
710
  }
708
711
 
709
712
  func mapView(_ mapView: GMSMapView, willMove gesture: Bool) {
713
+ if !loaded { return }
710
714
  onMain {
711
715
  self.cameraMoveReasonIsGesture = gesture
712
716
 
@@ -718,6 +722,7 @@ GMSIndoorDisplayDelegate {
718
722
  }
719
723
 
720
724
  func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
725
+ if !loaded { return }
721
726
  onMain {
722
727
  let visibleRegion = mapView.projection.visibleRegion().toRNRegion()
723
728
  let camera = mapView.camera.toRNCamera()
@@ -728,6 +733,7 @@ GMSIndoorDisplayDelegate {
728
733
  }
729
734
 
730
735
  func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
736
+ if !loaded { return }
731
737
  onMain {
732
738
  let visibleRegion = mapView.projection.visibleRegion().toRNRegion()
733
739
  let camera = mapView.camera.toRNCamera()
@@ -19,7 +19,7 @@ final class MapHeatmapBuilder {
19
19
  heatmap.gradient = GMUGradient(
20
20
  colors: colors,
21
21
  startPoints: startPoints,
22
- colorMapSize: 256
22
+ colorMapSize: UInt(g.colorMapSize)
23
23
  )
24
24
  }
25
25
 
@@ -325,7 +325,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
325
325
  didSet { impl.onMapReady = onMapReady }
326
326
  }
327
327
  @MainActor
328
- var onMapLoaded: ((Bool) -> Void)? {
328
+ var onMapLoaded: ((RNRegion, RNCamera) -> Void)? {
329
329
  didSet { impl.onMapLoaded = onMapLoaded }
330
330
  }
331
331
  @MainActor
@@ -385,19 +385,19 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
385
385
  didSet { impl.onIndoorLevelActivated = onIndoorLevelActivated }
386
386
  }
387
387
  @MainActor
388
- var onInfoWindowPress: ((String?) -> Void)?{
388
+ var onInfoWindowPress: ((String?) -> Void)? {
389
389
  didSet { impl.onInfoWindowPress = onInfoWindowPress }
390
390
  }
391
391
  @MainActor
392
- var onInfoWindowClose: ((String?) -> Void)?{
392
+ var onInfoWindowClose: ((String?) -> Void)? {
393
393
  didSet { impl.onInfoWindowClose = onInfoWindowClose }
394
394
  }
395
395
  @MainActor
396
- var onInfoWindowLongPress: ((String?) -> Void)?{
396
+ var onInfoWindowLongPress: ((String?) -> Void)? {
397
397
  didSet { impl.onInfoWindowLongPress = onInfoWindowLongPress }
398
398
  }
399
399
  @MainActor
400
- var onMyLocationPress: ((RNLocation) -> Void)?{
400
+ var onMyLocationPress: ((RNLocation) -> Void)? {
401
401
  didSet { impl.onMyLocationPress = onMyLocationPress }
402
402
  }
403
403
  @MainActor
@@ -22,7 +22,7 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
22
22
  locationConfig?: RNLocationConfig;
23
23
  onMapError?: (error: RNMapErrorCode) => void;
24
24
  onMapReady?: (ready: boolean) => void;
25
- onMapLoaded?: (loaded: boolean) => void;
25
+ onMapLoaded?: (region: RNRegion, camera: RNCamera) => void;
26
26
  onLocationUpdate?: (location: RNLocation) => void;
27
27
  onLocationError?: (error: RNLocationErrorCode) => void;
28
28
  onMapPress?: (coordinate: RNLatLng) => 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,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACR,0BAA0B,EAC1B,QAAQ,EACR,UAAU,EACV,cAAc,EACd,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,UAAU,CAAC,EAAE,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C,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"}
@@ -19,6 +19,7 @@
19
19
  #include "JHybridRNGoogleMapsPlusViewSpec.hpp"
20
20
  #include "JFunc_void_RNMapErrorCode.hpp"
21
21
  #include "JFunc_void_bool.hpp"
22
+ #include "JFunc_void_RNRegion_RNCamera.hpp"
22
23
  #include "JFunc_void_RNLocation.hpp"
23
24
  #include "JFunc_void_RNLocationErrorCode.hpp"
24
25
  #include "JFunc_void_RNLatLng.hpp"
@@ -44,6 +45,7 @@ int initialize(JavaVM* vm) {
44
45
  margelo::nitro::rngooglemapsplus::JHybridRNGoogleMapsPlusViewSpec::registerNatives();
45
46
  margelo::nitro::rngooglemapsplus::JFunc_void_RNMapErrorCode_cxx::registerNatives();
46
47
  margelo::nitro::rngooglemapsplus::JFunc_void_bool_cxx::registerNatives();
48
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNRegion_RNCamera_cxx::registerNatives();
47
49
  margelo::nitro::rngooglemapsplus::JFunc_void_RNLocation_cxx::registerNatives();
48
50
  margelo::nitro::rngooglemapsplus::JFunc_void_RNLocationErrorCode_cxx::registerNatives();
49
51
  margelo::nitro::rngooglemapsplus::JFunc_void_RNLatLng_cxx::registerNatives();
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// JFunc_void_RNRegion_RNCamera.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include <functional>
12
+
13
+ #include "RNRegion.hpp"
14
+ #include "RNCamera.hpp"
15
+ #include <functional>
16
+ #include "JRNRegion.hpp"
17
+ #include "RNLatLng.hpp"
18
+ #include "JRNLatLng.hpp"
19
+ #include "RNLatLngBounds.hpp"
20
+ #include "JRNLatLngBounds.hpp"
21
+ #include "JRNCamera.hpp"
22
+ #include <optional>
23
+
24
+ namespace margelo::nitro::rngooglemapsplus {
25
+
26
+ using namespace facebook;
27
+
28
+ /**
29
+ * Represents the Java/Kotlin callback `(region: RNRegion, camera: RNCamera) -> Unit`.
30
+ * This can be passed around between C++ and Java/Kotlin.
31
+ */
32
+ struct JFunc_void_RNRegion_RNCamera: public jni::JavaClass<JFunc_void_RNRegion_RNCamera> {
33
+ public:
34
+ static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera;";
35
+
36
+ public:
37
+ /**
38
+ * Invokes the function this `JFunc_void_RNRegion_RNCamera` instance holds through JNI.
39
+ */
40
+ void invoke(const RNRegion& region, const RNCamera& camera) const {
41
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JRNRegion> /* region */, jni::alias_ref<JRNCamera> /* camera */)>("invoke");
42
+ method(self(), JRNRegion::fromCpp(region), JRNCamera::fromCpp(camera));
43
+ }
44
+ };
45
+
46
+ /**
47
+ * An implementation of Func_void_RNRegion_RNCamera that is backed by a C++ implementation (using `std::function<...>`)
48
+ */
49
+ struct JFunc_void_RNRegion_RNCamera_cxx final: public jni::HybridClass<JFunc_void_RNRegion_RNCamera_cxx, JFunc_void_RNRegion_RNCamera> {
50
+ public:
51
+ static jni::local_ref<JFunc_void_RNRegion_RNCamera::javaobject> fromCpp(const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>& func) {
52
+ return JFunc_void_RNRegion_RNCamera_cxx::newObjectCxxArgs(func);
53
+ }
54
+
55
+ public:
56
+ /**
57
+ * Invokes the C++ `std::function<...>` this `JFunc_void_RNRegion_RNCamera_cxx` instance holds.
58
+ */
59
+ void invoke_cxx(jni::alias_ref<JRNRegion> region, jni::alias_ref<JRNCamera> camera) {
60
+ _func(region->toCpp(), camera->toCpp());
61
+ }
62
+
63
+ public:
64
+ [[nodiscard]]
65
+ inline const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>& getFunction() const {
66
+ return _func;
67
+ }
68
+
69
+ public:
70
+ static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_cxx;";
71
+ static void registerNatives() {
72
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNRegion_RNCamera_cxx::invoke_cxx)});
73
+ }
74
+
75
+ private:
76
+ explicit JFunc_void_RNRegion_RNCamera_cxx(const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>& func): _func(func) { }
77
+
78
+ private:
79
+ friend HybridBase;
80
+ std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)> _func;
81
+ };
82
+
83
+ } // namespace margelo::nitro::rngooglemapsplus
@@ -63,6 +63,10 @@ namespace margelo::nitro::rngooglemapsplus { struct RNIOSLocationConfig; }
63
63
  namespace margelo::nitro::rngooglemapsplus { enum class RNIOSLocationAccuracy; }
64
64
  // Forward declaration of `RNMapErrorCode` to properly resolve imports.
65
65
  namespace margelo::nitro::rngooglemapsplus { enum class RNMapErrorCode; }
66
+ // Forward declaration of `RNRegion` to properly resolve imports.
67
+ namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
68
+ // Forward declaration of `RNLatLngBounds` to properly resolve imports.
69
+ namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
66
70
  // Forward declaration of `RNLocation` to properly resolve imports.
67
71
  namespace margelo::nitro::rngooglemapsplus { struct RNLocation; }
68
72
  // Forward declaration of `RNLocationAndroid` to properly resolve imports.
@@ -75,10 +79,6 @@ namespace margelo::nitro::rngooglemapsplus { enum class RNLocationErrorCode; }
75
79
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorBuilding; }
76
80
  // Forward declaration of `RNIndoorLevel` to properly resolve imports.
77
81
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorLevel; }
78
- // Forward declaration of `RNRegion` to properly resolve imports.
79
- namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
80
- // Forward declaration of `RNLatLngBounds` to properly resolve imports.
81
- namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
82
82
  // Forward declaration of `RNLocationPermissionResult` to properly resolve imports.
83
83
  namespace margelo::nitro::rngooglemapsplus { struct RNLocationPermissionResult; }
84
84
  // Forward declaration of `RNAndroidLocationPermissionResult` to properly resolve imports.
@@ -156,6 +156,11 @@ namespace margelo::nitro::rngooglemapsplus { enum class RNSnapshotResultType; }
156
156
  #include "JFunc_void_RNMapErrorCode.hpp"
157
157
  #include "JRNMapErrorCode.hpp"
158
158
  #include "JFunc_void_bool.hpp"
159
+ #include "RNRegion.hpp"
160
+ #include "JFunc_void_RNRegion_RNCamera.hpp"
161
+ #include "JRNRegion.hpp"
162
+ #include "RNLatLngBounds.hpp"
163
+ #include "JRNLatLngBounds.hpp"
159
164
  #include "RNLocation.hpp"
160
165
  #include "JFunc_void_RNLocation.hpp"
161
166
  #include "JRNLocation.hpp"
@@ -176,11 +181,7 @@ namespace margelo::nitro::rngooglemapsplus { enum class RNSnapshotResultType; }
176
181
  #include "RNIndoorLevel.hpp"
177
182
  #include "JRNIndoorLevel.hpp"
178
183
  #include "JFunc_void_RNIndoorLevel.hpp"
179
- #include "RNRegion.hpp"
180
184
  #include "JFunc_void_RNRegion_RNCamera_bool.hpp"
181
- #include "JRNRegion.hpp"
182
- #include "RNLatLngBounds.hpp"
183
- #include "JRNLatLngBounds.hpp"
184
185
  #include <NitroModules/Promise.hpp>
185
186
  #include <NitroModules/JPromise.hpp>
186
187
  #include "RNLocationPermissionResult.hpp"
@@ -549,24 +550,24 @@ namespace margelo::nitro::rngooglemapsplus {
549
550
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* onMapReady */)>("setOnMapReady_cxx");
550
551
  method(_javaPart, onMapReady.has_value() ? JFunc_void_bool_cxx::fromCpp(onMapReady.value()) : nullptr);
551
552
  }
552
- std::optional<std::function<void(bool /* loaded */)>> JHybridRNGoogleMapsPlusViewSpec::getOnMapLoaded() {
553
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnMapLoaded_cxx");
553
+ std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> JHybridRNGoogleMapsPlusViewSpec::getOnMapLoaded() {
554
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_RNRegion_RNCamera::javaobject>()>("getOnMapLoaded_cxx");
554
555
  auto __result = method(_javaPart);
555
- return __result != nullptr ? std::make_optional([&]() -> std::function<void(bool /* loaded */)> {
556
- if (__result->isInstanceOf(JFunc_void_bool_cxx::javaClassStatic())) [[likely]] {
557
- auto downcast = jni::static_ref_cast<JFunc_void_bool_cxx::javaobject>(__result);
556
+ return __result != nullptr ? std::make_optional([&]() -> std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)> {
557
+ if (__result->isInstanceOf(JFunc_void_RNRegion_RNCamera_cxx::javaClassStatic())) [[likely]] {
558
+ auto downcast = jni::static_ref_cast<JFunc_void_RNRegion_RNCamera_cxx::javaobject>(__result);
558
559
  return downcast->cthis()->getFunction();
559
560
  } else {
560
561
  auto __resultRef = jni::make_global(__result);
561
- return [__resultRef](bool loaded) -> void {
562
- return __resultRef->invoke(loaded);
562
+ return [__resultRef](RNRegion region, RNCamera camera) -> void {
563
+ return __resultRef->invoke(region,camera);
563
564
  };
564
565
  }
565
566
  }()) : std::nullopt;
566
567
  }
567
- void JHybridRNGoogleMapsPlusViewSpec::setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) {
568
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* onMapLoaded */)>("setOnMapLoaded_cxx");
569
- method(_javaPart, onMapLoaded.has_value() ? JFunc_void_bool_cxx::fromCpp(onMapLoaded.value()) : nullptr);
568
+ void JHybridRNGoogleMapsPlusViewSpec::setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& onMapLoaded) {
569
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_RNRegion_RNCamera::javaobject> /* onMapLoaded */)>("setOnMapLoaded_cxx");
570
+ method(_javaPart, onMapLoaded.has_value() ? JFunc_void_RNRegion_RNCamera_cxx::fromCpp(onMapLoaded.value()) : nullptr);
570
571
  }
571
572
  std::optional<std::function<void(const RNLocation& /* location */)>> JHybridRNGoogleMapsPlusViewSpec::getOnLocationUpdate() {
572
573
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_RNLocation::javaobject>()>("getOnLocationUpdate_cxx");
@@ -91,8 +91,8 @@ namespace margelo::nitro::rngooglemapsplus {
91
91
  void setOnMapError(const std::optional<std::function<void(RNMapErrorCode /* error */)>>& onMapError) override;
92
92
  std::optional<std::function<void(bool /* ready */)>> getOnMapReady() override;
93
93
  void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) override;
94
- std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() override;
95
- void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) override;
94
+ std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> getOnMapLoaded() override;
95
+ void setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& onMapLoaded) override;
96
96
  std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() override;
97
97
  void setOnLocationUpdate(const std::optional<std::function<void(const RNLocation& /* location */)>>& onLocationUpdate) override;
98
98
  std::optional<std::function<void(RNLocationErrorCode /* error */)>> getOnLocationError() override;
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// Func_void_RNRegion_RNCamera.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.rngooglemapsplus
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+ import dalvik.annotation.optimization.FastNative
15
+
16
+
17
+ /**
18
+ * Represents the JavaScript callback `(region: struct, camera: struct) => void`.
19
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
20
+ * or in Kotlin/Java (in which case it is a native callback).
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress("ClassName", "RedundantUnitReturnType")
25
+ fun interface Func_void_RNRegion_RNCamera: (RNRegion, RNCamera) -> Unit {
26
+ /**
27
+ * Call the given JS callback.
28
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
29
+ */
30
+ @DoNotStrip
31
+ @Keep
32
+ override fun invoke(region: RNRegion, camera: RNCamera): Unit
33
+ }
34
+
35
+ /**
36
+ * Represents the JavaScript callback `(region: struct, camera: struct) => void`.
37
+ * This is implemented in C++, via a `std::function<...>`.
38
+ * The callback might be coming from JS.
39
+ */
40
+ @DoNotStrip
41
+ @Keep
42
+ @Suppress(
43
+ "KotlinJniMissingFunction", "unused",
44
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
45
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
46
+ )
47
+ class Func_void_RNRegion_RNCamera_cxx: Func_void_RNRegion_RNCamera {
48
+ @DoNotStrip
49
+ @Keep
50
+ private val mHybridData: HybridData
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ private constructor(hybridData: HybridData) {
55
+ mHybridData = hybridData
56
+ }
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ override fun invoke(region: RNRegion, camera: RNCamera): Unit
61
+ = invoke_cxx(region,camera)
62
+
63
+ @FastNative
64
+ private external fun invoke_cxx(region: RNRegion, camera: RNCamera): Unit
65
+ }
66
+
67
+ /**
68
+ * Represents the JavaScript callback `(region: struct, camera: struct) => void`.
69
+ * This is implemented in Java/Kotlin, via a `(RNRegion, RNCamera) -> Unit`.
70
+ * The callback is always coming from native.
71
+ */
72
+ @DoNotStrip
73
+ @Keep
74
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
75
+ class Func_void_RNRegion_RNCamera_java(private val function: (RNRegion, RNCamera) -> Unit): Func_void_RNRegion_RNCamera {
76
+ @DoNotStrip
77
+ @Keep
78
+ override fun invoke(region: RNRegion, camera: RNCamera): Unit {
79
+ return this.function(region, camera)
80
+ }
81
+ }
@@ -180,13 +180,13 @@ abstract class HybridRNGoogleMapsPlusViewSpec: HybridView() {
180
180
  onMapReady = value?.let { it }
181
181
  }
182
182
 
183
- abstract var onMapLoaded: ((loaded: Boolean) -> Unit)?
183
+ abstract var onMapLoaded: ((region: RNRegion, camera: RNCamera) -> Unit)?
184
184
 
185
- private var onMapLoaded_cxx: Func_void_bool?
185
+ private var onMapLoaded_cxx: Func_void_RNRegion_RNCamera?
186
186
  @Keep
187
187
  @DoNotStrip
188
188
  get() {
189
- return onMapLoaded?.let { Func_void_bool_java(it) }
189
+ return onMapLoaded?.let { Func_void_RNRegion_RNCamera_java(it) }
190
190
  }
191
191
  @Keep
192
192
  @DoNotStrip
@@ -62,6 +62,14 @@ namespace margelo::nitro::rngooglemapsplus::bridge::swift {
62
62
  };
63
63
  }
64
64
 
65
+ // pragma MARK: std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>
66
+ Func_void_RNRegion_RNCamera create_Func_void_RNRegion_RNCamera(void* NON_NULL swiftClosureWrapper) noexcept {
67
+ auto swiftClosure = RNGoogleMapsPlus::Func_void_RNRegion_RNCamera::fromUnsafe(swiftClosureWrapper);
68
+ return [swiftClosure = std::move(swiftClosure)](const RNRegion& region, const RNCamera& camera) mutable -> void {
69
+ swiftClosure.call(region, camera);
70
+ };
71
+ }
72
+
65
73
  // pragma MARK: std::function<void(const RNLocation& /* location */)>
66
74
  Func_void_RNLocation create_Func_void_RNLocation(void* NON_NULL swiftClosureWrapper) noexcept {
67
75
  auto swiftClosure = RNGoogleMapsPlus::Func_void_RNLocation::fromUnsafe(swiftClosureWrapper);
@@ -926,18 +926,40 @@ namespace margelo::nitro::rngooglemapsplus::bridge::swift {
926
926
  return *optional;
927
927
  }
928
928
 
929
- // pragma MARK: std::optional<std::function<void(bool /* loaded */)>>
929
+ // pragma MARK: std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>
930
930
  /**
931
- * Specialized version of `std::optional<std::function<void(bool / * loaded * /)>>`.
931
+ * Specialized version of `std::function<void(const RNRegion&, const RNCamera&)>`.
932
932
  */
933
- using std__optional_std__function_void_bool____loaded______ = std::optional<std::function<void(bool /* loaded */)>>;
934
- inline std::optional<std::function<void(bool /* loaded */)>> create_std__optional_std__function_void_bool____loaded______(const std::function<void(bool /* loaded */)>& value) noexcept {
935
- return std::optional<std::function<void(bool /* loaded */)>>(value);
933
+ using Func_void_RNRegion_RNCamera = std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>;
934
+ /**
935
+ * Wrapper class for a `std::function<void(const RNRegion& / * region * /, const RNCamera& / * camera * /)>`, this can be used from Swift.
936
+ */
937
+ class Func_void_RNRegion_RNCamera_Wrapper final {
938
+ public:
939
+ explicit Func_void_RNRegion_RNCamera_Wrapper(std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>&& func): _function(std::make_unique<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>(std::move(func))) {}
940
+ inline void call(RNRegion region, RNCamera camera) const noexcept {
941
+ _function->operator()(region, camera);
942
+ }
943
+ private:
944
+ std::unique_ptr<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> _function;
945
+ } SWIFT_NONCOPYABLE;
946
+ Func_void_RNRegion_RNCamera create_Func_void_RNRegion_RNCamera(void* NON_NULL swiftClosureWrapper) noexcept;
947
+ inline Func_void_RNRegion_RNCamera_Wrapper wrap_Func_void_RNRegion_RNCamera(Func_void_RNRegion_RNCamera value) noexcept {
948
+ return Func_void_RNRegion_RNCamera_Wrapper(std::move(value));
949
+ }
950
+
951
+ // pragma MARK: std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>
952
+ /**
953
+ * Specialized version of `std::optional<std::function<void(const RNRegion& / * region * /, const RNCamera& / * camera * /)>>`.
954
+ */
955
+ using std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______ = std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>;
956
+ inline std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> create_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______(const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>& value) noexcept {
957
+ return std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>(value);
936
958
  }
937
- inline bool has_value_std__optional_std__function_void_bool____loaded______(const std::optional<std::function<void(bool /* loaded */)>>& optional) noexcept {
959
+ inline bool has_value_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& optional) noexcept {
938
960
  return optional.has_value();
939
961
  }
940
- inline std::function<void(bool /* loaded */)> get_std__optional_std__function_void_bool____loaded______(const std::optional<std::function<void(bool /* loaded */)>>& optional) noexcept {
962
+ inline std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)> get_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& optional) noexcept {
941
963
  return *optional;
942
964
  }
943
965
 
@@ -68,6 +68,10 @@ namespace margelo::nitro::rngooglemapsplus { struct RNIOSLocationConfig; }
68
68
  namespace margelo::nitro::rngooglemapsplus { enum class RNIOSLocationAccuracy; }
69
69
  // Forward declaration of `RNMapErrorCode` to properly resolve imports.
70
70
  namespace margelo::nitro::rngooglemapsplus { enum class RNMapErrorCode; }
71
+ // Forward declaration of `RNRegion` to properly resolve imports.
72
+ namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
73
+ // Forward declaration of `RNLatLngBounds` to properly resolve imports.
74
+ namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
71
75
  // Forward declaration of `RNLocation` to properly resolve imports.
72
76
  namespace margelo::nitro::rngooglemapsplus { struct RNLocation; }
73
77
  // Forward declaration of `RNLocationAndroid` to properly resolve imports.
@@ -80,10 +84,6 @@ namespace margelo::nitro::rngooglemapsplus { enum class RNLocationErrorCode; }
80
84
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorBuilding; }
81
85
  // Forward declaration of `RNIndoorLevel` to properly resolve imports.
82
86
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorLevel; }
83
- // Forward declaration of `RNRegion` to properly resolve imports.
84
- namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
85
- // Forward declaration of `RNLatLngBounds` to properly resolve imports.
86
- namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
87
87
  // Forward declaration of `RNSnapshotOptions` to properly resolve imports.
88
88
  namespace margelo::nitro::rngooglemapsplus { struct RNSnapshotOptions; }
89
89
  // Forward declaration of `RNSize` to properly resolve imports.
@@ -131,14 +131,14 @@ namespace margelo::nitro::rngooglemapsplus { enum class RNIOSPermissionResult; }
131
131
  #include "RNIOSLocationAccuracy.hpp"
132
132
  #include "RNMapErrorCode.hpp"
133
133
  #include <functional>
134
+ #include "RNRegion.hpp"
135
+ #include "RNLatLngBounds.hpp"
134
136
  #include "RNLocation.hpp"
135
137
  #include "RNLocationAndroid.hpp"
136
138
  #include "RNLocationIOS.hpp"
137
139
  #include "RNLocationErrorCode.hpp"
138
140
  #include "RNIndoorBuilding.hpp"
139
141
  #include "RNIndoorLevel.hpp"
140
- #include "RNRegion.hpp"
141
- #include "RNLatLngBounds.hpp"
142
142
  #include <NitroModules/Promise.hpp>
143
143
  #include "RNSnapshotOptions.hpp"
144
144
  #include "RNSize.hpp"
@@ -332,11 +332,11 @@ namespace margelo::nitro::rngooglemapsplus {
332
332
  inline void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) noexcept override {
333
333
  _swiftPart.setOnMapReady(onMapReady);
334
334
  }
335
- inline std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() noexcept override {
335
+ inline std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> getOnMapLoaded() noexcept override {
336
336
  auto __result = _swiftPart.getOnMapLoaded();
337
337
  return __result;
338
338
  }
339
- inline void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) noexcept override {
339
+ inline void setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& onMapLoaded) noexcept override {
340
340
  _swiftPart.setOnMapLoaded(onMapLoaded);
341
341
  }
342
342
  inline std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() noexcept override {
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_RNRegion_RNCamera.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ region: RNRegion, _ camera: RNCamera) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_RNRegion_RNCamera {
16
+ public typealias bridge = margelo.nitro.rngooglemapsplus.bridge.swift
17
+
18
+ private let closure: (_ region: RNRegion, _ camera: RNCamera) -> Void
19
+
20
+ public init(_ closure: @escaping (_ region: RNRegion, _ camera: RNCamera) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(region: RNRegion, camera: RNCamera) -> Void {
26
+ self.closure(region, camera)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_RNRegion_RNCamera`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_RNRegion_RNCamera>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_RNRegion_RNCamera {
45
+ return Unmanaged<Func_void_RNRegion_RNCamera>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -32,7 +32,7 @@ public protocol HybridRNGoogleMapsPlusViewSpec_protocol: HybridObject, HybridVie
32
32
  var locationConfig: RNLocationConfig? { get set }
33
33
  var onMapError: ((_ error: RNMapErrorCode) -> Void)? { get set }
34
34
  var onMapReady: ((_ ready: Bool) -> Void)? { get set }
35
- var onMapLoaded: ((_ loaded: Bool) -> Void)? { get set }
35
+ var onMapLoaded: ((_ region: RNRegion, _ camera: RNCamera) -> Void)? { get set }
36
36
  var onLocationUpdate: ((_ location: RNLocation) -> Void)? { get set }
37
37
  var onLocationError: ((_ error: RNLocationErrorCode) -> Void)? { get set }
38
38
  var onMapPress: ((_ coordinate: RNLatLng) -> Void)? { get set }
@@ -619,14 +619,14 @@ open class HybridRNGoogleMapsPlusViewSpec_cxx {
619
619
  }
620
620
  }
621
621
 
622
- public final var onMapLoaded: bridge.std__optional_std__function_void_bool____loaded______ {
622
+ public final var onMapLoaded: bridge.std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______ {
623
623
  @inline(__always)
624
624
  get {
625
- return { () -> bridge.std__optional_std__function_void_bool____loaded______ in
625
+ return { () -> bridge.std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______ in
626
626
  if let __unwrappedValue = self.__implementation.onMapLoaded {
627
- return bridge.create_std__optional_std__function_void_bool____loaded______({ () -> bridge.Func_void_bool in
628
- let __closureWrapper = Func_void_bool(__unwrappedValue)
629
- return bridge.create_Func_void_bool(__closureWrapper.toUnsafe())
627
+ return bridge.create_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______({ () -> bridge.Func_void_RNRegion_RNCamera in
628
+ let __closureWrapper = Func_void_RNRegion_RNCamera(__unwrappedValue)
629
+ return bridge.create_Func_void_RNRegion_RNCamera(__closureWrapper.toUnsafe())
630
630
  }())
631
631
  } else {
632
632
  return .init()
@@ -635,13 +635,13 @@ open class HybridRNGoogleMapsPlusViewSpec_cxx {
635
635
  }
636
636
  @inline(__always)
637
637
  set {
638
- self.__implementation.onMapLoaded = { () -> ((_ loaded: Bool) -> Void)? in
639
- if bridge.has_value_std__optional_std__function_void_bool____loaded______(newValue) {
640
- let __unwrapped = bridge.get_std__optional_std__function_void_bool____loaded______(newValue)
641
- return { () -> (Bool) -> Void in
642
- let __wrappedFunction = bridge.wrap_Func_void_bool(__unwrapped)
643
- return { (__loaded: Bool) -> Void in
644
- __wrappedFunction.call(__loaded)
638
+ self.__implementation.onMapLoaded = { () -> ((_ region: RNRegion, _ camera: RNCamera) -> Void)? in
639
+ if bridge.has_value_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______(newValue) {
640
+ let __unwrapped = bridge.get_std__optional_std__function_void_const_RNRegion_____region_____const_RNCamera_____camera______(newValue)
641
+ return { () -> (RNRegion, RNCamera) -> Void in
642
+ let __wrappedFunction = bridge.wrap_Func_void_RNRegion_RNCamera(__unwrapped)
643
+ return { (__region: RNRegion, __camera: RNCamera) -> Void in
644
+ __wrappedFunction.call(__region, __camera)
645
645
  }
646
646
  }()
647
647
  } else {
@@ -43,6 +43,10 @@ namespace margelo::nitro::rngooglemapsplus { struct RNUrlTileOverlay; }
43
43
  namespace margelo::nitro::rngooglemapsplus { struct RNLocationConfig; }
44
44
  // Forward declaration of `RNMapErrorCode` to properly resolve imports.
45
45
  namespace margelo::nitro::rngooglemapsplus { enum class RNMapErrorCode; }
46
+ // Forward declaration of `RNRegion` to properly resolve imports.
47
+ namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
48
+ // Forward declaration of `RNCamera` to properly resolve imports.
49
+ namespace margelo::nitro::rngooglemapsplus { struct RNCamera; }
46
50
  // Forward declaration of `RNLocation` to properly resolve imports.
47
51
  namespace margelo::nitro::rngooglemapsplus { struct RNLocation; }
48
52
  // Forward declaration of `RNLocationErrorCode` to properly resolve imports.
@@ -53,10 +57,6 @@ namespace margelo::nitro::rngooglemapsplus { struct RNLatLng; }
53
57
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorBuilding; }
54
58
  // Forward declaration of `RNIndoorLevel` to properly resolve imports.
55
59
  namespace margelo::nitro::rngooglemapsplus { struct RNIndoorLevel; }
56
- // Forward declaration of `RNRegion` to properly resolve imports.
57
- namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
58
- // Forward declaration of `RNCamera` to properly resolve imports.
59
- namespace margelo::nitro::rngooglemapsplus { struct RNCamera; }
60
60
  // Forward declaration of `RNLatLngBounds` to properly resolve imports.
61
61
  namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
62
62
  // Forward declaration of `RNSnapshotOptions` to properly resolve imports.
@@ -83,13 +83,13 @@ namespace margelo::nitro::rngooglemapsplus { struct RNLocationPermissionResult;
83
83
  #include "RNLocationConfig.hpp"
84
84
  #include "RNMapErrorCode.hpp"
85
85
  #include <functional>
86
+ #include "RNRegion.hpp"
87
+ #include "RNCamera.hpp"
86
88
  #include "RNLocation.hpp"
87
89
  #include "RNLocationErrorCode.hpp"
88
90
  #include "RNLatLng.hpp"
89
91
  #include "RNIndoorBuilding.hpp"
90
92
  #include "RNIndoorLevel.hpp"
91
- #include "RNRegion.hpp"
92
- #include "RNCamera.hpp"
93
93
  #include "RNLatLngBounds.hpp"
94
94
  #include <NitroModules/Promise.hpp>
95
95
  #include "RNSnapshotOptions.hpp"
@@ -164,8 +164,8 @@ namespace margelo::nitro::rngooglemapsplus {
164
164
  virtual void setOnMapError(const std::optional<std::function<void(RNMapErrorCode /* error */)>>& onMapError) = 0;
165
165
  virtual std::optional<std::function<void(bool /* ready */)>> getOnMapReady() = 0;
166
166
  virtual void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) = 0;
167
- virtual std::optional<std::function<void(bool /* loaded */)>> getOnMapLoaded() = 0;
168
- virtual void setOnMapLoaded(const std::optional<std::function<void(bool /* loaded */)>>& onMapLoaded) = 0;
167
+ virtual std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>> getOnMapLoaded() = 0;
168
+ virtual void setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>& onMapLoaded) = 0;
169
169
  virtual std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() = 0;
170
170
  virtual void setOnLocationUpdate(const std::optional<std::function<void(const RNLocation& /* location */)>>& onLocationUpdate) = 0;
171
171
  virtual std::optional<std::function<void(RNLocationErrorCode /* error */)>> getOnLocationError() = 0;
@@ -235,12 +235,12 @@ namespace margelo::nitro::rngooglemapsplus::views {
235
235
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapReady: ") + exc.what());
236
236
  }
237
237
  }()),
238
- onMapLoaded([&]() -> CachedProp<std::optional<std::function<void(bool /* loaded */)>>> {
238
+ onMapLoaded([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>> {
239
239
  try {
240
240
  const react::RawValue* rawValue = rawProps.at("onMapLoaded", nullptr, nullptr);
241
241
  if (rawValue == nullptr) return sourceProps.onMapLoaded;
242
242
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
243
- return CachedProp<std::optional<std::function<void(bool /* loaded */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapLoaded);
243
+ return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapLoaded);
244
244
  } catch (const std::exception& exc) {
245
245
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapLoaded: ") + exc.what());
246
246
  }
@@ -35,13 +35,13 @@
35
35
  #include "RNLocationConfig.hpp"
36
36
  #include "RNMapErrorCode.hpp"
37
37
  #include <functional>
38
+ #include "RNRegion.hpp"
39
+ #include "RNCamera.hpp"
38
40
  #include "RNLocation.hpp"
39
41
  #include "RNLocationErrorCode.hpp"
40
42
  #include "RNLatLng.hpp"
41
43
  #include "RNIndoorBuilding.hpp"
42
44
  #include "RNIndoorLevel.hpp"
43
- #include "RNRegion.hpp"
44
- #include "RNCamera.hpp"
45
45
  #include <memory>
46
46
  #include "HybridRNGoogleMapsPlusViewSpec.hpp"
47
47
 
@@ -87,7 +87,7 @@ namespace margelo::nitro::rngooglemapsplus::views {
87
87
  CachedProp<std::optional<RNLocationConfig>> locationConfig;
88
88
  CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>> onMapError;
89
89
  CachedProp<std::optional<std::function<void(bool /* ready */)>>> onMapReady;
90
- CachedProp<std::optional<std::function<void(bool /* loaded */)>>> onMapLoaded;
90
+ CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>> onMapLoaded;
91
91
  CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> onLocationUpdate;
92
92
  CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>> onLocationError;
93
93
  CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> onMapPress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-maps-plus",
3
- "version": "1.7.0-dev.7",
3
+ "version": "1.7.0-dev.8",
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",
@@ -8,7 +8,9 @@
8
8
  "source": "src/index",
9
9
  "react-native": "src/index",
10
10
  "scripts": {
11
- "typecheck": "tsc --noEmit",
11
+ "typecheck:lib": "tsc --noEmit -p tsconfig.json",
12
+ "typecheck:example": "tsc --noEmit -p example/tsconfig.json",
13
+ "typecheck": "yarn typecheck:lib && yarn typecheck:example",
12
14
  "lint": "yarn lint:js && yarn lint:android && yarn lint:ios",
13
15
  "lint:js": "eslint . --max-warnings 0 && yarn prettier --check .",
14
16
  "lint:android": "cd android && ktlint -F ./**/*.kt*",
@@ -53,7 +53,7 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
53
53
  locationConfig?: RNLocationConfig;
54
54
  onMapError?: (error: RNMapErrorCode) => void;
55
55
  onMapReady?: (ready: boolean) => void;
56
- onMapLoaded?: (loaded: boolean) => void;
56
+ onMapLoaded?: (region: RNRegion, camera: RNCamera) => void;
57
57
  onLocationUpdate?: (location: RNLocation) => void;
58
58
  onLocationError?: (error: RNLocationErrorCode) => void;
59
59
  onMapPress?: (coordinate: RNLatLng) => void;