react-native-google-maps-plus 1.8.1 → 1.8.2
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/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +4 -4
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +5 -5
- package/android/src/main/java/com/rngooglemapsplus/extensions/CameraPositionExtension.kt +2 -3
- package/android/src/main/java/com/rngooglemapsplus/extensions/{RNCameraExtension.kt → RNCameraUpdateExtension.kt} +2 -2
- package/ios/GoogleMapViewImpl.swift +4 -4
- package/ios/RNGoogleMapsPlusView.swift +5 -5
- package/ios/extensions/GMSCameraPosition+Extension.swift +2 -2
- package/ios/extensions/{RNCamera+Extension.swift → RNCameraUpdate+Extension.swift} +1 -1
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +6 -6
- package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +3 -3
- 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_RNCameraChange.hpp → JFunc_void_RNRegion_RNCamera.hpp} +21 -21
- package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCamera_bool.hpp +82 -0
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +49 -49
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +9 -9
- package/nitrogen/generated/android/c++/JRNCamera.hpp +15 -16
- package/nitrogen/generated/android/c++/JRNCameraUpdate.hpp +71 -0
- package/nitrogen/generated/android/c++/JRNInitialProps.hpp +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/{Func_void_RNRegion_RNCameraChange.kt → Func_void_RNRegion_RNCamera.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/{Func_void_RNRegion_RNCameraChange_bool.kt → Func_void_RNRegion_RNCamera_bool.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +13 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNCamera.kt +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/{RNCameraChange.kt → RNCameraUpdate.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +2 -2
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.cpp +8 -8
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +46 -46
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +3 -3
- package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +15 -15
- package/nitrogen/generated/ios/swift/{Func_void_RNRegion_RNCameraChange.swift → Func_void_RNRegion_RNCamera.swift} +10 -10
- package/nitrogen/generated/ios/swift/{Func_void_RNRegion_RNCameraChange_bool.swift → Func_void_RNRegion_RNCamera_bool.swift} +10 -10
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +45 -45
- package/nitrogen/generated/ios/swift/RNCamera.swift +14 -62
- package/nitrogen/generated/ios/swift/RNCameraUpdate.swift +116 -0
- package/nitrogen/generated/ios/swift/RNInitialProps.swift +6 -6
- package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +15 -15
- package/nitrogen/generated/shared/c++/RNCamera.hpp +17 -18
- package/nitrogen/generated/shared/c++/RNCameraUpdate.hpp +89 -0
- package/nitrogen/generated/shared/c++/RNInitialProps.hpp +8 -8
- 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 +10 -6
- package/src/types.ts +3 -3
- package/nitrogen/generated/android/c++/JFunc_void_RNRegion_RNCameraChange_bool.hpp +0 -82
- package/nitrogen/generated/android/c++/JRNCameraChange.hpp +0 -70
- package/nitrogen/generated/ios/swift/RNCameraChange.swift +0 -68
- package/nitrogen/generated/shared/c++/RNCameraChange.hpp +0 -88
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNCameraUpdate.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
|
+
#include <optional>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::rngooglemapsplus {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (RNCameraUpdate).
|
|
36
|
+
*/
|
|
37
|
+
struct RNCameraUpdate {
|
|
38
|
+
public:
|
|
39
|
+
std::optional<RNLatLng> center SWIFT_PRIVATE;
|
|
40
|
+
std::optional<double> zoom SWIFT_PRIVATE;
|
|
41
|
+
std::optional<double> bearing SWIFT_PRIVATE;
|
|
42
|
+
std::optional<double> tilt SWIFT_PRIVATE;
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
RNCameraUpdate() = default;
|
|
46
|
+
explicit RNCameraUpdate(std::optional<RNLatLng> center, std::optional<double> zoom, std::optional<double> bearing, std::optional<double> tilt): center(center), zoom(zoom), bearing(bearing), tilt(tilt) {}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::rngooglemapsplus
|
|
50
|
+
|
|
51
|
+
namespace margelo::nitro {
|
|
52
|
+
|
|
53
|
+
// C++ RNCameraUpdate <> JS RNCameraUpdate (object)
|
|
54
|
+
template <>
|
|
55
|
+
struct JSIConverter<margelo::nitro::rngooglemapsplus::RNCameraUpdate> final {
|
|
56
|
+
static inline margelo::nitro::rngooglemapsplus::RNCameraUpdate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
+
return margelo::nitro::rngooglemapsplus::RNCameraUpdate(
|
|
59
|
+
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNLatLng>>::fromJSI(runtime, obj.getProperty(runtime, "center")),
|
|
60
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "zoom")),
|
|
61
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "bearing")),
|
|
62
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "tilt"))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rngooglemapsplus::RNCameraUpdate& arg) {
|
|
66
|
+
jsi::Object obj(runtime);
|
|
67
|
+
obj.setProperty(runtime, "center", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNLatLng>>::toJSI(runtime, arg.center));
|
|
68
|
+
obj.setProperty(runtime, "zoom", JSIConverter<std::optional<double>>::toJSI(runtime, arg.zoom));
|
|
69
|
+
obj.setProperty(runtime, "bearing", JSIConverter<std::optional<double>>::toJSI(runtime, arg.bearing));
|
|
70
|
+
obj.setProperty(runtime, "tilt", JSIConverter<std::optional<double>>::toJSI(runtime, arg.tilt));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNLatLng>>::canConvert(runtime, obj.getProperty(runtime, "center"))) return false;
|
|
82
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "zoom"))) return false;
|
|
83
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "bearing"))) return false;
|
|
84
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "tilt"))) return false;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
} // namespace margelo::nitro
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
-
// Forward declaration of `
|
|
27
|
-
namespace margelo::nitro::rngooglemapsplus { struct
|
|
26
|
+
// Forward declaration of `RNCameraUpdate` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::rngooglemapsplus { struct RNCameraUpdate; }
|
|
28
28
|
|
|
29
29
|
#include <string>
|
|
30
30
|
#include <optional>
|
|
31
|
-
#include "
|
|
31
|
+
#include "RNCameraUpdate.hpp"
|
|
32
32
|
|
|
33
33
|
namespace margelo::nitro::rngooglemapsplus {
|
|
34
34
|
|
|
@@ -39,12 +39,12 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
39
39
|
public:
|
|
40
40
|
std::optional<std::string> mapId SWIFT_PRIVATE;
|
|
41
41
|
std::optional<bool> liteMode SWIFT_PRIVATE;
|
|
42
|
-
std::optional<
|
|
42
|
+
std::optional<RNCameraUpdate> camera SWIFT_PRIVATE;
|
|
43
43
|
std::optional<std::string> backgroundColor SWIFT_PRIVATE;
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
46
|
RNInitialProps() = default;
|
|
47
|
-
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<
|
|
47
|
+
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<RNCameraUpdate> camera, std::optional<std::string> backgroundColor): mapId(mapId), liteMode(liteMode), camera(camera), backgroundColor(backgroundColor) {}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -59,7 +59,7 @@ namespace margelo::nitro {
|
|
|
59
59
|
return margelo::nitro::rngooglemapsplus::RNInitialProps(
|
|
60
60
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "mapId")),
|
|
61
61
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "liteMode")),
|
|
62
|
-
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::
|
|
62
|
+
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCameraUpdate>>::fromJSI(runtime, obj.getProperty(runtime, "camera")),
|
|
63
63
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "backgroundColor"))
|
|
64
64
|
);
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ namespace margelo::nitro {
|
|
|
67
67
|
jsi::Object obj(runtime);
|
|
68
68
|
obj.setProperty(runtime, "mapId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mapId));
|
|
69
69
|
obj.setProperty(runtime, "liteMode", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.liteMode));
|
|
70
|
-
obj.setProperty(runtime, "camera", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::
|
|
70
|
+
obj.setProperty(runtime, "camera", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCameraUpdate>>::toJSI(runtime, arg.camera));
|
|
71
71
|
obj.setProperty(runtime, "backgroundColor", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.backgroundColor));
|
|
72
72
|
return obj;
|
|
73
73
|
}
|
|
@@ -81,7 +81,7 @@ namespace margelo::nitro {
|
|
|
81
81
|
}
|
|
82
82
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "mapId"))) return false;
|
|
83
83
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "liteMode"))) return false;
|
|
84
|
-
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::
|
|
84
|
+
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCameraUpdate>>::canConvert(runtime, obj.getProperty(runtime, "camera"))) return false;
|
|
85
85
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "backgroundColor"))) return false;
|
|
86
86
|
return true;
|
|
87
87
|
}
|
|
@@ -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 RNCamera& /* camera */)>>> {
|
|
239
239
|
try {
|
|
240
240
|
const react::RawValue* rawValue = rawProps.at("onMapLoaded", nullptr, nullptr);
|
|
241
241
|
if (rawValue == nullptr) return sourceProps.onMapLoaded;
|
|
242
242
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
243
|
-
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const
|
|
243
|
+
return CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapLoaded);
|
|
244
244
|
} catch (const std::exception& exc) {
|
|
245
245
|
throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMapLoaded: ") + exc.what());
|
|
246
246
|
}
|
|
@@ -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 RNCamera& /* 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 RNCamera& /* 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 RNCamera& /* 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 RNCamera& /* 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 RNCamera& /* 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 RNCamera& /* 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 "RNCamera.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 RNCamera& /* camera */)>>> onMapLoaded;
|
|
91
91
|
CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> onLocationUpdate;
|
|
92
92
|
CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>> onLocationError;
|
|
93
93
|
CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> onMapPress;
|
|
@@ -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 RNCamera& /* camera */, bool /* isGesture */)>>> onCameraChangeStart;
|
|
111
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> onCameraChange;
|
|
112
|
+
CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* 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,7 +5,7 @@ import type {
|
|
|
5
5
|
} from 'react-native-nitro-modules';
|
|
6
6
|
import type {
|
|
7
7
|
RNCamera,
|
|
8
|
-
|
|
8
|
+
RNCameraUpdate,
|
|
9
9
|
RNLatLng,
|
|
10
10
|
RNMapPadding,
|
|
11
11
|
RNPolygon,
|
|
@@ -54,7 +54,7 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
|
|
|
54
54
|
locationConfig?: RNLocationConfig;
|
|
55
55
|
onMapError?: (error: RNMapErrorCode) => void;
|
|
56
56
|
onMapReady?: (ready: boolean) => void;
|
|
57
|
-
onMapLoaded?: (region: RNRegion, camera:
|
|
57
|
+
onMapLoaded?: (region: RNRegion, camera: RNCamera) => void;
|
|
58
58
|
onLocationUpdate?: (location: RNLocation) => void;
|
|
59
59
|
onLocationError?: (error: RNLocationErrorCode) => void;
|
|
60
60
|
onMapPress?: (coordinate: RNLatLng) => void;
|
|
@@ -76,17 +76,17 @@ export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
|
|
|
76
76
|
onMyLocationButtonPress?: (pressed: boolean) => void;
|
|
77
77
|
onCameraChangeStart?: (
|
|
78
78
|
region: RNRegion,
|
|
79
|
-
camera:
|
|
79
|
+
camera: RNCamera,
|
|
80
80
|
isGesture: boolean
|
|
81
81
|
) => void;
|
|
82
82
|
onCameraChange?: (
|
|
83
83
|
region: RNRegion,
|
|
84
|
-
camera:
|
|
84
|
+
camera: RNCamera,
|
|
85
85
|
isGesture: boolean
|
|
86
86
|
) => void;
|
|
87
87
|
onCameraChangeComplete?: (
|
|
88
88
|
region: RNRegion,
|
|
89
|
-
camera:
|
|
89
|
+
camera: RNCamera,
|
|
90
90
|
isGesture: boolean
|
|
91
91
|
) => void;
|
|
92
92
|
}
|
|
@@ -96,7 +96,11 @@ export interface RNGoogleMapsPlusViewMethods extends HybridViewMethods {
|
|
|
96
96
|
|
|
97
97
|
hideMarkerInfoWindow(id: string): void;
|
|
98
98
|
|
|
99
|
-
setCamera(
|
|
99
|
+
setCamera(
|
|
100
|
+
camera: RNCameraUpdate,
|
|
101
|
+
animated?: boolean,
|
|
102
|
+
durationMs?: number
|
|
103
|
+
): void;
|
|
100
104
|
|
|
101
105
|
setCameraToCoordinates(
|
|
102
106
|
coordinates: RNLatLng[],
|
package/src/types.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type GoogleMapsViewRef = HybridView<RNGoogleMapsPlusViewMethods>;
|
|
|
6
6
|
export type RNInitialProps = {
|
|
7
7
|
mapId?: string;
|
|
8
8
|
liteMode?: boolean;
|
|
9
|
-
camera?:
|
|
9
|
+
camera?: RNCameraUpdate;
|
|
10
10
|
backgroundColor?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -130,14 +130,14 @@ export interface RNMapStyleElement {
|
|
|
130
130
|
stylers: RNMapStyler[];
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
export type
|
|
133
|
+
export type RNCamera = {
|
|
134
134
|
center: RNLatLng;
|
|
135
135
|
zoom: number;
|
|
136
136
|
bearing: number;
|
|
137
137
|
tilt: number;
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
export type
|
|
140
|
+
export type RNCameraUpdate = {
|
|
141
141
|
center?: RNLatLng;
|
|
142
142
|
zoom?: number;
|
|
143
143
|
bearing?: number;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JFunc_void_RNRegion_RNCameraChange_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 "RNCameraChange.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 "JRNCameraChange.hpp"
|
|
22
|
-
|
|
23
|
-
namespace margelo::nitro::rngooglemapsplus {
|
|
24
|
-
|
|
25
|
-
using namespace facebook;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Represents the Java/Kotlin callback `(region: RNRegion, camera: RNCameraChange, isGesture: Boolean) -> Unit`.
|
|
29
|
-
* This can be passed around between C++ and Java/Kotlin.
|
|
30
|
-
*/
|
|
31
|
-
struct JFunc_void_RNRegion_RNCameraChange_bool: public jni::JavaClass<JFunc_void_RNRegion_RNCameraChange_bool> {
|
|
32
|
-
public:
|
|
33
|
-
static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCameraChange_bool;";
|
|
34
|
-
|
|
35
|
-
public:
|
|
36
|
-
/**
|
|
37
|
-
* Invokes the function this `JFunc_void_RNRegion_RNCameraChange_bool` instance holds through JNI.
|
|
38
|
-
*/
|
|
39
|
-
void invoke(const RNRegion& region, const RNCameraChange& camera, bool isGesture) const {
|
|
40
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JRNRegion> /* region */, jni::alias_ref<JRNCameraChange> /* camera */, jboolean /* isGesture */)>("invoke");
|
|
41
|
-
method(self(), JRNRegion::fromCpp(region), JRNCameraChange::fromCpp(camera), isGesture);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* An implementation of Func_void_RNRegion_RNCameraChange_bool that is backed by a C++ implementation (using `std::function<...>`)
|
|
47
|
-
*/
|
|
48
|
-
struct JFunc_void_RNRegion_RNCameraChange_bool_cxx final: public jni::HybridClass<JFunc_void_RNRegion_RNCameraChange_bool_cxx, JFunc_void_RNRegion_RNCameraChange_bool> {
|
|
49
|
-
public:
|
|
50
|
-
static jni::local_ref<JFunc_void_RNRegion_RNCameraChange_bool::javaobject> fromCpp(const std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>& func) {
|
|
51
|
-
return JFunc_void_RNRegion_RNCameraChange_bool_cxx::newObjectCxxArgs(func);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public:
|
|
55
|
-
/**
|
|
56
|
-
* Invokes the C++ `std::function<...>` this `JFunc_void_RNRegion_RNCameraChange_bool_cxx` instance holds.
|
|
57
|
-
*/
|
|
58
|
-
void invoke_cxx(jni::alias_ref<JRNRegion> region, jni::alias_ref<JRNCameraChange> camera, jboolean isGesture) {
|
|
59
|
-
_func(region->toCpp(), camera->toCpp(), static_cast<bool>(isGesture));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public:
|
|
63
|
-
[[nodiscard]]
|
|
64
|
-
inline const std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>& getFunction() const {
|
|
65
|
-
return _func;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public:
|
|
69
|
-
static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/Func_void_RNRegion_RNCameraChange_bool_cxx;";
|
|
70
|
-
static void registerNatives() {
|
|
71
|
-
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RNRegion_RNCameraChange_bool_cxx::invoke_cxx)});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private:
|
|
75
|
-
explicit JFunc_void_RNRegion_RNCameraChange_bool_cxx(const std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)>& func): _func(func) { }
|
|
76
|
-
|
|
77
|
-
private:
|
|
78
|
-
friend HybridBase;
|
|
79
|
-
std::function<void(const RNRegion& /* region */, const RNCameraChange& /* camera */, bool /* isGesture */)> _func;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JRNCameraChange.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 "RNCameraChange.hpp"
|
|
12
|
-
|
|
13
|
-
#include "JRNLatLng.hpp"
|
|
14
|
-
#include "RNLatLng.hpp"
|
|
15
|
-
|
|
16
|
-
namespace margelo::nitro::rngooglemapsplus {
|
|
17
|
-
|
|
18
|
-
using namespace facebook;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The C++ JNI bridge between the C++ struct "RNCameraChange" and the the Kotlin data class "RNCameraChange".
|
|
22
|
-
*/
|
|
23
|
-
struct JRNCameraChange final: public jni::JavaClass<JRNCameraChange> {
|
|
24
|
-
public:
|
|
25
|
-
static auto constexpr kJavaDescriptor = "Lcom/rngooglemapsplus/RNCameraChange;";
|
|
26
|
-
|
|
27
|
-
public:
|
|
28
|
-
/**
|
|
29
|
-
* Convert this Java/Kotlin-based struct to the C++ struct RNCameraChange by copying all values to C++.
|
|
30
|
-
*/
|
|
31
|
-
[[maybe_unused]]
|
|
32
|
-
[[nodiscard]]
|
|
33
|
-
RNCameraChange toCpp() const {
|
|
34
|
-
static const auto clazz = javaClassStatic();
|
|
35
|
-
static const auto fieldCenter = clazz->getField<JRNLatLng>("center");
|
|
36
|
-
jni::local_ref<JRNLatLng> center = this->getFieldValue(fieldCenter);
|
|
37
|
-
static const auto fieldZoom = clazz->getField<double>("zoom");
|
|
38
|
-
double zoom = this->getFieldValue(fieldZoom);
|
|
39
|
-
static const auto fieldBearing = clazz->getField<double>("bearing");
|
|
40
|
-
double bearing = this->getFieldValue(fieldBearing);
|
|
41
|
-
static const auto fieldTilt = clazz->getField<double>("tilt");
|
|
42
|
-
double tilt = this->getFieldValue(fieldTilt);
|
|
43
|
-
return RNCameraChange(
|
|
44
|
-
center->toCpp(),
|
|
45
|
-
zoom,
|
|
46
|
-
bearing,
|
|
47
|
-
tilt
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
/**
|
|
53
|
-
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
54
|
-
*/
|
|
55
|
-
[[maybe_unused]]
|
|
56
|
-
static jni::local_ref<JRNCameraChange::javaobject> fromCpp(const RNCameraChange& value) {
|
|
57
|
-
using JSignature = JRNCameraChange(jni::alias_ref<JRNLatLng>, double, double, double);
|
|
58
|
-
static const auto clazz = javaClassStatic();
|
|
59
|
-
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
60
|
-
return create(
|
|
61
|
-
clazz,
|
|
62
|
-
JRNLatLng::fromCpp(value.center),
|
|
63
|
-
value.zoom,
|
|
64
|
-
value.bearing,
|
|
65
|
-
value.tilt
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// RNCameraChange.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents an instance of `RNCameraChange`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias RNCameraChange = margelo.nitro.rngooglemapsplus.RNCameraChange
|
|
14
|
-
|
|
15
|
-
public extension RNCameraChange {
|
|
16
|
-
private typealias bridge = margelo.nitro.rngooglemapsplus.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `RNCameraChange`.
|
|
20
|
-
*/
|
|
21
|
-
init(center: RNLatLng, zoom: Double, bearing: Double, tilt: Double) {
|
|
22
|
-
self.init(center, zoom, bearing, tilt)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var center: RNLatLng {
|
|
26
|
-
@inline(__always)
|
|
27
|
-
get {
|
|
28
|
-
return self.__center
|
|
29
|
-
}
|
|
30
|
-
@inline(__always)
|
|
31
|
-
set {
|
|
32
|
-
self.__center = newValue
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var zoom: Double {
|
|
37
|
-
@inline(__always)
|
|
38
|
-
get {
|
|
39
|
-
return self.__zoom
|
|
40
|
-
}
|
|
41
|
-
@inline(__always)
|
|
42
|
-
set {
|
|
43
|
-
self.__zoom = newValue
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var bearing: Double {
|
|
48
|
-
@inline(__always)
|
|
49
|
-
get {
|
|
50
|
-
return self.__bearing
|
|
51
|
-
}
|
|
52
|
-
@inline(__always)
|
|
53
|
-
set {
|
|
54
|
-
self.__bearing = newValue
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var tilt: Double {
|
|
59
|
-
@inline(__always)
|
|
60
|
-
get {
|
|
61
|
-
return self.__tilt
|
|
62
|
-
}
|
|
63
|
-
@inline(__always)
|
|
64
|
-
set {
|
|
65
|
-
self.__tilt = newValue
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|