react-native-google-maps-plus 1.7.0 → 1.8.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/gradle.properties +2 -1
- package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +4 -4
- package/android/src/main/java/com/rngooglemapsplus/MapCircleBuilder.kt +2 -3
- package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +51 -54
- package/android/src/main/java/com/rngooglemapsplus/MapPolygonBuilder.kt +6 -23
- package/android/src/main/java/com/rngooglemapsplus/MapPolylineBuilder.kt.kt +12 -39
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +7 -5
- package/android/src/main/java/com/rngooglemapsplus/extensions/CameraPositionExtension.kt +3 -2
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineCapTypeExtension.kt +14 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNLineJoinTypeExtension.kt +12 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMapCircleExtension.kt +7 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNMarkerExtension.kt +54 -17
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolygonExtension.kt +31 -1
- package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolylineExtension.kt +6 -1
- package/ios/GoogleMapViewImpl.swift +8 -5
- package/ios/LocationHandler.swift +3 -1
- package/ios/MapCircleBuilder.swift +2 -3
- package/ios/MapHelper.swift +3 -5
- package/ios/MapMarkerBuilder.swift +108 -105
- package/ios/MapPolygonBuilder.swift +6 -41
- package/ios/MapPolylineBuilder.swift +2 -10
- package/ios/RNGoogleMapsPlusView.swift +31 -25
- package/ios/extensions/GMSCameraPosition+Extension.swift +2 -2
- package/ios/extensions/RNCircle+Extension.swift +14 -5
- package/ios/extensions/RNLatLng+Extension.swift +11 -0
- package/ios/extensions/RNLineCapType+Extension.swift +10 -0
- package/ios/extensions/RNLineJoinType+Extension.swift +11 -0
- package/ios/extensions/RNMarker+Extension.swift +43 -12
- package/ios/extensions/RNPolygon+Extension.swift.swift +50 -21
- package/ios/extensions/RNPolyline+Extension.swift.swift +15 -26
- package/ios/extensions/SVGKImage+Extension.swift +22 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +5 -5
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +7 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/RNGoogleMapsPlusOnLoad.cpp +4 -4
- package/nitrogen/generated/android/c++/{JFunc_void_RNRegion_RNCamera.hpp → JFunc_void_RNRegion_RNCameraChange.hpp} +21 -22
- package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCameraChange_bool.hpp +82 -0
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +42 -38
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +8 -8
- package/nitrogen/generated/android/c++/JRNCameraChange.hpp +70 -0
- package/nitrogen/generated/android/c++/JRNInitialProps.hpp +7 -3
- package/nitrogen/generated/android/c++/JRNMarker.hpp +1 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/{Func_void_RNRegion_RNCamera.kt → Func_void_RNRegion_RNCameraChange.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/{Func_void_RNRegion_RNCamera_bool.kt → Func_void_RNRegion_RNCameraChange_bool.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +12 -12
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNCameraChange.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMarker.kt +2 -5
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.cpp +8 -8
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +39 -36
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +11 -8
- package/nitrogen/generated/ios/swift/{Func_void_RNRegion_RNCamera.swift → Func_void_RNRegion_RNCameraChange.swift} +10 -10
- package/nitrogen/generated/ios/swift/{Func_void_RNRegion_RNCamera_bool.swift → Func_void_RNRegion_RNCameraChange_bool.swift} +10 -10
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +4 -4
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +44 -44
- package/nitrogen/generated/ios/swift/RNCameraChange.swift +68 -0
- package/nitrogen/generated/ios/swift/RNInitialProps.swift +31 -1
- package/nitrogen/generated/ios/swift/RNMarker.swift +1 -31
- package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +14 -11
- package/nitrogen/generated/shared/c++/RNCameraChange.hpp +88 -0
- package/nitrogen/generated/shared/c++/RNInitialProps.hpp +6 -2
- package/nitrogen/generated/shared/c++/RNMarker.hpp +1 -5
- package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.cpp +8 -8
- package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.hpp +5 -5
- package/package.json +1 -1
- package/src/RNGoogleMapsPlusView.nitro.ts +5 -4
- package/src/types.ts +8 -1
- package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera_bool.hpp +0 -83
|
@@ -18,7 +18,7 @@ public extension RNInitialProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `RNInitialProps`.
|
|
20
20
|
*/
|
|
21
|
-
init(mapId: String?, liteMode: Bool?, camera: RNCamera?) {
|
|
21
|
+
init(mapId: String?, liteMode: Bool?, camera: RNCamera?, backgroundColor: String?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
23
|
if let __unwrappedValue = mapId {
|
|
24
24
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -37,6 +37,12 @@ public extension RNInitialProps {
|
|
|
37
37
|
} else {
|
|
38
38
|
return .init()
|
|
39
39
|
}
|
|
40
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
41
|
+
if let __unwrappedValue = backgroundColor {
|
|
42
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
40
46
|
}())
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -104,4 +110,28 @@ public extension RNInitialProps {
|
|
|
104
110
|
}()
|
|
105
111
|
}
|
|
106
112
|
}
|
|
113
|
+
|
|
114
|
+
var backgroundColor: String? {
|
|
115
|
+
@inline(__always)
|
|
116
|
+
get {
|
|
117
|
+
return { () -> String? in
|
|
118
|
+
if bridge.has_value_std__optional_std__string_(self.__backgroundColor) {
|
|
119
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__backgroundColor)
|
|
120
|
+
return String(__unwrapped)
|
|
121
|
+
} else {
|
|
122
|
+
return nil
|
|
123
|
+
}
|
|
124
|
+
}()
|
|
125
|
+
}
|
|
126
|
+
@inline(__always)
|
|
127
|
+
set {
|
|
128
|
+
self.__backgroundColor = { () -> bridge.std__optional_std__string_ in
|
|
129
|
+
if let __unwrappedValue = newValue {
|
|
130
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
131
|
+
} else {
|
|
132
|
+
return .init()
|
|
133
|
+
}
|
|
134
|
+
}()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
107
137
|
}
|
|
@@ -18,7 +18,7 @@ public extension RNMarker {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `RNMarker`.
|
|
20
20
|
*/
|
|
21
|
-
init(id: String, zIndex: Double?, coordinate: RNLatLng, anchor: RNPosition?,
|
|
21
|
+
init(id: String, zIndex: Double?, coordinate: RNLatLng, anchor: RNPosition?, title: String?, snippet: String?, opacity: Double?, flat: Bool?, draggable: Bool?, rotation: Double?, infoWindowAnchor: RNPosition?, iconSvg: RNMarkerSvg?, infoWindowIconSvg: RNMarkerSvg?) {
|
|
22
22
|
self.init(std.string(id), { () -> bridge.std__optional_double_ in
|
|
23
23
|
if let __unwrappedValue = zIndex {
|
|
24
24
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
@@ -31,12 +31,6 @@ public extension RNMarker {
|
|
|
31
31
|
} else {
|
|
32
32
|
return .init()
|
|
33
33
|
}
|
|
34
|
-
}(), { () -> bridge.std__optional_bool_ in
|
|
35
|
-
if let __unwrappedValue = showInfoWindow {
|
|
36
|
-
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
37
|
-
} else {
|
|
38
|
-
return .init()
|
|
39
|
-
}
|
|
40
34
|
}(), { () -> bridge.std__optional_std__string_ in
|
|
41
35
|
if let __unwrappedValue = title {
|
|
42
36
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -150,30 +144,6 @@ public extension RNMarker {
|
|
|
150
144
|
}
|
|
151
145
|
}
|
|
152
146
|
|
|
153
|
-
var showInfoWindow: Bool? {
|
|
154
|
-
@inline(__always)
|
|
155
|
-
get {
|
|
156
|
-
return { () -> Bool? in
|
|
157
|
-
if bridge.has_value_std__optional_bool_(self.__showInfoWindow) {
|
|
158
|
-
let __unwrapped = bridge.get_std__optional_bool_(self.__showInfoWindow)
|
|
159
|
-
return __unwrapped
|
|
160
|
-
} else {
|
|
161
|
-
return nil
|
|
162
|
-
}
|
|
163
|
-
}()
|
|
164
|
-
}
|
|
165
|
-
@inline(__always)
|
|
166
|
-
set {
|
|
167
|
-
self.__showInfoWindow = { () -> bridge.std__optional_bool_ in
|
|
168
|
-
if let __unwrappedValue = newValue {
|
|
169
|
-
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
170
|
-
} else {
|
|
171
|
-
return .init()
|
|
172
|
-
}
|
|
173
|
-
}()
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
147
|
var title: String? {
|
|
178
148
|
@inline(__always)
|
|
179
149
|
get {
|
|
@@ -45,8 +45,8 @@ namespace margelo::nitro::rngooglemapsplus { struct RNLocationConfig; }
|
|
|
45
45
|
namespace margelo::nitro::rngooglemapsplus { enum class RNMapErrorCode; }
|
|
46
46
|
// Forward declaration of `RNRegion` to properly resolve imports.
|
|
47
47
|
namespace margelo::nitro::rngooglemapsplus { struct RNRegion; }
|
|
48
|
-
// Forward declaration of `
|
|
49
|
-
namespace margelo::nitro::rngooglemapsplus { struct
|
|
48
|
+
// Forward declaration of `RNCameraChange` to properly resolve imports.
|
|
49
|
+
namespace margelo::nitro::rngooglemapsplus { struct RNCameraChange; }
|
|
50
50
|
// Forward declaration of `RNLocation` to properly resolve imports.
|
|
51
51
|
namespace margelo::nitro::rngooglemapsplus { struct RNLocation; }
|
|
52
52
|
// Forward declaration of `RNLocationErrorCode` to properly resolve imports.
|
|
@@ -57,6 +57,8 @@ namespace margelo::nitro::rngooglemapsplus { struct RNLatLng; }
|
|
|
57
57
|
namespace margelo::nitro::rngooglemapsplus { struct RNIndoorBuilding; }
|
|
58
58
|
// Forward declaration of `RNIndoorLevel` to properly resolve imports.
|
|
59
59
|
namespace margelo::nitro::rngooglemapsplus { struct RNIndoorLevel; }
|
|
60
|
+
// Forward declaration of `RNCamera` to properly resolve imports.
|
|
61
|
+
namespace margelo::nitro::rngooglemapsplus { struct RNCamera; }
|
|
60
62
|
// Forward declaration of `RNLatLngBounds` to properly resolve imports.
|
|
61
63
|
namespace margelo::nitro::rngooglemapsplus { struct RNLatLngBounds; }
|
|
62
64
|
// Forward declaration of `RNSnapshotOptions` to properly resolve imports.
|
|
@@ -84,12 +86,13 @@ namespace margelo::nitro::rngooglemapsplus { struct RNLocationPermissionResult;
|
|
|
84
86
|
#include "RNMapErrorCode.hpp"
|
|
85
87
|
#include <functional>
|
|
86
88
|
#include "RNRegion.hpp"
|
|
87
|
-
#include "
|
|
89
|
+
#include "RNCameraChange.hpp"
|
|
88
90
|
#include "RNLocation.hpp"
|
|
89
91
|
#include "RNLocationErrorCode.hpp"
|
|
90
92
|
#include "RNLatLng.hpp"
|
|
91
93
|
#include "RNIndoorBuilding.hpp"
|
|
92
94
|
#include "RNIndoorLevel.hpp"
|
|
95
|
+
#include "RNCamera.hpp"
|
|
93
96
|
#include "RNLatLngBounds.hpp"
|
|
94
97
|
#include <NitroModules/Promise.hpp>
|
|
95
98
|
#include "RNSnapshotOptions.hpp"
|
|
@@ -164,8 +167,8 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
164
167
|
virtual void setOnMapError(const std::optional<std::function<void(RNMapErrorCode /* error */)>>& onMapError) = 0;
|
|
165
168
|
virtual std::optional<std::function<void(bool /* ready */)>> getOnMapReady() = 0;
|
|
166
169
|
virtual void setOnMapReady(const std::optional<std::function<void(bool /* ready */)>>& onMapReady) = 0;
|
|
167
|
-
virtual std::optional<std::function<void(const RNRegion& /* region */, const
|
|
168
|
-
virtual void setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const
|
|
170
|
+
virtual std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */)>> getOnMapLoaded() = 0;
|
|
171
|
+
virtual void setOnMapLoaded(const std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */)>>& onMapLoaded) = 0;
|
|
169
172
|
virtual std::optional<std::function<void(const RNLocation& /* location */)>> getOnLocationUpdate() = 0;
|
|
170
173
|
virtual void setOnLocationUpdate(const std::optional<std::function<void(const RNLocation& /* location */)>>& onLocationUpdate) = 0;
|
|
171
174
|
virtual std::optional<std::function<void(RNLocationErrorCode /* error */)>> getOnLocationError() = 0;
|
|
@@ -204,12 +207,12 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
204
207
|
virtual void setOnMyLocationPress(const std::optional<std::function<void(const RNLocation& /* location */)>>& onMyLocationPress) = 0;
|
|
205
208
|
virtual std::optional<std::function<void(bool /* pressed */)>> getOnMyLocationButtonPress() = 0;
|
|
206
209
|
virtual void setOnMyLocationButtonPress(const std::optional<std::function<void(bool /* pressed */)>>& onMyLocationButtonPress) = 0;
|
|
207
|
-
virtual std::optional<std::function<void(const RNRegion& /* region */, const
|
|
208
|
-
virtual void setOnCameraChangeStart(const std::optional<std::function<void(const RNRegion& /* region */, const
|
|
209
|
-
virtual std::optional<std::function<void(const RNRegion& /* region */, const
|
|
210
|
-
virtual void setOnCameraChange(const std::optional<std::function<void(const RNRegion& /* region */, const
|
|
211
|
-
virtual std::optional<std::function<void(const RNRegion& /* region */, const
|
|
212
|
-
virtual void setOnCameraChangeComplete(const std::optional<std::function<void(const RNRegion& /* region */, const
|
|
210
|
+
virtual std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>> getOnCameraChangeStart() = 0;
|
|
211
|
+
virtual void setOnCameraChangeStart(const std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>& onCameraChangeStart) = 0;
|
|
212
|
+
virtual std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>> getOnCameraChange() = 0;
|
|
213
|
+
virtual void setOnCameraChange(const std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>& onCameraChange) = 0;
|
|
214
|
+
virtual std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>> getOnCameraChangeComplete() = 0;
|
|
215
|
+
virtual void setOnCameraChangeComplete(const std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>& onCameraChangeComplete) = 0;
|
|
213
216
|
|
|
214
217
|
public:
|
|
215
218
|
// Methods
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNCameraChange.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
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `RNLatLng` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::rngooglemapsplus { struct RNLatLng; }
|
|
28
|
+
|
|
29
|
+
#include "RNLatLng.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::rngooglemapsplus {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (RNCameraChange).
|
|
35
|
+
*/
|
|
36
|
+
struct RNCameraChange {
|
|
37
|
+
public:
|
|
38
|
+
RNLatLng center SWIFT_PRIVATE;
|
|
39
|
+
double zoom SWIFT_PRIVATE;
|
|
40
|
+
double bearing SWIFT_PRIVATE;
|
|
41
|
+
double tilt SWIFT_PRIVATE;
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
RNCameraChange() = default;
|
|
45
|
+
explicit RNCameraChange(RNLatLng center, double zoom, double bearing, double tilt): center(center), zoom(zoom), bearing(bearing), tilt(tilt) {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
} // namespace margelo::nitro::rngooglemapsplus
|
|
49
|
+
|
|
50
|
+
namespace margelo::nitro {
|
|
51
|
+
|
|
52
|
+
// C++ RNCameraChange <> JS RNCameraChange (object)
|
|
53
|
+
template <>
|
|
54
|
+
struct JSIConverter<margelo::nitro::rngooglemapsplus::RNCameraChange> final {
|
|
55
|
+
static inline margelo::nitro::rngooglemapsplus::RNCameraChange fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
56
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
57
|
+
return margelo::nitro::rngooglemapsplus::RNCameraChange(
|
|
58
|
+
JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::fromJSI(runtime, obj.getProperty(runtime, "center")),
|
|
59
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "zoom")),
|
|
60
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "bearing")),
|
|
61
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "tilt"))
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rngooglemapsplus::RNCameraChange& arg) {
|
|
65
|
+
jsi::Object obj(runtime);
|
|
66
|
+
obj.setProperty(runtime, "center", JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::toJSI(runtime, arg.center));
|
|
67
|
+
obj.setProperty(runtime, "zoom", JSIConverter<double>::toJSI(runtime, arg.zoom));
|
|
68
|
+
obj.setProperty(runtime, "bearing", JSIConverter<double>::toJSI(runtime, arg.bearing));
|
|
69
|
+
obj.setProperty(runtime, "tilt", JSIConverter<double>::toJSI(runtime, arg.tilt));
|
|
70
|
+
return obj;
|
|
71
|
+
}
|
|
72
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
73
|
+
if (!value.isObject()) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
jsi::Object obj = value.getObject(runtime);
|
|
77
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (!JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::canConvert(runtime, obj.getProperty(runtime, "center"))) return false;
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "zoom"))) return false;
|
|
82
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "bearing"))) return false;
|
|
83
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "tilt"))) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -40,10 +40,11 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
40
40
|
std::optional<std::string> mapId SWIFT_PRIVATE;
|
|
41
41
|
std::optional<bool> liteMode SWIFT_PRIVATE;
|
|
42
42
|
std::optional<RNCamera> camera SWIFT_PRIVATE;
|
|
43
|
+
std::optional<std::string> backgroundColor SWIFT_PRIVATE;
|
|
43
44
|
|
|
44
45
|
public:
|
|
45
46
|
RNInitialProps() = default;
|
|
46
|
-
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<RNCamera> camera): mapId(mapId), liteMode(liteMode), camera(camera) {}
|
|
47
|
+
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<RNCamera> camera, std::optional<std::string> backgroundColor): mapId(mapId), liteMode(liteMode), camera(camera), backgroundColor(backgroundColor) {}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -58,7 +59,8 @@ namespace margelo::nitro {
|
|
|
58
59
|
return margelo::nitro::rngooglemapsplus::RNInitialProps(
|
|
59
60
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "mapId")),
|
|
60
61
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "liteMode")),
|
|
61
|
-
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::fromJSI(runtime, obj.getProperty(runtime, "camera"))
|
|
62
|
+
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::fromJSI(runtime, obj.getProperty(runtime, "camera")),
|
|
63
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "backgroundColor"))
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
66
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rngooglemapsplus::RNInitialProps& arg) {
|
|
@@ -66,6 +68,7 @@ namespace margelo::nitro {
|
|
|
66
68
|
obj.setProperty(runtime, "mapId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mapId));
|
|
67
69
|
obj.setProperty(runtime, "liteMode", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.liteMode));
|
|
68
70
|
obj.setProperty(runtime, "camera", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::toJSI(runtime, arg.camera));
|
|
71
|
+
obj.setProperty(runtime, "backgroundColor", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.backgroundColor));
|
|
69
72
|
return obj;
|
|
70
73
|
}
|
|
71
74
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -79,6 +82,7 @@ namespace margelo::nitro {
|
|
|
79
82
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "mapId"))) return false;
|
|
80
83
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "liteMode"))) return false;
|
|
81
84
|
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::canConvert(runtime, obj.getProperty(runtime, "camera"))) return false;
|
|
85
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "backgroundColor"))) return false;
|
|
82
86
|
return true;
|
|
83
87
|
}
|
|
84
88
|
};
|
|
@@ -47,7 +47,6 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
47
47
|
std::optional<double> zIndex SWIFT_PRIVATE;
|
|
48
48
|
RNLatLng coordinate SWIFT_PRIVATE;
|
|
49
49
|
std::optional<RNPosition> anchor SWIFT_PRIVATE;
|
|
50
|
-
std::optional<bool> showInfoWindow SWIFT_PRIVATE;
|
|
51
50
|
std::optional<std::string> title SWIFT_PRIVATE;
|
|
52
51
|
std::optional<std::string> snippet SWIFT_PRIVATE;
|
|
53
52
|
std::optional<double> opacity SWIFT_PRIVATE;
|
|
@@ -60,7 +59,7 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
60
59
|
|
|
61
60
|
public:
|
|
62
61
|
RNMarker() = default;
|
|
63
|
-
explicit RNMarker(std::string id, std::optional<double> zIndex, RNLatLng coordinate, std::optional<RNPosition> anchor, std::optional<
|
|
62
|
+
explicit RNMarker(std::string id, std::optional<double> zIndex, RNLatLng coordinate, std::optional<RNPosition> anchor, std::optional<std::string> title, std::optional<std::string> snippet, std::optional<double> opacity, std::optional<bool> flat, std::optional<bool> draggable, std::optional<double> rotation, std::optional<RNPosition> infoWindowAnchor, std::optional<RNMarkerSvg> iconSvg, std::optional<RNMarkerSvg> infoWindowIconSvg): id(id), zIndex(zIndex), coordinate(coordinate), anchor(anchor), title(title), snippet(snippet), opacity(opacity), flat(flat), draggable(draggable), rotation(rotation), infoWindowAnchor(infoWindowAnchor), iconSvg(iconSvg), infoWindowIconSvg(infoWindowIconSvg) {}
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -77,7 +76,6 @@ namespace margelo::nitro {
|
|
|
77
76
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "zIndex")),
|
|
78
77
|
JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::fromJSI(runtime, obj.getProperty(runtime, "coordinate")),
|
|
79
78
|
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNPosition>>::fromJSI(runtime, obj.getProperty(runtime, "anchor")),
|
|
80
|
-
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "showInfoWindow")),
|
|
81
79
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "title")),
|
|
82
80
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "snippet")),
|
|
83
81
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "opacity")),
|
|
@@ -95,7 +93,6 @@ namespace margelo::nitro {
|
|
|
95
93
|
obj.setProperty(runtime, "zIndex", JSIConverter<std::optional<double>>::toJSI(runtime, arg.zIndex));
|
|
96
94
|
obj.setProperty(runtime, "coordinate", JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::toJSI(runtime, arg.coordinate));
|
|
97
95
|
obj.setProperty(runtime, "anchor", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNPosition>>::toJSI(runtime, arg.anchor));
|
|
98
|
-
obj.setProperty(runtime, "showInfoWindow", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showInfoWindow));
|
|
99
96
|
obj.setProperty(runtime, "title", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.title));
|
|
100
97
|
obj.setProperty(runtime, "snippet", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.snippet));
|
|
101
98
|
obj.setProperty(runtime, "opacity", JSIConverter<std::optional<double>>::toJSI(runtime, arg.opacity));
|
|
@@ -119,7 +116,6 @@ namespace margelo::nitro {
|
|
|
119
116
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "zIndex"))) return false;
|
|
120
117
|
if (!JSIConverter<margelo::nitro::rngooglemapsplus::RNLatLng>::canConvert(runtime, obj.getProperty(runtime, "coordinate"))) return false;
|
|
121
118
|
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNPosition>>::canConvert(runtime, obj.getProperty(runtime, "anchor"))) return false;
|
|
122
|
-
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "showInfoWindow"))) return false;
|
|
123
119
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false;
|
|
124
120
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "snippet"))) return false;
|
|
125
121
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "opacity"))) return false;
|
|
@@ -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(const RNRegion& /* region */, const
|
|
238
|
+
onMapLoaded([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* 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(const RNRegion& /* region */, const
|
|
243
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* 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
|
}
|
|
@@ -435,32 +435,32 @@ namespace margelo::nitro::rngooglemapsplus::views {
|
|
|
435
435
|
throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMyLocationButtonPress: ") + exc.what());
|
|
436
436
|
}
|
|
437
437
|
}()),
|
|
438
|
-
onCameraChangeStart([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
438
|
+
onCameraChangeStart([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> {
|
|
439
439
|
try {
|
|
440
440
|
const react::RawValue* rawValue = rawProps.at("onCameraChangeStart", nullptr, nullptr);
|
|
441
441
|
if (rawValue == nullptr) return sourceProps.onCameraChangeStart;
|
|
442
442
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
443
|
-
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
443
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChangeStart);
|
|
444
444
|
} catch (const std::exception& exc) {
|
|
445
445
|
throw std::runtime_error(std::string("RNGoogleMapsPlusView.onCameraChangeStart: ") + exc.what());
|
|
446
446
|
}
|
|
447
447
|
}()),
|
|
448
|
-
onCameraChange([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
448
|
+
onCameraChange([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> {
|
|
449
449
|
try {
|
|
450
450
|
const react::RawValue* rawValue = rawProps.at("onCameraChange", nullptr, nullptr);
|
|
451
451
|
if (rawValue == nullptr) return sourceProps.onCameraChange;
|
|
452
452
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
453
|
-
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
453
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChange);
|
|
454
454
|
} catch (const std::exception& exc) {
|
|
455
455
|
throw std::runtime_error(std::string("RNGoogleMapsPlusView.onCameraChange: ") + exc.what());
|
|
456
456
|
}
|
|
457
457
|
}()),
|
|
458
|
-
onCameraChangeComplete([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
458
|
+
onCameraChangeComplete([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> {
|
|
459
459
|
try {
|
|
460
460
|
const react::RawValue* rawValue = rawProps.at("onCameraChangeComplete", nullptr, nullptr);
|
|
461
461
|
if (rawValue == nullptr) return sourceProps.onCameraChangeComplete;
|
|
462
462
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
463
|
-
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
463
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCameraChangeComplete);
|
|
464
464
|
} catch (const std::exception& exc) {
|
|
465
465
|
throw std::runtime_error(std::string("RNGoogleMapsPlusView.onCameraChangeComplete: ") + exc.what());
|
|
466
466
|
}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
#include "RNMapErrorCode.hpp"
|
|
37
37
|
#include <functional>
|
|
38
38
|
#include "RNRegion.hpp"
|
|
39
|
-
#include "
|
|
39
|
+
#include "RNCameraChange.hpp"
|
|
40
40
|
#include "RNLocation.hpp"
|
|
41
41
|
#include "RNLocationErrorCode.hpp"
|
|
42
42
|
#include "RNLatLng.hpp"
|
|
@@ -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(const RNRegion& /* region */, const
|
|
90
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* 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;
|
|
@@ -107,9 +107,9 @@ namespace margelo::nitro::rngooglemapsplus::views {
|
|
|
107
107
|
CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onInfoWindowLongPress;
|
|
108
108
|
CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> onMyLocationPress;
|
|
109
109
|
CachedProp<std::optional<std::function<void(bool /* pressed */)>>> onMyLocationButtonPress;
|
|
110
|
-
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
111
|
-
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
112
|
-
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
110
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> onCameraChangeStart;
|
|
111
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> onCameraChange;
|
|
112
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>>> onCameraChangeComplete;
|
|
113
113
|
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridRNGoogleMapsPlusViewSpec>& /* ref */)>>> hybridRef;
|
|
114
114
|
|
|
115
115
|
private:
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
} from 'react-native-nitro-modules';
|
|
6
6
|
import type {
|
|
7
7
|
RNCamera,
|
|
8
|
+
RNCameraChange,
|
|
8
9
|
RNLatLng,
|
|
9
10
|
RNMapPadding,
|
|
10
11
|
RNPolygon,
|
|
@@ -53,7 +54,7 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
|
|
|
53
54
|
locationConfig?: RNLocationConfig;
|
|
54
55
|
onMapError?: (error: RNMapErrorCode) => void;
|
|
55
56
|
onMapReady?: (ready: boolean) => void;
|
|
56
|
-
onMapLoaded?: (region: RNRegion, camera:
|
|
57
|
+
onMapLoaded?: (region: RNRegion, camera: RNCameraChange) => void;
|
|
57
58
|
onLocationUpdate?: (location: RNLocation) => void;
|
|
58
59
|
onLocationError?: (error: RNLocationErrorCode) => void;
|
|
59
60
|
onMapPress?: (coordinate: RNLatLng) => void;
|
|
@@ -75,17 +76,17 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
|
|
|
75
76
|
onMyLocationButtonPress?: (pressed: boolean) => void;
|
|
76
77
|
onCameraChangeStart?: (
|
|
77
78
|
region: RNRegion,
|
|
78
|
-
camera:
|
|
79
|
+
camera: RNCameraChange,
|
|
79
80
|
isGesture: boolean
|
|
80
81
|
) => void;
|
|
81
82
|
onCameraChange?: (
|
|
82
83
|
region: RNRegion,
|
|
83
|
-
camera:
|
|
84
|
+
camera: RNCameraChange,
|
|
84
85
|
isGesture: boolean
|
|
85
86
|
) => void;
|
|
86
87
|
onCameraChangeComplete?: (
|
|
87
88
|
region: RNRegion,
|
|
88
|
-
camera:
|
|
89
|
+
camera: RNCameraChange,
|
|
89
90
|
isGesture: boolean
|
|
90
91
|
) => void;
|
|
91
92
|
}
|
package/src/types.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type RNInitialProps = {
|
|
|
7
7
|
mapId?: string;
|
|
8
8
|
liteMode?: boolean;
|
|
9
9
|
camera?: RNCamera;
|
|
10
|
+
backgroundColor?: string;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export type RNMapUiSettings = {
|
|
@@ -129,6 +130,13 @@ export interface RNMapStyleElement {
|
|
|
129
130
|
stylers: RNMapStyler[];
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
export type RNCameraChange = {
|
|
134
|
+
center: RNLatLng;
|
|
135
|
+
zoom: number;
|
|
136
|
+
bearing: number;
|
|
137
|
+
tilt: number;
|
|
138
|
+
};
|
|
139
|
+
|
|
132
140
|
export type RNCamera = {
|
|
133
141
|
center?: RNLatLng;
|
|
134
142
|
zoom?: number;
|
|
@@ -162,7 +170,6 @@ export type RNMarker = {
|
|
|
162
170
|
zIndex?: number;
|
|
163
171
|
coordinate: RNLatLng;
|
|
164
172
|
anchor?: RNPosition;
|
|
165
|
-
showInfoWindow?: boolean;
|
|
166
173
|
title?: string;
|
|
167
174
|
snippet?: string;
|
|
168
175
|
opacity?: number;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JFunc_void_RNRegion_RNCamera_bool.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, isGesture: Boolean) -> Unit`.
|
|
30
|
-
* This can be passed around between C++ and Java/Kotlin.
|
|
31
|
-
*/
|
|
32
|
-
struct JFunc_void_RNRegion_RNCamera_bool: public jni::JavaClass<JFunc_void_RNRegion_RNCamera_bool> {
|
|
33
|
-
public:
|
|
34
|
-
static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool;";
|
|
35
|
-
|
|
36
|
-
public:
|
|
37
|
-
/**
|
|
38
|
-
* Invokes the function this `JFunc_void_RNRegion_RNCamera_bool` instance holds through JNI.
|
|
39
|
-
*/
|
|
40
|
-
void invoke(const RNRegion& region, const RNCamera& camera, bool isGesture) const {
|
|
41
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JRNRegion> /* region */, jni::alias_ref<JRNCamera> /* camera */, jboolean /* isGesture */)>("invoke");
|
|
42
|
-
method(self(), JRNRegion::fromCpp(region), JRNCamera::fromCpp(camera), isGesture);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* An implementation of Func_void_RNRegion_RNCamera_bool that is backed by a C++ implementation (using `std::function<...>`)
|
|
48
|
-
*/
|
|
49
|
-
struct JFunc_void_RNRegion_RNCamera_bool_cxx final: public jni::HybridClass<JFunc_void_RNRegion_RNCamera_bool_cxx, JFunc_void_RNRegion_RNCamera_bool> {
|
|
50
|
-
public:
|
|
51
|
-
static jni::local_ref<JFunc_void_RNRegion_RNCamera_bool::javaobject> fromCpp(const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>& func) {
|
|
52
|
-
return JFunc_void_RNRegion_RNCamera_bool_cxx::newObjectCxxArgs(func);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public:
|
|
56
|
-
/**
|
|
57
|
-
* Invokes the C++ `std::function<...>` this `JFunc_void_RNRegion_RNCamera_bool_cxx` instance holds.
|
|
58
|
-
*/
|
|
59
|
-
void invoke_cxx(jni::alias_ref<JRNRegion> region, jni::alias_ref<JRNCamera> camera, jboolean isGesture) {
|
|
60
|
-
_func(region->toCpp(), camera->toCpp(), static_cast<bool>(isGesture));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public:
|
|
64
|
-
[[nodiscard]]
|
|
65
|
-
inline const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>& getFunction() const {
|
|
66
|
-
return _func;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public:
|
|
70
|
-
static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCamera_bool_cxx;";
|
|
71
|
-
static void registerNatives() {
|
|
72
|
-
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNRegion_RNCamera_bool_cxx::invoke_cxx)});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
private:
|
|
76
|
-
explicit JFunc_void_RNRegion_RNCamera_bool_cxx(const std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>& func): _func(func) { }
|
|
77
|
-
|
|
78
|
-
private:
|
|
79
|
-
friend HybridBase;
|
|
80
|
-
std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)> _func;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
} // namespace margelo::nitro::rngooglemapsplus
|