@maydon_tech/react-native-nitro-maps 0.1.4 → 0.2.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/LICENSE +1 -1
- package/NitroMap.podspec +1 -1
- package/README.md +82 -9
- package/android/CMakeLists.txt +4 -1
- package/android/build.gradle +6 -2
- package/android/gradle.properties +4 -4
- package/android/src/main/cpp/ClusterEngineJNI.cpp +198 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMap.kt +397 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMapConfig.kt +53 -0
- package/android/src/main/{java → kotlin}/com/margelo/nitro/nitromap/NitroMapPackage.kt +4 -4
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMapView.kt +73 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/UserLocationManager.kt +295 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/ClusterIconRenderer.kt +111 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/ClusteringManager.kt +104 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/clustering/NitroClusterEngine.kt +166 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/MarkerIconFactory.kt +303 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/MarkerSelectionHandler.kt +72 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/markers/PriceMarkerRenderer.kt +159 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/MapProviderFactory.kt +24 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/MapProviderInterface.kt +128 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapDelegate.kt +317 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Clustering.kt +524 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Markers.kt +358 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Overlays.kt +272 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+UserLocation.kt +296 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider.kt +815 -0
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/MarkerTagData.kt +19 -0
- package/ios/Location/NitroLocationManager.swift +116 -0
- package/ios/MarkerRenderer/MarkerIconFactory.swift +1 -3
- package/ios/MarkerRenderer/PriceMarkerRenderer.swift +10 -6
- package/ios/NitroMap.swift +279 -13
- package/ios/NitroMapConfig/NitroMapConfig.swift +45 -0
- package/ios/Providers/{GoogleMapDelegate.swift → Google/GoogleMapDelegate.swift} +48 -23
- package/ios/Providers/Google/GoogleMapProvider+Camera.swift +180 -0
- package/ios/Providers/Google/GoogleMapProvider+Clustering.swift +541 -0
- package/ios/Providers/Google/GoogleMapProvider+Markers.swift +270 -0
- package/ios/Providers/Google/GoogleMapProvider+Overlays.swift +245 -0
- package/ios/Providers/Google/GoogleMapProvider+UserLocation.swift +180 -0
- package/ios/Providers/Google/GoogleMapProvider.swift +342 -0
- package/ios/Providers/MapProviderFactory.swift +17 -0
- package/ios/Providers/MapProviderProtocol.swift +48 -1
- package/ios/Shared/ClusterConfig+Factory.swift +2 -2
- package/ios/Shared/MapStyleProvider.swift +6 -4
- package/ios/Shared/MarkerSelectionHandler.swift +4 -1
- package/ios/Utils/ColorValueExtension.swift +46 -67
- package/lib/module/components/ImageMarker.js +39 -29
- package/lib/module/components/ImageMarker.js.map +1 -1
- package/lib/module/components/Marker.js +118 -0
- package/lib/module/components/Marker.js.map +1 -0
- package/lib/module/components/NitroCircle.js +92 -0
- package/lib/module/components/NitroCircle.js.map +1 -0
- package/lib/module/components/NitroMap.js +216 -76
- package/lib/module/components/NitroMap.js.map +1 -1
- package/lib/module/components/NitroPolygon.js +137 -0
- package/lib/module/components/NitroPolygon.js.map +1 -0
- package/lib/module/components/NitroPolyline.js +115 -0
- package/lib/module/components/NitroPolyline.js.map +1 -0
- package/lib/module/components/PriceMarker.js +16 -29
- package/lib/module/components/PriceMarker.js.map +1 -1
- package/lib/module/context/NitroMapContext.js.map +1 -1
- package/lib/module/hooks/useNitroCircle.js +18 -0
- package/lib/module/hooks/useNitroCircle.js.map +1 -0
- package/lib/module/hooks/useNitroMarker.js +26 -9
- package/lib/module/hooks/useNitroMarker.js.map +1 -1
- package/lib/module/hooks/useNitroOverlay.js +59 -0
- package/lib/module/hooks/useNitroOverlay.js.map +1 -0
- package/lib/module/hooks/useNitroPolygon.js +18 -0
- package/lib/module/hooks/useNitroPolygon.js.map +1 -0
- package/lib/module/hooks/useNitroPolyline.js +18 -0
- package/lib/module/hooks/useNitroPolyline.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/overlay.js +4 -0
- package/lib/module/types/overlay.js.map +1 -0
- package/lib/module/types/theme.js +4 -0
- package/lib/module/types/theme.js.map +1 -0
- package/lib/module/utils/colors.js +41 -13
- package/lib/module/utils/colors.js.map +1 -1
- package/lib/module/utils/validation.js +45 -0
- package/lib/module/utils/validation.js.map +1 -0
- package/lib/typescript/src/components/ImageMarker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.d.ts +34 -0
- package/lib/typescript/src/components/Marker.d.ts.map +1 -0
- package/lib/typescript/src/components/NitroCircle.d.ts +70 -0
- package/lib/typescript/src/components/NitroCircle.d.ts.map +1 -0
- package/lib/typescript/src/components/NitroMap.d.ts +60 -3
- package/lib/typescript/src/components/NitroMap.d.ts.map +1 -1
- package/lib/typescript/src/components/NitroPolygon.d.ts +86 -0
- package/lib/typescript/src/components/NitroPolygon.d.ts.map +1 -0
- package/lib/typescript/src/components/NitroPolyline.d.ts +84 -0
- package/lib/typescript/src/components/NitroPolyline.d.ts.map +1 -0
- package/lib/typescript/src/components/PriceMarker.d.ts +0 -5
- package/lib/typescript/src/components/PriceMarker.d.ts.map +1 -1
- package/lib/typescript/src/context/NitroMapContext.d.ts +2 -0
- package/lib/typescript/src/context/NitroMapContext.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useNitroCircle.d.ts +7 -0
- package/lib/typescript/src/hooks/useNitroCircle.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNitroMarker.d.ts +20 -0
- package/lib/typescript/src/hooks/useNitroMarker.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useNitroOverlay.d.ts +26 -0
- package/lib/typescript/src/hooks/useNitroOverlay.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNitroPolygon.d.ts +7 -0
- package/lib/typescript/src/hooks/useNitroPolygon.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNitroPolyline.d.ts +7 -0
- package/lib/typescript/src/hooks/useNitroPolyline.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +15 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NitroMap.nitro.d.ts +248 -6
- package/lib/typescript/src/specs/NitroMap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/map.d.ts +34 -4
- package/lib/typescript/src/types/map.d.ts.map +1 -1
- package/lib/typescript/src/types/marker.d.ts +24 -36
- package/lib/typescript/src/types/marker.d.ts.map +1 -1
- package/lib/typescript/src/types/overlay.d.ts +84 -0
- package/lib/typescript/src/types/overlay.d.ts.map +1 -0
- package/lib/typescript/src/types/theme.d.ts +93 -0
- package/lib/typescript/src/types/theme.d.ts.map +1 -0
- package/lib/typescript/src/utils/colors.d.ts +6 -8
- package/lib/typescript/src/utils/colors.d.ts.map +1 -1
- package/lib/typescript/src/utils/validation.d.ts +12 -0
- package/lib/typescript/src/utils/validation.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JCircleData.hpp +94 -0
- package/nitrogen/generated/android/c++/JClusterConfig.hpp +5 -7
- package/nitrogen/generated/android/c++/JCoordinateRing.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_UserLocationChangeEvent.hpp +79 -0
- package/nitrogen/generated/android/c++/JFunc_void_UserTrackingMode.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridNitroMapSpec.cpp +332 -21
- package/nitrogen/generated/android/c++/JHybridNitroMapSpec.hpp +53 -2
- package/nitrogen/generated/android/c++/JMarkerAnimation.hpp +3 -6
- package/nitrogen/generated/android/c++/JMarkerData.hpp +15 -3
- package/nitrogen/generated/android/c++/JPolygonData.hpp +133 -0
- package/nitrogen/generated/android/c++/JPolylineData.hpp +113 -0
- package/nitrogen/generated/android/c++/JUserLocationChangeEvent.hpp +70 -0
- package/nitrogen/generated/android/c++/JUserTrackingMode.hpp +62 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroMapStateUpdater.cpp +72 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/CircleData.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/ClusterConfig.kt +4 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/CoordinateRing.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_UserLocationChangeEvent.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_UserTrackingMode.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/HybridNitroMapSpec.kt +228 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerAnimation.kt +1 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/MarkerData.kt +12 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PolygonData.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PolylineData.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/UserLocationChangeEvent.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/{ClusterAnimationStyle.kt → UserTrackingMode.kt} +6 -8
- package/nitrogen/generated/android/nitromapOnLoad.cpp +6 -0
- package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.cpp +24 -0
- package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.hpp +178 -17
- package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Umbrella.hpp +18 -3
- package/nitrogen/generated/ios/c++/HybridNitroMapSpecSwift.hpp +252 -16
- package/nitrogen/generated/ios/c++/views/HybridNitroMapComponent.mm +90 -5
- package/nitrogen/generated/ios/swift/CircleData.swift +143 -0
- package/nitrogen/generated/ios/swift/ClusterConfig.swift +22 -15
- package/nitrogen/generated/ios/swift/CoordinateRing.swift +48 -0
- package/nitrogen/generated/ios/swift/Func_void_UserLocationChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_UserTrackingMode.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridNitroMapSpec.swift +35 -1
- package/nitrogen/generated/ios/swift/HybridNitroMapSpec_cxx.swift +582 -8
- package/nitrogen/generated/ios/swift/MarkerAnimation.swift +4 -8
- package/nitrogen/generated/ios/swift/MarkerData.swift +54 -2
- package/nitrogen/generated/ios/swift/PolygonData.swift +167 -0
- package/nitrogen/generated/ios/swift/PolylineData.swift +155 -0
- package/nitrogen/generated/ios/swift/UserLocationChangeEvent.swift +69 -0
- package/nitrogen/generated/ios/swift/UserTrackingMode.swift +44 -0
- package/nitrogen/generated/shared/c++/CircleData.hpp +113 -0
- package/nitrogen/generated/shared/c++/ClusterConfig.hpp +5 -8
- package/nitrogen/generated/shared/c++/CoordinateRing.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridNitroMapSpec.cpp +53 -2
- package/nitrogen/generated/shared/c++/HybridNitroMapSpec.hpp +75 -6
- package/nitrogen/generated/shared/c++/MarkerAnimation.hpp +4 -8
- package/nitrogen/generated/shared/c++/MarkerData.hpp +14 -2
- package/nitrogen/generated/shared/c++/PolygonData.hpp +117 -0
- package/nitrogen/generated/shared/c++/PolylineData.hpp +114 -0
- package/nitrogen/generated/shared/c++/UserLocationChangeEvent.hpp +88 -0
- package/nitrogen/generated/shared/c++/UserTrackingMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.cpp +216 -12
- package/nitrogen/generated/shared/c++/views/HybridNitroMapComponent.hpp +23 -1
- package/nitrogen/generated/shared/json/NitroMapConfig.json +18 -1
- package/package.json +36 -5
- package/src/components/ImageMarker.tsx +58 -42
- package/src/components/Marker.tsx +161 -0
- package/src/components/NitroCircle.tsx +183 -0
- package/src/components/NitroMap.tsx +328 -78
- package/src/components/NitroPolygon.tsx +229 -0
- package/src/components/NitroPolyline.tsx +208 -0
- package/src/components/PriceMarker.tsx +23 -48
- package/src/context/NitroMapContext.tsx +4 -0
- package/src/hooks/useNitroCircle.ts +25 -0
- package/src/hooks/useNitroMarker.ts +49 -10
- package/src/hooks/useNitroOverlay.ts +68 -0
- package/src/hooks/useNitroPolygon.ts +25 -0
- package/src/hooks/useNitroPolyline.ts +25 -0
- package/src/index.tsx +28 -2
- package/src/specs/NitroMap.nitro.ts +294 -5
- package/src/types/map.ts +36 -4
- package/src/types/marker.ts +24 -44
- package/src/types/overlay.ts +87 -0
- package/src/types/theme.ts +101 -0
- package/src/utils/colors.ts +48 -16
- package/src/utils/validation.ts +69 -0
- package/android/src/main/java/com/margelo/nitro/nitromap/ClusterIconGenerator.kt +0 -108
- package/android/src/main/java/com/margelo/nitro/nitromap/ColorUtils.kt +0 -63
- package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMap.kt +0 -408
- package/android/src/main/java/com/margelo/nitro/nitromap/HybridNitroMapConfig.kt +0 -68
- package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconCache.kt +0 -176
- package/android/src/main/java/com/margelo/nitro/nitromap/MarkerIconFactory.kt +0 -252
- package/android/src/main/java/com/margelo/nitro/nitromap/clustering/NitroClusterEngine.kt +0 -252
- package/android/src/main/java/com/margelo/nitro/nitromap/clustering/QuadTree.kt +0 -195
- package/android/src/main/java/com/margelo/nitro/nitromap/providers/GoogleMapProvider.kt +0 -912
- package/android/src/main/java/com/margelo/nitro/nitromap/providers/MapProviderInterface.kt +0 -70
- package/cpp/QuadTree.hpp +0 -246
- package/ios/NitroMapConfig/HybridNitroMapConfig.swift +0 -33
- package/ios/Providers/GoogleMapProvider+Camera.swift +0 -164
- package/ios/Providers/GoogleMapProvider.swift +0 -924
- package/nitrogen/generated/android/c++/JClusterAnimationStyle.hpp +0 -68
- package/nitrogen/generated/ios/swift/ClusterAnimationStyle.swift +0 -52
- package/nitrogen/generated/shared/c++/ClusterAnimationStyle.hpp +0 -88
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PolylineData.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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 `Coordinate` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
28
|
+
// Forward declaration of `MarkerColor` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitromap { struct MarkerColor; }
|
|
30
|
+
|
|
31
|
+
#include <string>
|
|
32
|
+
#include "Coordinate.hpp"
|
|
33
|
+
#include <vector>
|
|
34
|
+
#include "MarkerColor.hpp"
|
|
35
|
+
#include <optional>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::nitromap {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (PolylineData).
|
|
41
|
+
*/
|
|
42
|
+
struct PolylineData {
|
|
43
|
+
public:
|
|
44
|
+
std::string id SWIFT_PRIVATE;
|
|
45
|
+
std::vector<Coordinate> coordinates SWIFT_PRIVATE;
|
|
46
|
+
MarkerColor strokeColor SWIFT_PRIVATE;
|
|
47
|
+
double strokeWidth SWIFT_PRIVATE;
|
|
48
|
+
bool geodesic SWIFT_PRIVATE;
|
|
49
|
+
bool dashed SWIFT_PRIVATE;
|
|
50
|
+
double zIndex SWIFT_PRIVATE;
|
|
51
|
+
bool tappable SWIFT_PRIVATE;
|
|
52
|
+
std::optional<std::string> accessibilityLabel SWIFT_PRIVATE;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
PolylineData() = default;
|
|
56
|
+
explicit PolylineData(std::string id, std::vector<Coordinate> coordinates, MarkerColor strokeColor, double strokeWidth, bool geodesic, bool dashed, double zIndex, bool tappable, std::optional<std::string> accessibilityLabel): id(id), coordinates(coordinates), strokeColor(strokeColor), strokeWidth(strokeWidth), geodesic(geodesic), dashed(dashed), zIndex(zIndex), tappable(tappable), accessibilityLabel(accessibilityLabel) {}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::nitromap
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ PolylineData <> JS PolylineData (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::nitromap::PolylineData> final {
|
|
66
|
+
static inline margelo::nitro::nitromap::PolylineData fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::nitromap::PolylineData(
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "id")),
|
|
70
|
+
JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::fromJSI(runtime, obj.getProperty(runtime, "coordinates")),
|
|
71
|
+
JSIConverter<margelo::nitro::nitromap::MarkerColor>::fromJSI(runtime, obj.getProperty(runtime, "strokeColor")),
|
|
72
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "strokeWidth")),
|
|
73
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "geodesic")),
|
|
74
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "dashed")),
|
|
75
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "zIndex")),
|
|
76
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "tappable")),
|
|
77
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "accessibilityLabel"))
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitromap::PolylineData& arg) {
|
|
81
|
+
jsi::Object obj(runtime);
|
|
82
|
+
obj.setProperty(runtime, "id", JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
83
|
+
obj.setProperty(runtime, "coordinates", JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::toJSI(runtime, arg.coordinates));
|
|
84
|
+
obj.setProperty(runtime, "strokeColor", JSIConverter<margelo::nitro::nitromap::MarkerColor>::toJSI(runtime, arg.strokeColor));
|
|
85
|
+
obj.setProperty(runtime, "strokeWidth", JSIConverter<double>::toJSI(runtime, arg.strokeWidth));
|
|
86
|
+
obj.setProperty(runtime, "geodesic", JSIConverter<bool>::toJSI(runtime, arg.geodesic));
|
|
87
|
+
obj.setProperty(runtime, "dashed", JSIConverter<bool>::toJSI(runtime, arg.dashed));
|
|
88
|
+
obj.setProperty(runtime, "zIndex", JSIConverter<double>::toJSI(runtime, arg.zIndex));
|
|
89
|
+
obj.setProperty(runtime, "tappable", JSIConverter<bool>::toJSI(runtime, arg.tappable));
|
|
90
|
+
obj.setProperty(runtime, "accessibilityLabel", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.accessibilityLabel));
|
|
91
|
+
return obj;
|
|
92
|
+
}
|
|
93
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
94
|
+
if (!value.isObject()) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
jsi::Object obj = value.getObject(runtime);
|
|
98
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
|
|
102
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::canConvert(runtime, obj.getProperty(runtime, "coordinates"))) return false;
|
|
103
|
+
if (!JSIConverter<margelo::nitro::nitromap::MarkerColor>::canConvert(runtime, obj.getProperty(runtime, "strokeColor"))) return false;
|
|
104
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "strokeWidth"))) return false;
|
|
105
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "geodesic"))) return false;
|
|
106
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "dashed"))) return false;
|
|
107
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "zIndex"))) return false;
|
|
108
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "tappable"))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "accessibilityLabel"))) return false;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UserLocationChangeEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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 `Coordinate` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
28
|
+
|
|
29
|
+
#include "Coordinate.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::nitromap {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (UserLocationChangeEvent).
|
|
35
|
+
*/
|
|
36
|
+
struct UserLocationChangeEvent {
|
|
37
|
+
public:
|
|
38
|
+
Coordinate coordinate SWIFT_PRIVATE;
|
|
39
|
+
double accuracy SWIFT_PRIVATE;
|
|
40
|
+
double heading SWIFT_PRIVATE;
|
|
41
|
+
double speed SWIFT_PRIVATE;
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
UserLocationChangeEvent() = default;
|
|
45
|
+
explicit UserLocationChangeEvent(Coordinate coordinate, double accuracy, double heading, double speed): coordinate(coordinate), accuracy(accuracy), heading(heading), speed(speed) {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
} // namespace margelo::nitro::nitromap
|
|
49
|
+
|
|
50
|
+
namespace margelo::nitro {
|
|
51
|
+
|
|
52
|
+
// C++ UserLocationChangeEvent <> JS UserLocationChangeEvent (object)
|
|
53
|
+
template <>
|
|
54
|
+
struct JSIConverter<margelo::nitro::nitromap::UserLocationChangeEvent> final {
|
|
55
|
+
static inline margelo::nitro::nitromap::UserLocationChangeEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
56
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
57
|
+
return margelo::nitro::nitromap::UserLocationChangeEvent(
|
|
58
|
+
JSIConverter<margelo::nitro::nitromap::Coordinate>::fromJSI(runtime, obj.getProperty(runtime, "coordinate")),
|
|
59
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "accuracy")),
|
|
60
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "heading")),
|
|
61
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "speed"))
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitromap::UserLocationChangeEvent& arg) {
|
|
65
|
+
jsi::Object obj(runtime);
|
|
66
|
+
obj.setProperty(runtime, "coordinate", JSIConverter<margelo::nitro::nitromap::Coordinate>::toJSI(runtime, arg.coordinate));
|
|
67
|
+
obj.setProperty(runtime, "accuracy", JSIConverter<double>::toJSI(runtime, arg.accuracy));
|
|
68
|
+
obj.setProperty(runtime, "heading", JSIConverter<double>::toJSI(runtime, arg.heading));
|
|
69
|
+
obj.setProperty(runtime, "speed", JSIConverter<double>::toJSI(runtime, arg.speed));
|
|
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::nitromap::Coordinate>::canConvert(runtime, obj.getProperty(runtime, "coordinate"))) return false;
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "accuracy"))) return false;
|
|
82
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "heading"))) return false;
|
|
83
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "speed"))) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UserTrackingMode.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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::nitromap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (UserTrackingMode).
|
|
30
|
+
*/
|
|
31
|
+
enum class UserTrackingMode {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
FOLLOW SWIFT_NAME(follow) = 1,
|
|
34
|
+
FOLLOWWITHHEADING SWIFT_NAME(followwithheading) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitromap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ UserTrackingMode <> JS UserTrackingMode (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitromap::UserTrackingMode> final {
|
|
44
|
+
static inline margelo::nitro::nitromap::UserTrackingMode 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("none"): return margelo::nitro::nitromap::UserTrackingMode::NONE;
|
|
48
|
+
case hashString("follow"): return margelo::nitro::nitromap::UserTrackingMode::FOLLOW;
|
|
49
|
+
case hashString("followWithHeading"): return margelo::nitro::nitromap::UserTrackingMode::FOLLOWWITHHEADING;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum UserTrackingMode - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitromap::UserTrackingMode arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitromap::UserTrackingMode::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
57
|
+
case margelo::nitro::nitromap::UserTrackingMode::FOLLOW: return JSIConverter<std::string>::toJSI(runtime, "follow");
|
|
58
|
+
case margelo::nitro::nitromap::UserTrackingMode::FOLLOWWITHHEADING: return JSIConverter<std::string>::toJSI(runtime, "followWithHeading");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert UserTrackingMode 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("none"):
|
|
71
|
+
case hashString("follow"):
|
|
72
|
+
case hashString("followWithHeading"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -45,6 +45,16 @@ namespace margelo::nitro::nitromap::views {
|
|
|
45
45
|
throw std::runtime_error(std::string("NitroMap.initialRegion: ") + exc.what());
|
|
46
46
|
}
|
|
47
47
|
}()),
|
|
48
|
+
region([&]() -> CachedProp<std::optional<Region>> {
|
|
49
|
+
try {
|
|
50
|
+
const react::RawValue* rawValue = rawProps.at("region", nullptr, nullptr);
|
|
51
|
+
if (rawValue == nullptr) return sourceProps.region;
|
|
52
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
53
|
+
return CachedProp<std::optional<Region>>::fromRawValue(*runtime, value, sourceProps.region);
|
|
54
|
+
} catch (const std::exception& exc) {
|
|
55
|
+
throw std::runtime_error(std::string("NitroMap.region: ") + exc.what());
|
|
56
|
+
}
|
|
57
|
+
}()),
|
|
48
58
|
showsUserLocation([&]() -> CachedProp<std::optional<bool>> {
|
|
49
59
|
try {
|
|
50
60
|
const react::RawValue* rawValue = rawProps.at("showsUserLocation", nullptr, nullptr);
|
|
@@ -115,16 +125,6 @@ namespace margelo::nitro::nitromap::views {
|
|
|
115
125
|
throw std::runtime_error(std::string("NitroMap.customMapStyle: ") + exc.what());
|
|
116
126
|
}
|
|
117
127
|
}()),
|
|
118
|
-
showsMyLocationButton([&]() -> CachedProp<std::optional<bool>> {
|
|
119
|
-
try {
|
|
120
|
-
const react::RawValue* rawValue = rawProps.at("showsMyLocationButton", nullptr, nullptr);
|
|
121
|
-
if (rawValue == nullptr) return sourceProps.showsMyLocationButton;
|
|
122
|
-
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
123
|
-
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.showsMyLocationButton);
|
|
124
|
-
} catch (const std::exception& exc) {
|
|
125
|
-
throw std::runtime_error(std::string("NitroMap.showsMyLocationButton: ") + exc.what());
|
|
126
|
-
}
|
|
127
|
-
}()),
|
|
128
128
|
clusterConfig([&]() -> CachedProp<std::optional<ClusterConfig>> {
|
|
129
129
|
try {
|
|
130
130
|
const react::RawValue* rawValue = rawProps.at("clusterConfig", nullptr, nullptr);
|
|
@@ -135,6 +135,66 @@ namespace margelo::nitro::nitromap::views {
|
|
|
135
135
|
throw std::runtime_error(std::string("NitroMap.clusterConfig: ") + exc.what());
|
|
136
136
|
}
|
|
137
137
|
}()),
|
|
138
|
+
mapPadding([&]() -> CachedProp<EdgePadding> {
|
|
139
|
+
try {
|
|
140
|
+
const react::RawValue* rawValue = rawProps.at("mapPadding", nullptr, nullptr);
|
|
141
|
+
if (rawValue == nullptr) return sourceProps.mapPadding;
|
|
142
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
143
|
+
return CachedProp<EdgePadding>::fromRawValue(*runtime, value, sourceProps.mapPadding);
|
|
144
|
+
} catch (const std::exception& exc) {
|
|
145
|
+
throw std::runtime_error(std::string("NitroMap.mapPadding: ") + exc.what());
|
|
146
|
+
}
|
|
147
|
+
}()),
|
|
148
|
+
showsTraffic([&]() -> CachedProp<std::optional<bool>> {
|
|
149
|
+
try {
|
|
150
|
+
const react::RawValue* rawValue = rawProps.at("showsTraffic", nullptr, nullptr);
|
|
151
|
+
if (rawValue == nullptr) return sourceProps.showsTraffic;
|
|
152
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
153
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.showsTraffic);
|
|
154
|
+
} catch (const std::exception& exc) {
|
|
155
|
+
throw std::runtime_error(std::string("NitroMap.showsTraffic: ") + exc.what());
|
|
156
|
+
}
|
|
157
|
+
}()),
|
|
158
|
+
showsBuildings([&]() -> CachedProp<std::optional<bool>> {
|
|
159
|
+
try {
|
|
160
|
+
const react::RawValue* rawValue = rawProps.at("showsBuildings", nullptr, nullptr);
|
|
161
|
+
if (rawValue == nullptr) return sourceProps.showsBuildings;
|
|
162
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
163
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.showsBuildings);
|
|
164
|
+
} catch (const std::exception& exc) {
|
|
165
|
+
throw std::runtime_error(std::string("NitroMap.showsBuildings: ") + exc.what());
|
|
166
|
+
}
|
|
167
|
+
}()),
|
|
168
|
+
showsCompass([&]() -> CachedProp<std::optional<bool>> {
|
|
169
|
+
try {
|
|
170
|
+
const react::RawValue* rawValue = rawProps.at("showsCompass", nullptr, nullptr);
|
|
171
|
+
if (rawValue == nullptr) return sourceProps.showsCompass;
|
|
172
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
173
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.showsCompass);
|
|
174
|
+
} catch (const std::exception& exc) {
|
|
175
|
+
throw std::runtime_error(std::string("NitroMap.showsCompass: ") + exc.what());
|
|
176
|
+
}
|
|
177
|
+
}()),
|
|
178
|
+
minZoom([&]() -> CachedProp<double> {
|
|
179
|
+
try {
|
|
180
|
+
const react::RawValue* rawValue = rawProps.at("minZoom", nullptr, nullptr);
|
|
181
|
+
if (rawValue == nullptr) return sourceProps.minZoom;
|
|
182
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
183
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.minZoom);
|
|
184
|
+
} catch (const std::exception& exc) {
|
|
185
|
+
throw std::runtime_error(std::string("NitroMap.minZoom: ") + exc.what());
|
|
186
|
+
}
|
|
187
|
+
}()),
|
|
188
|
+
maxZoom([&]() -> CachedProp<double> {
|
|
189
|
+
try {
|
|
190
|
+
const react::RawValue* rawValue = rawProps.at("maxZoom", nullptr, nullptr);
|
|
191
|
+
if (rawValue == nullptr) return sourceProps.maxZoom;
|
|
192
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
193
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.maxZoom);
|
|
194
|
+
} catch (const std::exception& exc) {
|
|
195
|
+
throw std::runtime_error(std::string("NitroMap.maxZoom: ") + exc.what());
|
|
196
|
+
}
|
|
197
|
+
}()),
|
|
138
198
|
darkMode([&]() -> CachedProp<std::optional<bool>> {
|
|
139
199
|
try {
|
|
140
200
|
const react::RawValue* rawValue = rawProps.at("darkMode", nullptr, nullptr);
|
|
@@ -145,6 +205,46 @@ namespace margelo::nitro::nitromap::views {
|
|
|
145
205
|
throw std::runtime_error(std::string("NitroMap.darkMode: ") + exc.what());
|
|
146
206
|
}
|
|
147
207
|
}()),
|
|
208
|
+
userTrackingMode([&]() -> CachedProp<std::optional<UserTrackingMode>> {
|
|
209
|
+
try {
|
|
210
|
+
const react::RawValue* rawValue = rawProps.at("userTrackingMode", nullptr, nullptr);
|
|
211
|
+
if (rawValue == nullptr) return sourceProps.userTrackingMode;
|
|
212
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
213
|
+
return CachedProp<std::optional<UserTrackingMode>>::fromRawValue(*runtime, value, sourceProps.userTrackingMode);
|
|
214
|
+
} catch (const std::exception& exc) {
|
|
215
|
+
throw std::runtime_error(std::string("NitroMap.userTrackingMode: ") + exc.what());
|
|
216
|
+
}
|
|
217
|
+
}()),
|
|
218
|
+
userLocationImage([&]() -> CachedProp<std::string> {
|
|
219
|
+
try {
|
|
220
|
+
const react::RawValue* rawValue = rawProps.at("userLocationImage", nullptr, nullptr);
|
|
221
|
+
if (rawValue == nullptr) return sourceProps.userLocationImage;
|
|
222
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
223
|
+
return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.userLocationImage);
|
|
224
|
+
} catch (const std::exception& exc) {
|
|
225
|
+
throw std::runtime_error(std::string("NitroMap.userLocationImage: ") + exc.what());
|
|
226
|
+
}
|
|
227
|
+
}()),
|
|
228
|
+
userLocationSize([&]() -> CachedProp<double> {
|
|
229
|
+
try {
|
|
230
|
+
const react::RawValue* rawValue = rawProps.at("userLocationSize", nullptr, nullptr);
|
|
231
|
+
if (rawValue == nullptr) return sourceProps.userLocationSize;
|
|
232
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
233
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.userLocationSize);
|
|
234
|
+
} catch (const std::exception& exc) {
|
|
235
|
+
throw std::runtime_error(std::string("NitroMap.userLocationSize: ") + exc.what());
|
|
236
|
+
}
|
|
237
|
+
}()),
|
|
238
|
+
userLocationAnchor([&]() -> CachedProp<std::optional<Point>> {
|
|
239
|
+
try {
|
|
240
|
+
const react::RawValue* rawValue = rawProps.at("userLocationAnchor", nullptr, nullptr);
|
|
241
|
+
if (rawValue == nullptr) return sourceProps.userLocationAnchor;
|
|
242
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
243
|
+
return CachedProp<std::optional<Point>>::fromRawValue(*runtime, value, sourceProps.userLocationAnchor);
|
|
244
|
+
} catch (const std::exception& exc) {
|
|
245
|
+
throw std::runtime_error(std::string("NitroMap.userLocationAnchor: ") + exc.what());
|
|
246
|
+
}
|
|
247
|
+
}()),
|
|
148
248
|
onPress([&]() -> CachedProp<std::optional<std::function<void(const MapPressEvent& /* event */)>>> {
|
|
149
249
|
try {
|
|
150
250
|
const react::RawValue* rawValue = rawProps.at("onPress", nullptr, nullptr);
|
|
@@ -245,6 +345,36 @@ namespace margelo::nitro::nitromap::views {
|
|
|
245
345
|
throw std::runtime_error(std::string("NitroMap.onClusterPress: ") + exc.what());
|
|
246
346
|
}
|
|
247
347
|
}()),
|
|
348
|
+
onPolylinePress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
|
|
349
|
+
try {
|
|
350
|
+
const react::RawValue* rawValue = rawProps.at("onPolylinePress", nullptr, nullptr);
|
|
351
|
+
if (rawValue == nullptr) return sourceProps.onPolylinePress;
|
|
352
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
353
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onPolylinePress);
|
|
354
|
+
} catch (const std::exception& exc) {
|
|
355
|
+
throw std::runtime_error(std::string("NitroMap.onPolylinePress: ") + exc.what());
|
|
356
|
+
}
|
|
357
|
+
}()),
|
|
358
|
+
onPolygonPress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
|
|
359
|
+
try {
|
|
360
|
+
const react::RawValue* rawValue = rawProps.at("onPolygonPress", nullptr, nullptr);
|
|
361
|
+
if (rawValue == nullptr) return sourceProps.onPolygonPress;
|
|
362
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
363
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onPolygonPress);
|
|
364
|
+
} catch (const std::exception& exc) {
|
|
365
|
+
throw std::runtime_error(std::string("NitroMap.onPolygonPress: ") + exc.what());
|
|
366
|
+
}
|
|
367
|
+
}()),
|
|
368
|
+
onCirclePress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
|
|
369
|
+
try {
|
|
370
|
+
const react::RawValue* rawValue = rawProps.at("onCirclePress", nullptr, nullptr);
|
|
371
|
+
if (rawValue == nullptr) return sourceProps.onCirclePress;
|
|
372
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
373
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCirclePress);
|
|
374
|
+
} catch (const std::exception& exc) {
|
|
375
|
+
throw std::runtime_error(std::string("NitroMap.onCirclePress: ") + exc.what());
|
|
376
|
+
}
|
|
377
|
+
}()),
|
|
248
378
|
onError([&]() -> CachedProp<std::optional<std::function<void(const MapError& /* error */)>>> {
|
|
249
379
|
try {
|
|
250
380
|
const react::RawValue* rawValue = rawProps.at("onError", nullptr, nullptr);
|
|
@@ -255,6 +385,46 @@ namespace margelo::nitro::nitromap::views {
|
|
|
255
385
|
throw std::runtime_error(std::string("NitroMap.onError: ") + exc.what());
|
|
256
386
|
}
|
|
257
387
|
}()),
|
|
388
|
+
onUserLocationChange([&]() -> CachedProp<std::optional<std::function<void(const UserLocationChangeEvent& /* event */)>>> {
|
|
389
|
+
try {
|
|
390
|
+
const react::RawValue* rawValue = rawProps.at("onUserLocationChange", nullptr, nullptr);
|
|
391
|
+
if (rawValue == nullptr) return sourceProps.onUserLocationChange;
|
|
392
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
393
|
+
return CachedProp<std::optional<std::function<void(const UserLocationChangeEvent& /* event */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onUserLocationChange);
|
|
394
|
+
} catch (const std::exception& exc) {
|
|
395
|
+
throw std::runtime_error(std::string("NitroMap.onUserLocationChange: ") + exc.what());
|
|
396
|
+
}
|
|
397
|
+
}()),
|
|
398
|
+
onUserTrackingModeChange([&]() -> CachedProp<std::optional<std::function<void(UserTrackingMode /* mode */)>>> {
|
|
399
|
+
try {
|
|
400
|
+
const react::RawValue* rawValue = rawProps.at("onUserTrackingModeChange", nullptr, nullptr);
|
|
401
|
+
if (rawValue == nullptr) return sourceProps.onUserTrackingModeChange;
|
|
402
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
403
|
+
return CachedProp<std::optional<std::function<void(UserTrackingMode /* mode */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onUserTrackingModeChange);
|
|
404
|
+
} catch (const std::exception& exc) {
|
|
405
|
+
throw std::runtime_error(std::string("NitroMap.onUserTrackingModeChange: ") + exc.what());
|
|
406
|
+
}
|
|
407
|
+
}()),
|
|
408
|
+
onUserLocationError([&]() -> CachedProp<std::optional<std::function<void(const MapError& /* error */)>>> {
|
|
409
|
+
try {
|
|
410
|
+
const react::RawValue* rawValue = rawProps.at("onUserLocationError", nullptr, nullptr);
|
|
411
|
+
if (rawValue == nullptr) return sourceProps.onUserLocationError;
|
|
412
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
413
|
+
return CachedProp<std::optional<std::function<void(const MapError& /* error */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onUserLocationError);
|
|
414
|
+
} catch (const std::exception& exc) {
|
|
415
|
+
throw std::runtime_error(std::string("NitroMap.onUserLocationError: ") + exc.what());
|
|
416
|
+
}
|
|
417
|
+
}()),
|
|
418
|
+
onMapIdle([&]() -> CachedProp<std::optional<std::function<void()>>> {
|
|
419
|
+
try {
|
|
420
|
+
const react::RawValue* rawValue = rawProps.at("onMapIdle", nullptr, nullptr);
|
|
421
|
+
if (rawValue == nullptr) return sourceProps.onMapIdle;
|
|
422
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
423
|
+
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMapIdle);
|
|
424
|
+
} catch (const std::exception& exc) {
|
|
425
|
+
throw std::runtime_error(std::string("NitroMap.onMapIdle: ") + exc.what());
|
|
426
|
+
}
|
|
427
|
+
}()),
|
|
258
428
|
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroMapSpec>& /* ref */)>>> {
|
|
259
429
|
try {
|
|
260
430
|
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
@@ -270,6 +440,7 @@ namespace margelo::nitro::nitromap::views {
|
|
|
270
440
|
react::ViewProps(),
|
|
271
441
|
provider(other.provider),
|
|
272
442
|
initialRegion(other.initialRegion),
|
|
443
|
+
region(other.region),
|
|
273
444
|
showsUserLocation(other.showsUserLocation),
|
|
274
445
|
zoomEnabled(other.zoomEnabled),
|
|
275
446
|
scrollEnabled(other.scrollEnabled),
|
|
@@ -277,9 +448,18 @@ namespace margelo::nitro::nitromap::views {
|
|
|
277
448
|
pitchEnabled(other.pitchEnabled),
|
|
278
449
|
mapType(other.mapType),
|
|
279
450
|
customMapStyle(other.customMapStyle),
|
|
280
|
-
showsMyLocationButton(other.showsMyLocationButton),
|
|
281
451
|
clusterConfig(other.clusterConfig),
|
|
452
|
+
mapPadding(other.mapPadding),
|
|
453
|
+
showsTraffic(other.showsTraffic),
|
|
454
|
+
showsBuildings(other.showsBuildings),
|
|
455
|
+
showsCompass(other.showsCompass),
|
|
456
|
+
minZoom(other.minZoom),
|
|
457
|
+
maxZoom(other.maxZoom),
|
|
282
458
|
darkMode(other.darkMode),
|
|
459
|
+
userTrackingMode(other.userTrackingMode),
|
|
460
|
+
userLocationImage(other.userLocationImage),
|
|
461
|
+
userLocationSize(other.userLocationSize),
|
|
462
|
+
userLocationAnchor(other.userLocationAnchor),
|
|
283
463
|
onPress(other.onPress),
|
|
284
464
|
onLongPress(other.onLongPress),
|
|
285
465
|
onMapReady(other.onMapReady),
|
|
@@ -290,13 +470,21 @@ namespace margelo::nitro::nitromap::views {
|
|
|
290
470
|
onMarkerDrag(other.onMarkerDrag),
|
|
291
471
|
onMarkerDragEnd(other.onMarkerDragEnd),
|
|
292
472
|
onClusterPress(other.onClusterPress),
|
|
473
|
+
onPolylinePress(other.onPolylinePress),
|
|
474
|
+
onPolygonPress(other.onPolygonPress),
|
|
475
|
+
onCirclePress(other.onCirclePress),
|
|
293
476
|
onError(other.onError),
|
|
477
|
+
onUserLocationChange(other.onUserLocationChange),
|
|
478
|
+
onUserTrackingModeChange(other.onUserTrackingModeChange),
|
|
479
|
+
onUserLocationError(other.onUserLocationError),
|
|
480
|
+
onMapIdle(other.onMapIdle),
|
|
294
481
|
hybridRef(other.hybridRef) { }
|
|
295
482
|
|
|
296
483
|
bool HybridNitroMapProps::filterObjectKeys(const std::string& propName) {
|
|
297
484
|
switch (hashString(propName)) {
|
|
298
485
|
case hashString("provider"): return true;
|
|
299
486
|
case hashString("initialRegion"): return true;
|
|
487
|
+
case hashString("region"): return true;
|
|
300
488
|
case hashString("showsUserLocation"): return true;
|
|
301
489
|
case hashString("zoomEnabled"): return true;
|
|
302
490
|
case hashString("scrollEnabled"): return true;
|
|
@@ -304,9 +492,18 @@ namespace margelo::nitro::nitromap::views {
|
|
|
304
492
|
case hashString("pitchEnabled"): return true;
|
|
305
493
|
case hashString("mapType"): return true;
|
|
306
494
|
case hashString("customMapStyle"): return true;
|
|
307
|
-
case hashString("showsMyLocationButton"): return true;
|
|
308
495
|
case hashString("clusterConfig"): return true;
|
|
496
|
+
case hashString("mapPadding"): return true;
|
|
497
|
+
case hashString("showsTraffic"): return true;
|
|
498
|
+
case hashString("showsBuildings"): return true;
|
|
499
|
+
case hashString("showsCompass"): return true;
|
|
500
|
+
case hashString("minZoom"): return true;
|
|
501
|
+
case hashString("maxZoom"): return true;
|
|
309
502
|
case hashString("darkMode"): return true;
|
|
503
|
+
case hashString("userTrackingMode"): return true;
|
|
504
|
+
case hashString("userLocationImage"): return true;
|
|
505
|
+
case hashString("userLocationSize"): return true;
|
|
506
|
+
case hashString("userLocationAnchor"): return true;
|
|
310
507
|
case hashString("onPress"): return true;
|
|
311
508
|
case hashString("onLongPress"): return true;
|
|
312
509
|
case hashString("onMapReady"): return true;
|
|
@@ -317,7 +514,14 @@ namespace margelo::nitro::nitromap::views {
|
|
|
317
514
|
case hashString("onMarkerDrag"): return true;
|
|
318
515
|
case hashString("onMarkerDragEnd"): return true;
|
|
319
516
|
case hashString("onClusterPress"): return true;
|
|
517
|
+
case hashString("onPolylinePress"): return true;
|
|
518
|
+
case hashString("onPolygonPress"): return true;
|
|
519
|
+
case hashString("onCirclePress"): return true;
|
|
320
520
|
case hashString("onError"): return true;
|
|
521
|
+
case hashString("onUserLocationChange"): return true;
|
|
522
|
+
case hashString("onUserTrackingModeChange"): return true;
|
|
523
|
+
case hashString("onUserLocationError"): return true;
|
|
524
|
+
case hashString("onMapIdle"): return true;
|
|
321
525
|
case hashString("hybridRef"): return true;
|
|
322
526
|
default: return false;
|
|
323
527
|
}
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
#include "MapStyleElement.hpp"
|
|
24
24
|
#include <vector>
|
|
25
25
|
#include "ClusterConfig.hpp"
|
|
26
|
+
#include "EdgePadding.hpp"
|
|
27
|
+
#include "UserTrackingMode.hpp"
|
|
28
|
+
#include <string>
|
|
29
|
+
#include "Point.hpp"
|
|
26
30
|
#include "MapPressEvent.hpp"
|
|
27
31
|
#include <functional>
|
|
28
32
|
#include "RegionChangeEvent.hpp"
|
|
@@ -30,6 +34,7 @@
|
|
|
30
34
|
#include "MarkerDragEvent.hpp"
|
|
31
35
|
#include "ClusterPressEvent.hpp"
|
|
32
36
|
#include "MapError.hpp"
|
|
37
|
+
#include "UserLocationChangeEvent.hpp"
|
|
33
38
|
#include <memory>
|
|
34
39
|
#include "HybridNitroMapSpec.hpp"
|
|
35
40
|
|
|
@@ -56,6 +61,7 @@ namespace margelo::nitro::nitromap::views {
|
|
|
56
61
|
public:
|
|
57
62
|
CachedProp<std::optional<MapProvider>> provider;
|
|
58
63
|
CachedProp<std::optional<Region>> initialRegion;
|
|
64
|
+
CachedProp<std::optional<Region>> region;
|
|
59
65
|
CachedProp<std::optional<bool>> showsUserLocation;
|
|
60
66
|
CachedProp<std::optional<bool>> zoomEnabled;
|
|
61
67
|
CachedProp<std::optional<bool>> scrollEnabled;
|
|
@@ -63,9 +69,18 @@ namespace margelo::nitro::nitromap::views {
|
|
|
63
69
|
CachedProp<std::optional<bool>> pitchEnabled;
|
|
64
70
|
CachedProp<std::optional<MapType>> mapType;
|
|
65
71
|
CachedProp<std::optional<std::vector<MapStyleElement>>> customMapStyle;
|
|
66
|
-
CachedProp<std::optional<bool>> showsMyLocationButton;
|
|
67
72
|
CachedProp<std::optional<ClusterConfig>> clusterConfig;
|
|
73
|
+
CachedProp<EdgePadding> mapPadding;
|
|
74
|
+
CachedProp<std::optional<bool>> showsTraffic;
|
|
75
|
+
CachedProp<std::optional<bool>> showsBuildings;
|
|
76
|
+
CachedProp<std::optional<bool>> showsCompass;
|
|
77
|
+
CachedProp<double> minZoom;
|
|
78
|
+
CachedProp<double> maxZoom;
|
|
68
79
|
CachedProp<std::optional<bool>> darkMode;
|
|
80
|
+
CachedProp<std::optional<UserTrackingMode>> userTrackingMode;
|
|
81
|
+
CachedProp<std::string> userLocationImage;
|
|
82
|
+
CachedProp<double> userLocationSize;
|
|
83
|
+
CachedProp<std::optional<Point>> userLocationAnchor;
|
|
69
84
|
CachedProp<std::optional<std::function<void(const MapPressEvent& /* event */)>>> onPress;
|
|
70
85
|
CachedProp<std::optional<std::function<void(const MapPressEvent& /* event */)>>> onLongPress;
|
|
71
86
|
CachedProp<std::optional<std::function<void()>>> onMapReady;
|
|
@@ -76,7 +91,14 @@ namespace margelo::nitro::nitromap::views {
|
|
|
76
91
|
CachedProp<std::optional<std::function<void(const MarkerDragEvent& /* event */)>>> onMarkerDrag;
|
|
77
92
|
CachedProp<std::optional<std::function<void(const MarkerDragEvent& /* event */)>>> onMarkerDragEnd;
|
|
78
93
|
CachedProp<std::optional<std::function<void(const ClusterPressEvent& /* event */)>>> onClusterPress;
|
|
94
|
+
CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onPolylinePress;
|
|
95
|
+
CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onPolygonPress;
|
|
96
|
+
CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onCirclePress;
|
|
79
97
|
CachedProp<std::optional<std::function<void(const MapError& /* error */)>>> onError;
|
|
98
|
+
CachedProp<std::optional<std::function<void(const UserLocationChangeEvent& /* event */)>>> onUserLocationChange;
|
|
99
|
+
CachedProp<std::optional<std::function<void(UserTrackingMode /* mode */)>>> onUserTrackingModeChange;
|
|
100
|
+
CachedProp<std::optional<std::function<void(const MapError& /* error */)>>> onUserLocationError;
|
|
101
|
+
CachedProp<std::optional<std::function<void()>>> onMapIdle;
|
|
80
102
|
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroMapSpec>& /* ref */)>>> hybridRef;
|
|
81
103
|
|
|
82
104
|
private:
|