react-native-google-maps-plus 1.12.0-dev.4 → 1.12.0

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 (82) hide show
  1. package/README.md +1 -1
  2. package/RNGoogleMapsPlus.podspec +1 -1
  3. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  4. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +11 -11
  5. package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +2 -2
  6. package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +1 -1
  7. package/android/src/main/java/com/rngooglemapsplus/PlayServicesHandler.kt +1 -1
  8. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +2 -3
  9. package/ios/GoogleMapViewImpl.swift +0 -1
  10. package/ios/RNGoogleMapsPlusView.swift +1 -1
  11. package/nitro.json +16 -4
  12. package/nitrogen/generated/android/RNGoogleMapsPlusOnLoad.cpp +52 -36
  13. package/nitrogen/generated/android/RNGoogleMapsPlusOnLoad.hpp +13 -4
  14. package/nitrogen/generated/android/c++/JFunc_void_RNIndoorBuilding.hpp +2 -2
  15. package/nitrogen/generated/android/c++/JFunc_void_RNIndoorLevel.hpp +2 -2
  16. package/nitrogen/generated/android/c++/JFunc_void_RNLatLng.hpp +2 -2
  17. package/nitrogen/generated/android/c++/JFunc_void_RNLocation.hpp +2 -2
  18. package/nitrogen/generated/android/c++/JFunc_void_RNLocationErrorCode.hpp +2 -2
  19. package/nitrogen/generated/android/c++/JFunc_void_RNMapErrorCode_std__string.hpp +2 -2
  20. package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera.hpp +2 -2
  21. package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera_bool.hpp +2 -2
  22. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +2 -2
  23. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +2 -2
  24. package/nitrogen/generated/android/c++/JFunc_void_std__string_RNLatLng.hpp +2 -2
  25. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_RNLatLng.hpp +2 -2
  26. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusModuleSpec.cpp +22 -28
  27. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusModuleSpec.hpp +19 -22
  28. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +119 -125
  29. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +19 -22
  30. package/nitrogen/generated/android/c++/JRNAndroidLocationConfig.hpp +1 -1
  31. package/nitrogen/generated/android/c++/JRNAndroidLocationPermissionResult.hpp +1 -1
  32. package/nitrogen/generated/android/c++/JRNAndroidLocationPriority.hpp +1 -1
  33. package/nitrogen/generated/android/c++/JRNCamera.hpp +1 -1
  34. package/nitrogen/generated/android/c++/JRNCameraUpdate.hpp +1 -1
  35. package/nitrogen/generated/android/c++/JRNCircle.hpp +1 -1
  36. package/nitrogen/generated/android/c++/JRNHeatmap.hpp +1 -1
  37. package/nitrogen/generated/android/c++/JRNHeatmapGradient.hpp +1 -1
  38. package/nitrogen/generated/android/c++/JRNHeatmapPoint.hpp +1 -1
  39. package/nitrogen/generated/android/c++/JRNIOSLocationAccuracy.hpp +1 -1
  40. package/nitrogen/generated/android/c++/JRNIOSLocationActivityType.hpp +1 -1
  41. package/nitrogen/generated/android/c++/JRNIOSLocationConfig.hpp +1 -1
  42. package/nitrogen/generated/android/c++/JRNIOSPermissionResult.hpp +1 -1
  43. package/nitrogen/generated/android/c++/JRNIndoorBuilding.hpp +1 -1
  44. package/nitrogen/generated/android/c++/JRNIndoorLevel.hpp +1 -1
  45. package/nitrogen/generated/android/c++/JRNInitialProps.hpp +1 -1
  46. package/nitrogen/generated/android/c++/JRNKMLayer.hpp +1 -1
  47. package/nitrogen/generated/android/c++/JRNLatLng.hpp +1 -1
  48. package/nitrogen/generated/android/c++/JRNLatLngBounds.hpp +1 -1
  49. package/nitrogen/generated/android/c++/JRNLineCapType.hpp +1 -1
  50. package/nitrogen/generated/android/c++/JRNLineJoinType.hpp +1 -1
  51. package/nitrogen/generated/android/c++/JRNLocation.hpp +1 -1
  52. package/nitrogen/generated/android/c++/JRNLocationAndroid.hpp +1 -1
  53. package/nitrogen/generated/android/c++/JRNLocationConfig.hpp +1 -1
  54. package/nitrogen/generated/android/c++/JRNLocationErrorCode.hpp +1 -1
  55. package/nitrogen/generated/android/c++/JRNLocationIOS.hpp +1 -1
  56. package/nitrogen/generated/android/c++/JRNLocationPermissionResult.hpp +1 -1
  57. package/nitrogen/generated/android/c++/JRNMapErrorCode.hpp +1 -1
  58. package/nitrogen/generated/android/c++/JRNMapPadding.hpp +1 -1
  59. package/nitrogen/generated/android/c++/JRNMapType.hpp +1 -1
  60. package/nitrogen/generated/android/c++/JRNMapUiSettings.hpp +1 -1
  61. package/nitrogen/generated/android/c++/JRNMapZoomConfig.hpp +1 -1
  62. package/nitrogen/generated/android/c++/JRNMarker.hpp +1 -1
  63. package/nitrogen/generated/android/c++/JRNMarkerSvg.hpp +1 -1
  64. package/nitrogen/generated/android/c++/JRNPolygon.hpp +1 -1
  65. package/nitrogen/generated/android/c++/JRNPolygonHole.hpp +1 -1
  66. package/nitrogen/generated/android/c++/JRNPolyline.hpp +1 -1
  67. package/nitrogen/generated/android/c++/JRNPosition.hpp +1 -1
  68. package/nitrogen/generated/android/c++/JRNRegion.hpp +1 -1
  69. package/nitrogen/generated/android/c++/JRNSize.hpp +1 -1
  70. package/nitrogen/generated/android/c++/JRNSnapshotFormat.hpp +1 -1
  71. package/nitrogen/generated/android/c++/JRNSnapshotOptions.hpp +1 -1
  72. package/nitrogen/generated/android/c++/JRNSnapshotResultType.hpp +1 -1
  73. package/nitrogen/generated/android/c++/JRNUrlTileOverlay.hpp +1 -1
  74. package/nitrogen/generated/android/c++/JRNUserInterfaceStyle.hpp +1 -1
  75. package/nitrogen/generated/android/c++/views/JHybridRNGoogleMapsPlusViewStateUpdater.cpp +48 -49
  76. package/nitrogen/generated/android/c++/views/JHybridRNGoogleMapsPlusViewStateUpdater.hpp +1 -1
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusModuleSpec.kt +15 -18
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +16 -18
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt +12 -10
  80. package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +15 -9
  81. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +4 -0
  82. package/package.json +23 -23
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Dev Release](https://img.shields.io/npm/v/react-native-google-maps-plus/dev.svg?label=dev%20release&color=orange)](https://www.npmjs.com/package/react-native-google-maps-plus)
5
5
  [![Build](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml/badge.svg)](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml)
6
6
  [![API Docs](https://img.shields.io/static/v1?label=typedoc&message=docs&color=informational)](https://pinpong.github.io/react-native-google-maps-plus)
7
- ![React Native](https://img.shields.io/badge/react--native-%3E%3D0.81.0-61dafb.svg?logo=react)
7
+ ![React Native](https://img.shields.io/badge/react--native-%3E%3D0.82.0-61dafb.svg?logo=react)
8
8
 
9
9
  React Native wrapper for Android & iOS Google Maps SDK.
10
10
 
@@ -24,7 +24,7 @@ Pod::Spec.new do |s|
24
24
  s.dependency 'React-jsi'
25
25
  s.dependency 'React-callinvoker'
26
26
 
27
- s.dependency 'GoogleMaps', '10.8.0'
27
+ s.dependency 'GoogleMaps', '10.10.0'
28
28
  s.dependency 'Google-Maps-iOS-Utils', '7.0.0'
29
29
  s.dependency 'SVGKit', '3.0.0'
30
30
 
@@ -1,6 +1,9 @@
1
+ #include <fbjni/fbjni.h>
1
2
  #include <jni.h>
2
3
  #include "RNGoogleMapsPlusOnLoad.hpp"
3
4
 
4
5
  JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
5
- return margelo::nitro::rngooglemapsplus::initialize(vm);
6
+ return facebook::jni::initialize(vm, []() {
7
+ margelo::nitro::rngooglemapsplus::registerAllNatives();
8
+ });
6
9
  }
@@ -57,11 +57,11 @@ import java.io.ByteArrayInputStream
57
57
  import java.nio.charset.StandardCharsets
58
58
 
59
59
  class GoogleMapsViewImpl(
60
- val reactContext: ThemedReactContext,
61
- val locationHandler: LocationHandler,
62
- val playServiceHandler: PlayServicesHandler,
63
- val markerBuilder: MapMarkerBuilder,
64
- val mapErrorHandler: MapErrorHandler,
60
+ private val reactContext: ThemedReactContext,
61
+ private val locationHandler: LocationHandler,
62
+ private val playServiceHandler: PlayServicesHandler,
63
+ private val markerBuilder: MapMarkerBuilder,
64
+ private val mapErrorHandler: MapErrorHandler,
65
65
  ) : FrameLayout(reactContext),
66
66
  GoogleMap.OnCameraMoveStartedListener,
67
67
  GoogleMap.OnCameraMoveListener,
@@ -96,7 +96,7 @@ class GoogleMapsViewImpl(
96
96
  private val pendingCircles = mutableListOf<Pair<String, CircleOptions>>()
97
97
  private val pendingHeatmaps = mutableListOf<Pair<String, TileOverlayOptions>>()
98
98
  private val pendingKmlLayers = mutableListOf<Pair<String, String>>()
99
- private val pendingUrlTilesOverlays = mutableListOf<Pair<String, TileOverlayOptions>>()
99
+ private val pendingUrlTileOverlays = mutableListOf<Pair<String, TileOverlayOptions>>()
100
100
 
101
101
  private val markersById = mutableMapOf<String, Marker>()
102
102
  private val polylinesById = mutableMapOf<String, Polyline>()
@@ -268,9 +268,9 @@ class GoogleMapsViewImpl(
268
268
  pendingKmlLayers.forEach { (id, str) -> addKmlLayerInternal(id, str) }
269
269
  pendingKmlLayers.clear()
270
270
  }
271
- if (pendingUrlTilesOverlays.isNotEmpty()) {
272
- pendingUrlTilesOverlays.forEach { (id, opts) -> addUrlTileOverlayInternal(id, opts) }
273
- pendingUrlTilesOverlays.clear()
271
+ if (pendingUrlTileOverlays.isNotEmpty()) {
272
+ pendingUrlTileOverlays.forEach { (id, opts) -> addUrlTileOverlayInternal(id, opts) }
273
+ pendingUrlTileOverlays.clear()
274
274
  }
275
275
  }
276
276
 
@@ -775,7 +775,7 @@ class GoogleMapsViewImpl(
775
775
  opts: TileOverlayOptions,
776
776
  ) = onUi {
777
777
  if (googleMap == null) {
778
- pendingUrlTilesOverlays.add(id to opts)
778
+ pendingUrlTileOverlays.add(id to opts)
779
779
  return@onUi
780
780
  }
781
781
  urlTileOverlaysById.remove(id)?.remove()
@@ -805,7 +805,7 @@ class GoogleMapsViewImpl(
805
805
  it.remove()
806
806
  }
807
807
  urlTileOverlaysById.clear()
808
- pendingUrlTilesOverlays.clear()
808
+ pendingUrlTileOverlays.clear()
809
809
  }
810
810
 
811
811
  fun destroyInternal() =
@@ -27,7 +27,7 @@ private const val INTERVAL_DEFAULT = 600000L
27
27
  private const val MIN_UPDATE_INTERVAL = 3600000L
28
28
 
29
29
  class LocationHandler(
30
- val context: ReactContext,
30
+ private val context: ReactContext,
31
31
  ) : LocationSource {
32
32
  private val fusedLocationClientProviderClient: FusedLocationProviderClient =
33
33
  LocationServices.getFusedLocationProviderClient(context)
@@ -68,7 +68,7 @@ class LocationHandler(
68
68
  val activity = context.currentActivity ?: run { return@onUi }
69
69
 
70
70
  val lr =
71
- if (Build.VERSION.SDK_INT >= 31) {
71
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
72
72
  LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 10_000L).build()
73
73
  } else {
74
74
  @Suppress("DEPRECATION")
@@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap
42
42
  import kotlin.coroutines.cancellation.CancellationException
43
43
 
44
44
  class MapMarkerBuilder(
45
- val context: ThemedReactContext,
45
+ private val context: ThemedReactContext,
46
46
  private val mapErrorHandler: MapErrorHandler,
47
47
  private val scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default),
48
48
  ) {
@@ -5,7 +5,7 @@ import com.google.android.gms.common.ConnectionResult
5
5
  import com.google.android.gms.common.GoogleApiAvailability
6
6
 
7
7
  class PlayServicesHandler(
8
- val context: ReactContext,
8
+ private val context: ReactContext,
9
9
  ) {
10
10
  fun playServicesAvailability(): Int {
11
11
  val availability = GoogleApiAvailability.getInstance()
@@ -22,7 +22,7 @@ import com.rngooglemapsplus.extensions.toSize
22
22
 
23
23
  @DoNotStrip
24
24
  class RNGoogleMapsPlusView(
25
- val context: ThemedReactContext,
25
+ private val context: ThemedReactContext,
26
26
  ) : HybridRNGoogleMapsPlusViewSpec() {
27
27
  private val mapErrorHandler = MapErrorHandler()
28
28
 
@@ -41,9 +41,8 @@ class RNGoogleMapsPlusView(
41
41
  override val view =
42
42
  GoogleMapsViewImpl(context, locationHandler, playServiceHandler, markerBuilder, mapErrorHandler)
43
43
 
44
- override fun dispose() {
44
+ override fun onDropView() {
45
45
  view.destroyInternal()
46
- super.dispose()
47
46
  }
48
47
 
49
48
  override var initialProps: RNInitialProps? = null
@@ -322,7 +322,6 @@ GMSIndoorDisplayDelegate {
322
322
  }
323
323
  }
324
324
 
325
- var onMapError: ((RNMapErrorCode) -> Void)?
326
325
  var onMapReady: ((Bool) -> Void)?
327
326
  var onMapLoaded: ((RNRegion, RNCamera) -> Void)?
328
327
  var onLocationUpdate: ((RNLocation) -> Void)?
@@ -34,7 +34,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
34
34
  )
35
35
  }
36
36
 
37
- func dispose() {
37
+ func onDropView() {
38
38
  impl.deinitInternal()
39
39
  }
40
40
 
package/nitro.json CHANGED
@@ -16,12 +16,24 @@
16
16
  ],
17
17
  "autolinking": {
18
18
  "RNGoogleMapsPlusView": {
19
- "swift": "RNGoogleMapsPlusView",
20
- "kotlin": "RNGoogleMapsPlusView"
19
+ "ios": {
20
+ "language": "swift",
21
+ "implementationClassName": "RNGoogleMapsPlusView"
22
+ },
23
+ "android": {
24
+ "language": "kotlin",
25
+ "implementationClassName": "RNGoogleMapsPlusView"
26
+ }
21
27
  },
22
28
  "RNGoogleMapsPlusModule": {
23
- "swift": "RNGoogleMapsPlusModule",
24
- "kotlin": "RNGoogleMapsPlusModule"
29
+ "ios": {
30
+ "language": "swift",
31
+ "implementationClassName": "RNGoogleMapsPlusModule"
32
+ },
33
+ "android": {
34
+ "language": "kotlin",
35
+ "implementationClassName": "RNGoogleMapsPlusModule"
36
+ }
25
37
  }
26
38
  },
27
39
  "ignorePaths": ["**/node_modules"]
@@ -35,46 +35,62 @@
35
35
  namespace margelo::nitro::rngooglemapsplus {
36
36
 
37
37
  int initialize(JavaVM* vm) {
38
+ return facebook::jni::initialize(vm, []() {
39
+ ::margelo::nitro::rngooglemapsplus::registerAllNatives();
40
+ });
41
+ }
42
+
43
+ struct JHybridRNGoogleMapsPlusViewSpecImpl: public jni::JavaClass<JHybridRNGoogleMapsPlusViewSpecImpl, JHybridRNGoogleMapsPlusViewSpec::JavaPart> {
44
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/RNGoogleMapsPlusView;";
45
+ static std::shared_ptr<JHybridRNGoogleMapsPlusViewSpec> create() {
46
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridRNGoogleMapsPlusViewSpecImpl::javaobject()>();
47
+ jni::local_ref<JHybridRNGoogleMapsPlusViewSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
48
+ return javaPart->getJHybridRNGoogleMapsPlusViewSpec();
49
+ }
50
+ };
51
+ struct JHybridRNGoogleMapsPlusModuleSpecImpl: public jni::JavaClass<JHybridRNGoogleMapsPlusModuleSpecImpl, JHybridRNGoogleMapsPlusModuleSpec::JavaPart> {
52
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/RNGoogleMapsPlusModule;";
53
+ static std::shared_ptr<JHybridRNGoogleMapsPlusModuleSpec> create() {
54
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridRNGoogleMapsPlusModuleSpecImpl::javaobject()>();
55
+ jni::local_ref<JHybridRNGoogleMapsPlusModuleSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
56
+ return javaPart->getJHybridRNGoogleMapsPlusModuleSpec();
57
+ }
58
+ };
59
+
60
+ void registerAllNatives() {
38
61
  using namespace margelo::nitro;
39
62
  using namespace margelo::nitro::rngooglemapsplus;
40
- using namespace facebook;
41
63
 
42
- return facebook::jni::initialize(vm, [] {
43
- // Register native JNI methods
44
- margelo::nitro::rngooglemapsplus::JHybridRNGoogleMapsPlusModuleSpec::registerNatives();
45
- margelo::nitro::rngooglemapsplus::JHybridRNGoogleMapsPlusViewSpec::registerNatives();
46
- margelo::nitro::rngooglemapsplus::JFunc_void_RNMapErrorCode_std__string_cxx::registerNatives();
47
- margelo::nitro::rngooglemapsplus::JFunc_void_bool_cxx::registerNatives();
48
- margelo::nitro::rngooglemapsplus::JFunc_void_RNRegion_RNCamera_cxx::registerNatives();
49
- margelo::nitro::rngooglemapsplus::JFunc_void_RNLocation_cxx::registerNatives();
50
- margelo::nitro::rngooglemapsplus::JFunc_void_RNLocationErrorCode_cxx::registerNatives();
51
- margelo::nitro::rngooglemapsplus::JFunc_void_RNLatLng_cxx::registerNatives();
52
- margelo::nitro::rngooglemapsplus::JFunc_void_std__string_std__string_RNLatLng_cxx::registerNatives();
53
- margelo::nitro::rngooglemapsplus::JFunc_void_std__string_cxx::registerNatives();
54
- margelo::nitro::rngooglemapsplus::JFunc_void_std__string_RNLatLng_cxx::registerNatives();
55
- margelo::nitro::rngooglemapsplus::JFunc_void_RNIndoorBuilding_cxx::registerNatives();
56
- margelo::nitro::rngooglemapsplus::JFunc_void_RNIndoorLevel_cxx::registerNatives();
57
- margelo::nitro::rngooglemapsplus::JFunc_void_RNRegion_RNCamera_bool_cxx::registerNatives();
58
- margelo::nitro::rngooglemapsplus::views::JHybridRNGoogleMapsPlusViewStateUpdater::registerNatives();
64
+ // Register native JNI methods
65
+ margelo::nitro::rngooglemapsplus::JHybridRNGoogleMapsPlusModuleSpec::CxxPart::registerNatives();
66
+ margelo::nitro::rngooglemapsplus::JHybridRNGoogleMapsPlusViewSpec::CxxPart::registerNatives();
67
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNMapErrorCode_std__string_cxx::registerNatives();
68
+ margelo::nitro::rngooglemapsplus::JFunc_void_bool_cxx::registerNatives();
69
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNRegion_RNCamera_cxx::registerNatives();
70
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNLocation_cxx::registerNatives();
71
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNLocationErrorCode_cxx::registerNatives();
72
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNLatLng_cxx::registerNatives();
73
+ margelo::nitro::rngooglemapsplus::JFunc_void_std__string_std__string_RNLatLng_cxx::registerNatives();
74
+ margelo::nitro::rngooglemapsplus::JFunc_void_std__string_cxx::registerNatives();
75
+ margelo::nitro::rngooglemapsplus::JFunc_void_std__string_RNLatLng_cxx::registerNatives();
76
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNIndoorBuilding_cxx::registerNatives();
77
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNIndoorLevel_cxx::registerNatives();
78
+ margelo::nitro::rngooglemapsplus::JFunc_void_RNRegion_RNCamera_bool_cxx::registerNatives();
79
+ margelo::nitro::rngooglemapsplus::views::JHybridRNGoogleMapsPlusViewStateUpdater::registerNatives();
59
80
 
60
- // Register Nitro Hybrid Objects
61
- HybridObjectRegistry::registerHybridObjectConstructor(
62
- "RNGoogleMapsPlusView",
63
- []() -> std::shared_ptr<HybridObject> {
64
- static DefaultConstructableObject<JHybridRNGoogleMapsPlusViewSpec::javaobject> object("com/rngooglemapsplus/RNGoogleMapsPlusView");
65
- auto instance = object.create();
66
- return instance->cthis()->shared();
67
- }
68
- );
69
- HybridObjectRegistry::registerHybridObjectConstructor(
70
- "RNGoogleMapsPlusModule",
71
- []() -> std::shared_ptr<HybridObject> {
72
- static DefaultConstructableObject<JHybridRNGoogleMapsPlusModuleSpec::javaobject> object("com/rngooglemapsplus/RNGoogleMapsPlusModule");
73
- auto instance = object.create();
74
- return instance->cthis()->shared();
75
- }
76
- );
77
- });
81
+ // Register Nitro Hybrid Objects
82
+ HybridObjectRegistry::registerHybridObjectConstructor(
83
+ "RNGoogleMapsPlusView",
84
+ []() -> std::shared_ptr<HybridObject> {
85
+ return JHybridRNGoogleMapsPlusViewSpecImpl::create();
86
+ }
87
+ );
88
+ HybridObjectRegistry::registerHybridObjectConstructor(
89
+ "RNGoogleMapsPlusModule",
90
+ []() -> std::shared_ptr<HybridObject> {
91
+ return JHybridRNGoogleMapsPlusModuleSpecImpl::create();
92
+ }
93
+ );
78
94
  }
79
95
 
80
96
  } // namespace margelo::nitro::rngooglemapsplus
@@ -6,20 +6,29 @@
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::rngooglemapsplus {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of RNGoogleMapsPlus, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of RNGoogleMapsPlus, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::rngooglemapsplus::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all RNGoogleMapsPlus HybridObjects
26
+ * margelo::nitro::rngooglemapsplus::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::rngooglemapsplus
@@ -30,7 +30,7 @@ namespace margelo::nitro::rngooglemapsplus {
30
30
  */
31
31
  struct JFunc_void_RNIndoorBuilding: public jni::JavaClass<JFunc_void_RNIndoorBuilding> {
32
32
  public:
33
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorBuilding;";
33
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorBuilding;";
34
34
 
35
35
  public:
36
36
  /**
@@ -66,7 +66,7 @@ namespace margelo::nitro::rngooglemapsplus {
66
66
  }
67
67
 
68
68
  public:
69
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorBuilding_cxx;";
69
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorBuilding_cxx;";
70
70
  static void registerNatives() {
71
71
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNIndoorBuilding_cxx::invoke_cxx)});
72
72
  }
@@ -27,7 +27,7 @@ namespace margelo::nitro::rngooglemapsplus {
27
27
  */
28
28
  struct JFunc_void_RNIndoorLevel: public jni::JavaClass<JFunc_void_RNIndoorLevel> {
29
29
  public:
30
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorLevel;";
30
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorLevel;";
31
31
 
32
32
  public:
33
33
  /**
@@ -63,7 +63,7 @@ namespace margelo::nitro::rngooglemapsplus {
63
63
  }
64
64
 
65
65
  public:
66
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorLevel_cxx;";
66
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNIndoorLevel_cxx;";
67
67
  static void registerNatives() {
68
68
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNIndoorLevel_cxx::invoke_cxx)});
69
69
  }
@@ -25,7 +25,7 @@ namespace margelo::nitro::rngooglemapsplus {
25
25
  */
26
26
  struct JFunc_void_RNLatLng: public jni::JavaClass<JFunc_void_RNLatLng> {
27
27
  public:
28
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLatLng;";
28
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLatLng;";
29
29
 
30
30
  public:
31
31
  /**
@@ -61,7 +61,7 @@ namespace margelo::nitro::rngooglemapsplus {
61
61
  }
62
62
 
63
63
  public:
64
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLatLng_cxx;";
64
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLatLng_cxx;";
65
65
  static void registerNatives() {
66
66
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNLatLng_cxx::invoke_cxx)});
67
67
  }
@@ -33,7 +33,7 @@ namespace margelo::nitro::rngooglemapsplus {
33
33
  */
34
34
  struct JFunc_void_RNLocation: public jni::JavaClass<JFunc_void_RNLocation> {
35
35
  public:
36
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocation;";
36
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocation;";
37
37
 
38
38
  public:
39
39
  /**
@@ -69,7 +69,7 @@ namespace margelo::nitro::rngooglemapsplus {
69
69
  }
70
70
 
71
71
  public:
72
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocation_cxx;";
72
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocation_cxx;";
73
73
  static void registerNatives() {
74
74
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNLocation_cxx::invoke_cxx)});
75
75
  }
@@ -25,7 +25,7 @@ namespace margelo::nitro::rngooglemapsplus {
25
25
  */
26
26
  struct JFunc_void_RNLocationErrorCode: public jni::JavaClass<JFunc_void_RNLocationErrorCode> {
27
27
  public:
28
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocationErrorCode;";
28
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocationErrorCode;";
29
29
 
30
30
  public:
31
31
  /**
@@ -61,7 +61,7 @@ namespace margelo::nitro::rngooglemapsplus {
61
61
  }
62
62
 
63
63
  public:
64
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocationErrorCode_cxx;";
64
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNLocationErrorCode_cxx;";
65
65
  static void registerNatives() {
66
66
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNLocationErrorCode_cxx::invoke_cxx)});
67
67
  }
@@ -26,7 +26,7 @@ namespace margelo::nitro::rngooglemapsplus {
26
26
  */
27
27
  struct JFunc_void_RNMapErrorCode_std__string: public jni::JavaClass<JFunc_void_RNMapErrorCode_std__string> {
28
28
  public:
29
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNMapErrorCode_std__string;";
29
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNMapErrorCode_std__string;";
30
30
 
31
31
  public:
32
32
  /**
@@ -62,7 +62,7 @@ namespace margelo::nitro::rngooglemapsplus {
62
62
  }
63
63
 
64
64
  public:
65
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNMapErrorCode_std__string_cxx;";
65
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNMapErrorCode_std__string_cxx;";
66
66
  static void registerNatives() {
67
67
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNMapErrorCode_std__string_cxx::invoke_cxx)});
68
68
  }
@@ -31,7 +31,7 @@ namespace margelo::nitro::rngooglemapsplus {
31
31
  */
32
32
  struct JFunc_void_RNRegion_RNCamera: public jni::JavaClass<JFunc_void_RNRegion_RNCamera> {
33
33
  public:
34
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera;";
34
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera;";
35
35
 
36
36
  public:
37
37
  /**
@@ -67,7 +67,7 @@ namespace margelo::nitro::rngooglemapsplus {
67
67
  }
68
68
 
69
69
  public:
70
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_cxx;";
70
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_cxx;";
71
71
  static void registerNatives() {
72
72
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNRegion_RNCamera_cxx::invoke_cxx)});
73
73
  }
@@ -31,7 +31,7 @@ namespace margelo::nitro::rngooglemapsplus {
31
31
  */
32
32
  struct JFunc_void_RNRegion_RNCamera_bool: public jni::JavaClass<JFunc_void_RNRegion_RNCamera_bool> {
33
33
  public:
34
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool;";
34
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool;";
35
35
 
36
36
  public:
37
37
  /**
@@ -67,7 +67,7 @@ namespace margelo::nitro::rngooglemapsplus {
67
67
  }
68
68
 
69
69
  public:
70
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool_cxx;";
70
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool_cxx;";
71
71
  static void registerNatives() {
72
72
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNRegion_RNCamera_bool_cxx::invoke_cxx)});
73
73
  }
@@ -23,7 +23,7 @@ namespace margelo::nitro::rngooglemapsplus {
23
23
  */
24
24
  struct JFunc_void_bool: public jni::JavaClass<JFunc_void_bool> {
25
25
  public:
26
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_bool;";
26
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_bool;";
27
27
 
28
28
  public:
29
29
  /**
@@ -59,7 +59,7 @@ namespace margelo::nitro::rngooglemapsplus {
59
59
  }
60
60
 
61
61
  public:
62
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_bool_cxx;";
62
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_bool_cxx;";
63
63
  static void registerNatives() {
64
64
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_bool_cxx::invoke_cxx)});
65
65
  }
@@ -24,7 +24,7 @@ namespace margelo::nitro::rngooglemapsplus {
24
24
  */
25
25
  struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
26
26
  public:
27
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string;";
27
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string;";
28
28
 
29
29
  public:
30
30
  /**
@@ -60,7 +60,7 @@ namespace margelo::nitro::rngooglemapsplus {
60
60
  }
61
61
 
62
62
  public:
63
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_cxx;";
63
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_cxx;";
64
64
  static void registerNatives() {
65
65
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
66
66
  }
@@ -26,7 +26,7 @@ namespace margelo::nitro::rngooglemapsplus {
26
26
  */
27
27
  struct JFunc_void_std__string_RNLatLng: public jni::JavaClass<JFunc_void_std__string_RNLatLng> {
28
28
  public:
29
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_RNLatLng;";
29
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_RNLatLng;";
30
30
 
31
31
  public:
32
32
  /**
@@ -62,7 +62,7 @@ namespace margelo::nitro::rngooglemapsplus {
62
62
  }
63
63
 
64
64
  public:
65
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_RNLatLng_cxx;";
65
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_RNLatLng_cxx;";
66
66
  static void registerNatives() {
67
67
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_RNLatLng_cxx::invoke_cxx)});
68
68
  }
@@ -26,7 +26,7 @@ namespace margelo::nitro::rngooglemapsplus {
26
26
  */
27
27
  struct JFunc_void_std__string_std__string_RNLatLng: public jni::JavaClass<JFunc_void_std__string_std__string_RNLatLng> {
28
28
  public:
29
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_std__string_RNLatLng;";
29
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_std__string_RNLatLng;";
30
30
 
31
31
  public:
32
32
  /**
@@ -62,7 +62,7 @@ namespace margelo::nitro::rngooglemapsplus {
62
62
  }
63
63
 
64
64
  public:
65
- static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_std__string_RNLatLng_cxx;";
65
+ static constexpr auto kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_std__string_std__string_RNLatLng_cxx;";
66
66
  static void registerNatives() {
67
67
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__string_RNLatLng_cxx::invoke_cxx)});
68
68
  }