react-native-google-maps-plus 0.1.0 → 1.0.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.
- package/GoogleMapsNitro.podspec +34 -0
- package/LICENSE +20 -0
- package/README.md +40 -0
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +135 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +8 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/googlemapsnitro/Color.kt +65 -0
- package/android/src/main/java/com/googlemapsnitro/GoogleMapsNitroPackage.kt +35 -0
- package/android/src/main/java/com/googlemapsnitro/GoogleMapsNitroViewImpl.kt +720 -0
- package/android/src/main/java/com/googlemapsnitro/HybridGoogleMapsNitroModule.kt +22 -0
- package/android/src/main/java/com/googlemapsnitro/HybridGoogleMapsNitroView.kt +337 -0
- package/android/src/main/java/com/googlemapsnitro/LocationHandler.kt +205 -0
- package/android/src/main/java/com/googlemapsnitro/MapMarker.kt +145 -0
- package/android/src/main/java/com/googlemapsnitro/MapPolygon.kt +36 -0
- package/android/src/main/java/com/googlemapsnitro/MapPolyline.kt +59 -0
- package/android/src/main/java/com/googlemapsnitro/PermissionHandler.kt +116 -0
- package/android/src/main/java/com/googlemapsnitro/PlayServicesHandler.kt +25 -0
- package/ios/Color.swift +109 -0
- package/ios/GoogleMapNitroViewImpl.swift +590 -0
- package/ios/HybridGoogleMapsNitroModule.swift +27 -0
- package/ios/HybridGoogleMapsNitroView.swift +348 -0
- package/ios/LocationHandler.swift +205 -0
- package/ios/MapHelper.swift +18 -0
- package/ios/MapMarker.swift +207 -0
- package/ios/MapPolygon.swift +55 -0
- package/ios/MapPolyline.swift +83 -0
- package/ios/PermissionHandler.swift +73 -0
- package/lib/module/GoogleMapsNitroModule.nitro.js +4 -0
- package/lib/module/GoogleMapsNitroModule.nitro.js.map +1 -0
- package/lib/module/GoogleMapsNitroView.nitro.js +4 -0
- package/lib/module/GoogleMapsNitroView.nitro.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +78 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/GoogleMapsNitroModule.nitro.d.ts +12 -0
- package/lib/typescript/src/GoogleMapsNitroModule.nitro.d.ts.map +1 -0
- package/lib/typescript/src/GoogleMapsNitroView.nitro.d.ts +34 -0
- package/lib/typescript/src/GoogleMapsNitroView.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +113 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/nitro.json +28 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/GoogleMapsNitro+autolinking.cmake +85 -0
- package/nitrogen/generated/android/GoogleMapsNitro+autolinking.gradle +27 -0
- package/nitrogen/generated/android/GoogleMapsNitroOnLoad.cpp +70 -0
- package/nitrogen/generated/android/GoogleMapsNitroOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JFunc_void_RNLatLng.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_RNLocation.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_RNLocationErrorCode.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_RNMapErrorCode.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera_bool.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridGoogleMapsNitroModuleSpec.cpp +83 -0
- package/nitrogen/generated/android/c++/JHybridGoogleMapsNitroModuleSpec.hpp +67 -0
- package/nitrogen/generated/android/c++/JHybridGoogleMapsNitroViewSpec.cpp +485 -0
- package/nitrogen/generated/android/c++/JHybridGoogleMapsNitroViewSpec.hpp +108 -0
- package/nitrogen/generated/android/c++/JRNAndroidLocationPermissionResult.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNCamera.hpp +67 -0
- package/nitrogen/generated/android/c++/JRNIOSPermissionResult.hpp +59 -0
- package/nitrogen/generated/android/c++/JRNLatLng.hpp +57 -0
- package/nitrogen/generated/android/c++/JRNLineCapType.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNLineJoinType.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNLocation.hpp +58 -0
- package/nitrogen/generated/android/c++/JRNLocationErrorCode.hpp +71 -0
- package/nitrogen/generated/android/c++/JRNLocationPermissionResult.hpp +61 -0
- package/nitrogen/generated/android/c++/JRNMapErrorCode.hpp +74 -0
- package/nitrogen/generated/android/c++/JRNMapPadding.hpp +65 -0
- package/nitrogen/generated/android/c++/JRNMarker.hpp +82 -0
- package/nitrogen/generated/android/c++/JRNPolygon.hpp +94 -0
- package/nitrogen/generated/android/c++/JRNPolyline.hpp +102 -0
- package/nitrogen/generated/android/c++/JRNPosition.hpp +57 -0
- package/nitrogen/generated/android/c++/JRNRegion.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNUserInterfaceStyle.hpp +62 -0
- package/nitrogen/generated/android/c++/views/JHybridGoogleMapsNitroViewStateUpdater.cpp +132 -0
- package/nitrogen/generated/android/c++/views/JHybridGoogleMapsNitroViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_RNLatLng.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_RNLocation.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_RNLocationErrorCode.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_RNMapErrorCode.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_RNRegion_RNCamera_bool.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_bool.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/Func_void_std__string.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/GoogleMapsNitroOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/HybridGoogleMapsNitroModuleSpec.kt +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/HybridGoogleMapsNitroViewSpec.kt +263 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNAndroidLocationPermissionResult.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNCamera.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNIOSPermissionResult.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLatLng.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLineCapType.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLineJoinType.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLocation.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLocationErrorCode.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNLocationPermissionResult.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNMapErrorCode.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNMapPadding.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNMarker.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNPolygon.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNPolyline.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNPosition.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNRegion.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/RNUserInterfaceStyle.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/views/HybridGoogleMapsNitroViewManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/googlemapsnitro/views/HybridGoogleMapsNitroViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/GoogleMapsNitro+autolinking.rb +60 -0
- package/nitrogen/generated/ios/GoogleMapsNitro-Swift-Cxx-Bridge.cpp +121 -0
- package/nitrogen/generated/ios/GoogleMapsNitro-Swift-Cxx-Bridge.hpp +649 -0
- package/nitrogen/generated/ios/GoogleMapsNitro-Swift-Cxx-Umbrella.hpp +104 -0
- package/nitrogen/generated/ios/GoogleMapsNitroAutolinking.mm +41 -0
- package/nitrogen/generated/ios/GoogleMapsNitroAutolinking.swift +40 -0
- package/nitrogen/generated/ios/c++/HybridGoogleMapsNitroModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridGoogleMapsNitroModuleSpecSwift.hpp +102 -0
- package/nitrogen/generated/ios/c++/HybridGoogleMapsNitroViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridGoogleMapsNitroViewSpecSwift.hpp +294 -0
- package/nitrogen/generated/ios/c++/views/HybridGoogleMapsNitroViewComponent.mm +191 -0
- package/nitrogen/generated/ios/swift/Func_void_RNLatLng.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RNLocation.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RNLocationErrorCode.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RNLocationPermissionResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RNMapErrorCode.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RNRegion_RNCamera_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridGoogleMapsNitroModuleSpec.swift +52 -0
- package/nitrogen/generated/ios/swift/HybridGoogleMapsNitroModuleSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/HybridGoogleMapsNitroViewSpec.swift +73 -0
- package/nitrogen/generated/ios/swift/HybridGoogleMapsNitroViewSpec_cxx.swift +630 -0
- package/nitrogen/generated/ios/swift/RNAndroidLocationPermissionResult.swift +44 -0
- package/nitrogen/generated/ios/swift/RNCamera.swift +123 -0
- package/nitrogen/generated/ios/swift/RNIOSPermissionResult.swift +40 -0
- package/nitrogen/generated/ios/swift/RNLatLng.swift +46 -0
- package/nitrogen/generated/ios/swift/RNLineCapType.swift +44 -0
- package/nitrogen/generated/ios/swift/RNLineJoinType.swift +44 -0
- package/nitrogen/generated/ios/swift/RNLocation.swift +46 -0
- package/nitrogen/generated/ios/swift/RNLocationErrorCode.swift +56 -0
- package/nitrogen/generated/ios/swift/RNLocationPermissionResult.swift +70 -0
- package/nitrogen/generated/ios/swift/RNMapErrorCode.swift +60 -0
- package/nitrogen/generated/ios/swift/RNMapPadding.swift +68 -0
- package/nitrogen/generated/ios/swift/RNMarker.swift +120 -0
- package/nitrogen/generated/ios/swift/RNPolygon.swift +152 -0
- package/nitrogen/generated/ios/swift/RNPolyline.swift +168 -0
- package/nitrogen/generated/ios/swift/RNPosition.swift +46 -0
- package/nitrogen/generated/ios/swift/RNRegion.swift +57 -0
- package/nitrogen/generated/ios/swift/RNUserInterfaceStyle.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridGoogleMapsNitroModuleSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridGoogleMapsNitroModuleSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridGoogleMapsNitroViewSpec.cpp +66 -0
- package/nitrogen/generated/shared/c++/HybridGoogleMapsNitroViewSpec.hpp +145 -0
- package/nitrogen/generated/shared/c++/RNAndroidLocationPermissionResult.hpp +67 -0
- package/nitrogen/generated/shared/c++/RNCamera.hpp +81 -0
- package/nitrogen/generated/shared/c++/RNIOSPermissionResult.hpp +65 -0
- package/nitrogen/generated/shared/c++/RNLatLng.hpp +71 -0
- package/nitrogen/generated/shared/c++/RNLineCapType.hpp +80 -0
- package/nitrogen/generated/shared/c++/RNLineJoinType.hpp +80 -0
- package/nitrogen/generated/shared/c++/RNLocation.hpp +72 -0
- package/nitrogen/generated/shared/c++/RNLocationErrorCode.hpp +73 -0
- package/nitrogen/generated/shared/c++/RNLocationPermissionResult.hpp +76 -0
- package/nitrogen/generated/shared/c++/RNMapErrorCode.hpp +67 -0
- package/nitrogen/generated/shared/c++/RNMapPadding.hpp +79 -0
- package/nitrogen/generated/shared/c++/RNMarker.hpp +97 -0
- package/nitrogen/generated/shared/c++/RNPolygon.hpp +91 -0
- package/nitrogen/generated/shared/c++/RNPolyline.hpp +101 -0
- package/nitrogen/generated/shared/c++/RNPosition.hpp +71 -0
- package/nitrogen/generated/shared/c++/RNRegion.hpp +76 -0
- package/nitrogen/generated/shared/c++/RNUserInterfaceStyle.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridGoogleMapsNitroViewComponent.cpp +315 -0
- package/nitrogen/generated/shared/c++/views/HybridGoogleMapsNitroViewComponent.hpp +139 -0
- package/nitrogen/generated/shared/json/GoogleMapsNitroViewConfig.json +29 -0
- package/package.json +13 -3
- package/src/GoogleMapsNitroModule.nitro.ts +13 -0
- package/src/GoogleMapsNitroView.nitro.ts +78 -0
- package/src/index.tsx +24 -0
- package/src/types.ts +174 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNPosition.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::googlemapsnitro {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (RNPosition).
|
|
29
|
+
*/
|
|
30
|
+
struct RNPosition {
|
|
31
|
+
public:
|
|
32
|
+
double x SWIFT_PRIVATE;
|
|
33
|
+
double y SWIFT_PRIVATE;
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
RNPosition() = default;
|
|
37
|
+
explicit RNPosition(double x, double y): x(x), y(y) {}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace margelo::nitro::googlemapsnitro
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro {
|
|
43
|
+
|
|
44
|
+
// C++ RNPosition <> JS RNPosition (object)
|
|
45
|
+
template <>
|
|
46
|
+
struct JSIConverter<margelo::nitro::googlemapsnitro::RNPosition> final {
|
|
47
|
+
static inline margelo::nitro::googlemapsnitro::RNPosition fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
49
|
+
return margelo::nitro::googlemapsnitro::RNPosition(
|
|
50
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "x")),
|
|
51
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "y"))
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::googlemapsnitro::RNPosition& arg) {
|
|
55
|
+
jsi::Object obj(runtime);
|
|
56
|
+
obj.setProperty(runtime, "x", JSIConverter<double>::toJSI(runtime, arg.x));
|
|
57
|
+
obj.setProperty(runtime, "y", JSIConverter<double>::toJSI(runtime, arg.y));
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
61
|
+
if (!value.isObject()) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
jsi::Object obj = value.getObject(runtime);
|
|
65
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "x"))) return false;
|
|
66
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "y"))) return false;
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNRegion.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `RNLatLng` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::googlemapsnitro { struct RNLatLng; }
|
|
23
|
+
|
|
24
|
+
#include "RNLatLng.hpp"
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::googlemapsnitro {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A struct which can be represented as a JavaScript object (RNRegion).
|
|
30
|
+
*/
|
|
31
|
+
struct RNRegion {
|
|
32
|
+
public:
|
|
33
|
+
RNLatLng center SWIFT_PRIVATE;
|
|
34
|
+
double latitudeDelta SWIFT_PRIVATE;
|
|
35
|
+
double longitudeDelta SWIFT_PRIVATE;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
RNRegion() = default;
|
|
39
|
+
explicit RNRegion(RNLatLng center, double latitudeDelta, double longitudeDelta): center(center), latitudeDelta(latitudeDelta), longitudeDelta(longitudeDelta) {}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} // namespace margelo::nitro::googlemapsnitro
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro {
|
|
45
|
+
|
|
46
|
+
// C++ RNRegion <> JS RNRegion (object)
|
|
47
|
+
template <>
|
|
48
|
+
struct JSIConverter<margelo::nitro::googlemapsnitro::RNRegion> final {
|
|
49
|
+
static inline margelo::nitro::googlemapsnitro::RNRegion fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
51
|
+
return margelo::nitro::googlemapsnitro::RNRegion(
|
|
52
|
+
JSIConverter<margelo::nitro::googlemapsnitro::RNLatLng>::fromJSI(runtime, obj.getProperty(runtime, "center")),
|
|
53
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "latitudeDelta")),
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "longitudeDelta"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::googlemapsnitro::RNRegion& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "center", JSIConverter<margelo::nitro::googlemapsnitro::RNLatLng>::toJSI(runtime, arg.center));
|
|
60
|
+
obj.setProperty(runtime, "latitudeDelta", JSIConverter<double>::toJSI(runtime, arg.latitudeDelta));
|
|
61
|
+
obj.setProperty(runtime, "longitudeDelta", JSIConverter<double>::toJSI(runtime, arg.longitudeDelta));
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isObject()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
jsi::Object obj = value.getObject(runtime);
|
|
69
|
+
if (!JSIConverter<margelo::nitro::googlemapsnitro::RNLatLng>::canConvert(runtime, obj.getProperty(runtime, "center"))) return false;
|
|
70
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "latitudeDelta"))) return false;
|
|
71
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "longitudeDelta"))) return false;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNUserInterfaceStyle.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::googlemapsnitro {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (RNUserInterfaceStyle).
|
|
30
|
+
*/
|
|
31
|
+
enum class RNUserInterfaceStyle {
|
|
32
|
+
LIGHT SWIFT_NAME(light) = 0,
|
|
33
|
+
DARK SWIFT_NAME(dark) = 1,
|
|
34
|
+
DEFAULT SWIFT_NAME(default) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::googlemapsnitro
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ RNUserInterfaceStyle <> JS RNUserInterfaceStyle (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::googlemapsnitro::RNUserInterfaceStyle> final {
|
|
44
|
+
static inline margelo::nitro::googlemapsnitro::RNUserInterfaceStyle fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("light"): return margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::LIGHT;
|
|
48
|
+
case hashString("dark"): return margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::DARK;
|
|
49
|
+
case hashString("default"): return margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::DEFAULT;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum RNUserInterfaceStyle - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::googlemapsnitro::RNUserInterfaceStyle arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
|
|
57
|
+
case margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::DARK: return JSIConverter<std::string>::toJSI(runtime, "dark");
|
|
58
|
+
case margelo::nitro::googlemapsnitro::RNUserInterfaceStyle::DEFAULT: return JSIConverter<std::string>::toJSI(runtime, "default");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert RNUserInterfaceStyle to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("light"):
|
|
71
|
+
case hashString("dark"):
|
|
72
|
+
case hashString("default"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridGoogleMapsNitroViewComponent.cpp
|
|
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
|
+
#include "HybridGoogleMapsNitroViewComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <exception>
|
|
12
|
+
#include <utility>
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <react/renderer/core/RawValue.h>
|
|
16
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
17
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
18
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::googlemapsnitro::views {
|
|
21
|
+
|
|
22
|
+
extern const char HybridGoogleMapsNitroViewComponentName[] = "GoogleMapsNitroView";
|
|
23
|
+
|
|
24
|
+
HybridGoogleMapsNitroViewProps::HybridGoogleMapsNitroViewProps(const react::PropsParserContext& context,
|
|
25
|
+
const HybridGoogleMapsNitroViewProps& sourceProps,
|
|
26
|
+
const react::RawProps& rawProps):
|
|
27
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
28
|
+
buildingEnabled([&]() -> CachedProp<bool> {
|
|
29
|
+
try {
|
|
30
|
+
const react::RawValue* rawValue = rawProps.at("buildingEnabled", nullptr, nullptr);
|
|
31
|
+
if (rawValue == nullptr) return sourceProps.buildingEnabled;
|
|
32
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
33
|
+
return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.buildingEnabled);
|
|
34
|
+
} catch (const std::exception& exc) {
|
|
35
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.buildingEnabled: ") + exc.what());
|
|
36
|
+
}
|
|
37
|
+
}()),
|
|
38
|
+
trafficEnabled([&]() -> CachedProp<bool> {
|
|
39
|
+
try {
|
|
40
|
+
const react::RawValue* rawValue = rawProps.at("trafficEnabled", nullptr, nullptr);
|
|
41
|
+
if (rawValue == nullptr) return sourceProps.trafficEnabled;
|
|
42
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
43
|
+
return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.trafficEnabled);
|
|
44
|
+
} catch (const std::exception& exc) {
|
|
45
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.trafficEnabled: ") + exc.what());
|
|
46
|
+
}
|
|
47
|
+
}()),
|
|
48
|
+
customMapStyle([&]() -> CachedProp<std::string> {
|
|
49
|
+
try {
|
|
50
|
+
const react::RawValue* rawValue = rawProps.at("customMapStyle", nullptr, nullptr);
|
|
51
|
+
if (rawValue == nullptr) return sourceProps.customMapStyle;
|
|
52
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
53
|
+
return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.customMapStyle);
|
|
54
|
+
} catch (const std::exception& exc) {
|
|
55
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.customMapStyle: ") + exc.what());
|
|
56
|
+
}
|
|
57
|
+
}()),
|
|
58
|
+
initialCamera([&]() -> CachedProp<RNCamera> {
|
|
59
|
+
try {
|
|
60
|
+
const react::RawValue* rawValue = rawProps.at("initialCamera", nullptr, nullptr);
|
|
61
|
+
if (rawValue == nullptr) return sourceProps.initialCamera;
|
|
62
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
63
|
+
return CachedProp<RNCamera>::fromRawValue(*runtime, value, sourceProps.initialCamera);
|
|
64
|
+
} catch (const std::exception& exc) {
|
|
65
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.initialCamera: ") + exc.what());
|
|
66
|
+
}
|
|
67
|
+
}()),
|
|
68
|
+
userInterfaceStyle([&]() -> CachedProp<RNUserInterfaceStyle> {
|
|
69
|
+
try {
|
|
70
|
+
const react::RawValue* rawValue = rawProps.at("userInterfaceStyle", nullptr, nullptr);
|
|
71
|
+
if (rawValue == nullptr) return sourceProps.userInterfaceStyle;
|
|
72
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
73
|
+
return CachedProp<RNUserInterfaceStyle>::fromRawValue(*runtime, value, sourceProps.userInterfaceStyle);
|
|
74
|
+
} catch (const std::exception& exc) {
|
|
75
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.userInterfaceStyle: ") + exc.what());
|
|
76
|
+
}
|
|
77
|
+
}()),
|
|
78
|
+
minZoomLevel([&]() -> CachedProp<double> {
|
|
79
|
+
try {
|
|
80
|
+
const react::RawValue* rawValue = rawProps.at("minZoomLevel", nullptr, nullptr);
|
|
81
|
+
if (rawValue == nullptr) return sourceProps.minZoomLevel;
|
|
82
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
83
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.minZoomLevel);
|
|
84
|
+
} catch (const std::exception& exc) {
|
|
85
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.minZoomLevel: ") + exc.what());
|
|
86
|
+
}
|
|
87
|
+
}()),
|
|
88
|
+
maxZoomLevel([&]() -> CachedProp<double> {
|
|
89
|
+
try {
|
|
90
|
+
const react::RawValue* rawValue = rawProps.at("maxZoomLevel", nullptr, nullptr);
|
|
91
|
+
if (rawValue == nullptr) return sourceProps.maxZoomLevel;
|
|
92
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
93
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.maxZoomLevel);
|
|
94
|
+
} catch (const std::exception& exc) {
|
|
95
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.maxZoomLevel: ") + exc.what());
|
|
96
|
+
}
|
|
97
|
+
}()),
|
|
98
|
+
mapPadding([&]() -> CachedProp<RNMapPadding> {
|
|
99
|
+
try {
|
|
100
|
+
const react::RawValue* rawValue = rawProps.at("mapPadding", nullptr, nullptr);
|
|
101
|
+
if (rawValue == nullptr) return sourceProps.mapPadding;
|
|
102
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
103
|
+
return CachedProp<RNMapPadding>::fromRawValue(*runtime, value, sourceProps.mapPadding);
|
|
104
|
+
} catch (const std::exception& exc) {
|
|
105
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.mapPadding: ") + exc.what());
|
|
106
|
+
}
|
|
107
|
+
}()),
|
|
108
|
+
markers([&]() -> CachedProp<std::vector<RNMarker>> {
|
|
109
|
+
try {
|
|
110
|
+
const react::RawValue* rawValue = rawProps.at("markers", nullptr, nullptr);
|
|
111
|
+
if (rawValue == nullptr) return sourceProps.markers;
|
|
112
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
113
|
+
return CachedProp<std::vector<RNMarker>>::fromRawValue(*runtime, value, sourceProps.markers);
|
|
114
|
+
} catch (const std::exception& exc) {
|
|
115
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.markers: ") + exc.what());
|
|
116
|
+
}
|
|
117
|
+
}()),
|
|
118
|
+
polygons([&]() -> CachedProp<std::vector<RNPolygon>> {
|
|
119
|
+
try {
|
|
120
|
+
const react::RawValue* rawValue = rawProps.at("polygons", nullptr, nullptr);
|
|
121
|
+
if (rawValue == nullptr) return sourceProps.polygons;
|
|
122
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
123
|
+
return CachedProp<std::vector<RNPolygon>>::fromRawValue(*runtime, value, sourceProps.polygons);
|
|
124
|
+
} catch (const std::exception& exc) {
|
|
125
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.polygons: ") + exc.what());
|
|
126
|
+
}
|
|
127
|
+
}()),
|
|
128
|
+
polylines([&]() -> CachedProp<std::vector<RNPolyline>> {
|
|
129
|
+
try {
|
|
130
|
+
const react::RawValue* rawValue = rawProps.at("polylines", nullptr, nullptr);
|
|
131
|
+
if (rawValue == nullptr) return sourceProps.polylines;
|
|
132
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
133
|
+
return CachedProp<std::vector<RNPolyline>>::fromRawValue(*runtime, value, sourceProps.polylines);
|
|
134
|
+
} catch (const std::exception& exc) {
|
|
135
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.polylines: ") + exc.what());
|
|
136
|
+
}
|
|
137
|
+
}()),
|
|
138
|
+
onMapError([&]() -> CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>> {
|
|
139
|
+
try {
|
|
140
|
+
const react::RawValue* rawValue = rawProps.at("onMapError", nullptr, nullptr);
|
|
141
|
+
if (rawValue == nullptr) return sourceProps.onMapError;
|
|
142
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
143
|
+
return CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapError);
|
|
144
|
+
} catch (const std::exception& exc) {
|
|
145
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onMapError: ") + exc.what());
|
|
146
|
+
}
|
|
147
|
+
}()),
|
|
148
|
+
onMapReady([&]() -> CachedProp<std::optional<std::function<void(bool /* ready */)>>> {
|
|
149
|
+
try {
|
|
150
|
+
const react::RawValue* rawValue = rawProps.at("onMapReady", nullptr, nullptr);
|
|
151
|
+
if (rawValue == nullptr) return sourceProps.onMapReady;
|
|
152
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
153
|
+
return CachedProp<std::optional<std::function<void(bool /* ready */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapReady);
|
|
154
|
+
} catch (const std::exception& exc) {
|
|
155
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onMapReady: ") + exc.what());
|
|
156
|
+
}
|
|
157
|
+
}()),
|
|
158
|
+
onLocationUpdate([&]() -> CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> {
|
|
159
|
+
try {
|
|
160
|
+
const react::RawValue* rawValue = rawProps.at("onLocationUpdate", nullptr, nullptr);
|
|
161
|
+
if (rawValue == nullptr) return sourceProps.onLocationUpdate;
|
|
162
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
163
|
+
return CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onLocationUpdate);
|
|
164
|
+
} catch (const std::exception& exc) {
|
|
165
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onLocationUpdate: ") + exc.what());
|
|
166
|
+
}
|
|
167
|
+
}()),
|
|
168
|
+
onLocationError([&]() -> CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>> {
|
|
169
|
+
try {
|
|
170
|
+
const react::RawValue* rawValue = rawProps.at("onLocationError", nullptr, nullptr);
|
|
171
|
+
if (rawValue == nullptr) return sourceProps.onLocationError;
|
|
172
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
173
|
+
return CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onLocationError);
|
|
174
|
+
} catch (const std::exception& exc) {
|
|
175
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onLocationError: ") + exc.what());
|
|
176
|
+
}
|
|
177
|
+
}()),
|
|
178
|
+
onMapPress([&]() -> CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> {
|
|
179
|
+
try {
|
|
180
|
+
const react::RawValue* rawValue = rawProps.at("onMapPress", nullptr, nullptr);
|
|
181
|
+
if (rawValue == nullptr) return sourceProps.onMapPress;
|
|
182
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
183
|
+
return CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapPress);
|
|
184
|
+
} catch (const std::exception& exc) {
|
|
185
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onMapPress: ") + exc.what());
|
|
186
|
+
}
|
|
187
|
+
}()),
|
|
188
|
+
onMarkerPress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
|
|
189
|
+
try {
|
|
190
|
+
const react::RawValue* rawValue = rawProps.at("onMarkerPress", nullptr, nullptr);
|
|
191
|
+
if (rawValue == nullptr) return sourceProps.onMarkerPress;
|
|
192
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
193
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMarkerPress);
|
|
194
|
+
} catch (const std::exception& exc) {
|
|
195
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onMarkerPress: ") + exc.what());
|
|
196
|
+
}
|
|
197
|
+
}()),
|
|
198
|
+
onCameraChangeStart([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> {
|
|
199
|
+
try {
|
|
200
|
+
const react::RawValue* rawValue = rawProps.at("onCameraChangeStart", nullptr, nullptr);
|
|
201
|
+
if (rawValue == nullptr) return sourceProps.onCameraChangeStart;
|
|
202
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
203
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChangeStart);
|
|
204
|
+
} catch (const std::exception& exc) {
|
|
205
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onCameraChangeStart: ") + exc.what());
|
|
206
|
+
}
|
|
207
|
+
}()),
|
|
208
|
+
onCameraChange([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> {
|
|
209
|
+
try {
|
|
210
|
+
const react::RawValue* rawValue = rawProps.at("onCameraChange", nullptr, nullptr);
|
|
211
|
+
if (rawValue == nullptr) return sourceProps.onCameraChange;
|
|
212
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
213
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChange);
|
|
214
|
+
} catch (const std::exception& exc) {
|
|
215
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onCameraChange: ") + exc.what());
|
|
216
|
+
}
|
|
217
|
+
}()),
|
|
218
|
+
onCameraChangeComplete([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> {
|
|
219
|
+
try {
|
|
220
|
+
const react::RawValue* rawValue = rawProps.at("onCameraChangeComplete", nullptr, nullptr);
|
|
221
|
+
if (rawValue == nullptr) return sourceProps.onCameraChangeComplete;
|
|
222
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
223
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChangeComplete);
|
|
224
|
+
} catch (const std::exception& exc) {
|
|
225
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.onCameraChangeComplete: ") + exc.what());
|
|
226
|
+
}
|
|
227
|
+
}()),
|
|
228
|
+
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridGoogleMapsNitroViewSpec>& /* ref */)>>> {
|
|
229
|
+
try {
|
|
230
|
+
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
231
|
+
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
232
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
233
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridGoogleMapsNitroViewSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
|
|
234
|
+
} catch (const std::exception& exc) {
|
|
235
|
+
throw std::runtime_error(std::string("GoogleMapsNitroView.hybridRef: ") + exc.what());
|
|
236
|
+
}
|
|
237
|
+
}()) { }
|
|
238
|
+
|
|
239
|
+
HybridGoogleMapsNitroViewProps::HybridGoogleMapsNitroViewProps(const HybridGoogleMapsNitroViewProps& other):
|
|
240
|
+
react::ViewProps(),
|
|
241
|
+
buildingEnabled(other.buildingEnabled),
|
|
242
|
+
trafficEnabled(other.trafficEnabled),
|
|
243
|
+
customMapStyle(other.customMapStyle),
|
|
244
|
+
initialCamera(other.initialCamera),
|
|
245
|
+
userInterfaceStyle(other.userInterfaceStyle),
|
|
246
|
+
minZoomLevel(other.minZoomLevel),
|
|
247
|
+
maxZoomLevel(other.maxZoomLevel),
|
|
248
|
+
mapPadding(other.mapPadding),
|
|
249
|
+
markers(other.markers),
|
|
250
|
+
polygons(other.polygons),
|
|
251
|
+
polylines(other.polylines),
|
|
252
|
+
onMapError(other.onMapError),
|
|
253
|
+
onMapReady(other.onMapReady),
|
|
254
|
+
onLocationUpdate(other.onLocationUpdate),
|
|
255
|
+
onLocationError(other.onLocationError),
|
|
256
|
+
onMapPress(other.onMapPress),
|
|
257
|
+
onMarkerPress(other.onMarkerPress),
|
|
258
|
+
onCameraChangeStart(other.onCameraChangeStart),
|
|
259
|
+
onCameraChange(other.onCameraChange),
|
|
260
|
+
onCameraChangeComplete(other.onCameraChangeComplete),
|
|
261
|
+
hybridRef(other.hybridRef) { }
|
|
262
|
+
|
|
263
|
+
bool HybridGoogleMapsNitroViewProps::filterObjectKeys(const std::string& propName) {
|
|
264
|
+
switch (hashString(propName)) {
|
|
265
|
+
case hashString("buildingEnabled"): return true;
|
|
266
|
+
case hashString("trafficEnabled"): return true;
|
|
267
|
+
case hashString("customMapStyle"): return true;
|
|
268
|
+
case hashString("initialCamera"): return true;
|
|
269
|
+
case hashString("userInterfaceStyle"): return true;
|
|
270
|
+
case hashString("minZoomLevel"): return true;
|
|
271
|
+
case hashString("maxZoomLevel"): return true;
|
|
272
|
+
case hashString("mapPadding"): return true;
|
|
273
|
+
case hashString("markers"): return true;
|
|
274
|
+
case hashString("polygons"): return true;
|
|
275
|
+
case hashString("polylines"): return true;
|
|
276
|
+
case hashString("onMapError"): return true;
|
|
277
|
+
case hashString("onMapReady"): return true;
|
|
278
|
+
case hashString("onLocationUpdate"): return true;
|
|
279
|
+
case hashString("onLocationError"): return true;
|
|
280
|
+
case hashString("onMapPress"): return true;
|
|
281
|
+
case hashString("onMarkerPress"): return true;
|
|
282
|
+
case hashString("onCameraChangeStart"): return true;
|
|
283
|
+
case hashString("onCameraChange"): return true;
|
|
284
|
+
case hashString("onCameraChangeComplete"): return true;
|
|
285
|
+
case hashString("hybridRef"): return true;
|
|
286
|
+
default: return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
HybridGoogleMapsNitroViewComponentDescriptor::HybridGoogleMapsNitroViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
|
|
291
|
+
: ConcreteComponentDescriptor(parameters,
|
|
292
|
+
react::RawPropsParser(/* enableJsiParser */ true)) {}
|
|
293
|
+
|
|
294
|
+
std::shared_ptr<const react::Props> HybridGoogleMapsNitroViewComponentDescriptor::cloneProps(const react::PropsParserContext& context,
|
|
295
|
+
const std::shared_ptr<const react::Props>& props,
|
|
296
|
+
react::RawProps rawProps) const {
|
|
297
|
+
// 1. Prepare raw props parser
|
|
298
|
+
rawProps.parse(rawPropsParser_);
|
|
299
|
+
// 2. Copy props with Nitro's cached copy constructor
|
|
300
|
+
return HybridGoogleMapsNitroViewShadowNode::Props(context, /* & */ rawProps, props);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
#ifdef ANDROID
|
|
304
|
+
void HybridGoogleMapsNitroViewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
305
|
+
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
306
|
+
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
307
|
+
auto& concreteShadowNode = dynamic_cast<HybridGoogleMapsNitroViewShadowNode&>(shadowNode);
|
|
308
|
+
const HybridGoogleMapsNitroViewProps& props = concreteShadowNode.getConcreteProps();
|
|
309
|
+
HybridGoogleMapsNitroViewState state;
|
|
310
|
+
state.setProps(props);
|
|
311
|
+
concreteShadowNode.setStateData(std::move(state));
|
|
312
|
+
}
|
|
313
|
+
#endif
|
|
314
|
+
|
|
315
|
+
} // namespace margelo::nitro::googlemapsnitro::views
|