@onekeyfe/react-native-chart-webview 3.0.39
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/ChartWebview.podspec +29 -0
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +131 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/ChartWebview.kt +331 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/ChartWebviewPackage.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/PooledChartWebView.kt +385 -0
- package/ios/ChartWebview.swift +747 -0
- package/lib/module/ChartWebview.nitro.js +4 -0
- package/lib/module/ChartWebview.nitro.js.map +1 -0
- package/lib/module/bridge.js +30 -0
- package/lib/module/bridge.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/lib/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/lib/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/lib/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/lib/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/lib/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/lib/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/lib/nitrogen/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ChartWebview.nitro.d.ts +21 -0
- package/lib/typescript/src/ChartWebview.nitro.d.ts.map +1 -0
- package/lib/typescript/src/bridge.d.ts +2 -0
- package/lib/typescript/src/bridge.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +145 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/package.json +170 -0
- package/src/ChartWebview.nitro.ts +59 -0
- package/src/bridge.ts +27 -0
- package/src/index.tsx +20 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewComponent.cpp
|
|
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
|
+
#include "HybridChartWebviewComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <exception>
|
|
12
|
+
#include <utility>
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <react/renderer/core/RawValue.h>
|
|
16
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
17
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
18
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::chartwebview::views {
|
|
21
|
+
|
|
22
|
+
extern const char HybridChartWebviewComponentName[] = "ChartWebview";
|
|
23
|
+
|
|
24
|
+
HybridChartWebviewProps::HybridChartWebviewProps(const react::PropsParserContext& context,
|
|
25
|
+
const HybridChartWebviewProps& sourceProps,
|
|
26
|
+
const react::RawProps& rawProps):
|
|
27
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
28
|
+
uri([&]() -> CachedProp<std::optional<std::string>> {
|
|
29
|
+
try {
|
|
30
|
+
const react::RawValue* rawValue = rawProps.at("uri", nullptr, nullptr);
|
|
31
|
+
if (rawValue == nullptr) return sourceProps.uri;
|
|
32
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
33
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.uri);
|
|
34
|
+
} catch (const std::exception& exc) {
|
|
35
|
+
throw std::runtime_error(std::string("ChartWebview.uri: ") + exc.what());
|
|
36
|
+
}
|
|
37
|
+
}()),
|
|
38
|
+
localBundle([&]() -> CachedProp<std::optional<std::string>> {
|
|
39
|
+
try {
|
|
40
|
+
const react::RawValue* rawValue = rawProps.at("localBundle", nullptr, nullptr);
|
|
41
|
+
if (rawValue == nullptr) return sourceProps.localBundle;
|
|
42
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
43
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.localBundle);
|
|
44
|
+
} catch (const std::exception& exc) {
|
|
45
|
+
throw std::runtime_error(std::string("ChartWebview.localBundle: ") + exc.what());
|
|
46
|
+
}
|
|
47
|
+
}()),
|
|
48
|
+
entry([&]() -> CachedProp<std::optional<std::string>> {
|
|
49
|
+
try {
|
|
50
|
+
const react::RawValue* rawValue = rawProps.at("entry", nullptr, nullptr);
|
|
51
|
+
if (rawValue == nullptr) return sourceProps.entry;
|
|
52
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
53
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.entry);
|
|
54
|
+
} catch (const std::exception& exc) {
|
|
55
|
+
throw std::runtime_error(std::string("ChartWebview.entry: ") + exc.what());
|
|
56
|
+
}
|
|
57
|
+
}()),
|
|
58
|
+
paramsJson([&]() -> CachedProp<std::optional<std::string>> {
|
|
59
|
+
try {
|
|
60
|
+
const react::RawValue* rawValue = rawProps.at("paramsJson", nullptr, nullptr);
|
|
61
|
+
if (rawValue == nullptr) return sourceProps.paramsJson;
|
|
62
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
63
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.paramsJson);
|
|
64
|
+
} catch (const std::exception& exc) {
|
|
65
|
+
throw std::runtime_error(std::string("ChartWebview.paramsJson: ") + exc.what());
|
|
66
|
+
}
|
|
67
|
+
}()),
|
|
68
|
+
bridgeScript([&]() -> CachedProp<std::optional<std::string>> {
|
|
69
|
+
try {
|
|
70
|
+
const react::RawValue* rawValue = rawProps.at("bridgeScript", nullptr, nullptr);
|
|
71
|
+
if (rawValue == nullptr) return sourceProps.bridgeScript;
|
|
72
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
73
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.bridgeScript);
|
|
74
|
+
} catch (const std::exception& exc) {
|
|
75
|
+
throw std::runtime_error(std::string("ChartWebview.bridgeScript: ") + exc.what());
|
|
76
|
+
}
|
|
77
|
+
}()),
|
|
78
|
+
reuseKey([&]() -> CachedProp<std::optional<std::string>> {
|
|
79
|
+
try {
|
|
80
|
+
const react::RawValue* rawValue = rawProps.at("reuseKey", nullptr, nullptr);
|
|
81
|
+
if (rawValue == nullptr) return sourceProps.reuseKey;
|
|
82
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
83
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.reuseKey);
|
|
84
|
+
} catch (const std::exception& exc) {
|
|
85
|
+
throw std::runtime_error(std::string("ChartWebview.reuseKey: ") + exc.what());
|
|
86
|
+
}
|
|
87
|
+
}()),
|
|
88
|
+
pooled([&]() -> CachedProp<std::optional<bool>> {
|
|
89
|
+
try {
|
|
90
|
+
const react::RawValue* rawValue = rawProps.at("pooled", nullptr, nullptr);
|
|
91
|
+
if (rawValue == nullptr) return sourceProps.pooled;
|
|
92
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
93
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.pooled);
|
|
94
|
+
} catch (const std::exception& exc) {
|
|
95
|
+
throw std::runtime_error(std::string("ChartWebview.pooled: ") + exc.what());
|
|
96
|
+
}
|
|
97
|
+
}()),
|
|
98
|
+
active([&]() -> CachedProp<std::optional<bool>> {
|
|
99
|
+
try {
|
|
100
|
+
const react::RawValue* rawValue = rawProps.at("active", nullptr, nullptr);
|
|
101
|
+
if (rawValue == nullptr) return sourceProps.active;
|
|
102
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
103
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.active);
|
|
104
|
+
} catch (const std::exception& exc) {
|
|
105
|
+
throw std::runtime_error(std::string("ChartWebview.active: ") + exc.what());
|
|
106
|
+
}
|
|
107
|
+
}()),
|
|
108
|
+
onMessage([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> {
|
|
109
|
+
try {
|
|
110
|
+
const react::RawValue* rawValue = rawProps.at("onMessage", nullptr, nullptr);
|
|
111
|
+
if (rawValue == nullptr) return sourceProps.onMessage;
|
|
112
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
113
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* message */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onMessage);
|
|
114
|
+
} catch (const std::exception& exc) {
|
|
115
|
+
throw std::runtime_error(std::string("ChartWebview.onMessage: ") + exc.what());
|
|
116
|
+
}
|
|
117
|
+
}()),
|
|
118
|
+
onLoadEnd([&]() -> CachedProp<std::optional<std::function<void()>>> {
|
|
119
|
+
try {
|
|
120
|
+
const react::RawValue* rawValue = rawProps.at("onLoadEnd", nullptr, nullptr);
|
|
121
|
+
if (rawValue == nullptr) return sourceProps.onLoadEnd;
|
|
122
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
123
|
+
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onLoadEnd);
|
|
124
|
+
} catch (const std::exception& exc) {
|
|
125
|
+
throw std::runtime_error(std::string("ChartWebview.onLoadEnd: ") + exc.what());
|
|
126
|
+
}
|
|
127
|
+
}()),
|
|
128
|
+
onError([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> {
|
|
129
|
+
try {
|
|
130
|
+
const react::RawValue* rawValue = rawProps.at("onError", nullptr, nullptr);
|
|
131
|
+
if (rawValue == nullptr) return sourceProps.onError;
|
|
132
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
133
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* message */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onError);
|
|
134
|
+
} catch (const std::exception& exc) {
|
|
135
|
+
throw std::runtime_error(std::string("ChartWebview.onError: ") + exc.what());
|
|
136
|
+
}
|
|
137
|
+
}()),
|
|
138
|
+
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridChartWebviewSpec>& /* ref */)>>> {
|
|
139
|
+
try {
|
|
140
|
+
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
141
|
+
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
142
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
143
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridChartWebviewSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
|
|
144
|
+
} catch (const std::exception& exc) {
|
|
145
|
+
throw std::runtime_error(std::string("ChartWebview.hybridRef: ") + exc.what());
|
|
146
|
+
}
|
|
147
|
+
}()) { }
|
|
148
|
+
|
|
149
|
+
HybridChartWebviewProps::HybridChartWebviewProps(const HybridChartWebviewProps& other):
|
|
150
|
+
react::ViewProps(),
|
|
151
|
+
uri(other.uri),
|
|
152
|
+
localBundle(other.localBundle),
|
|
153
|
+
entry(other.entry),
|
|
154
|
+
paramsJson(other.paramsJson),
|
|
155
|
+
bridgeScript(other.bridgeScript),
|
|
156
|
+
reuseKey(other.reuseKey),
|
|
157
|
+
pooled(other.pooled),
|
|
158
|
+
active(other.active),
|
|
159
|
+
onMessage(other.onMessage),
|
|
160
|
+
onLoadEnd(other.onLoadEnd),
|
|
161
|
+
onError(other.onError),
|
|
162
|
+
hybridRef(other.hybridRef) { }
|
|
163
|
+
|
|
164
|
+
bool HybridChartWebviewProps::filterObjectKeys(const std::string& propName) {
|
|
165
|
+
switch (hashString(propName)) {
|
|
166
|
+
case hashString("uri"): return true;
|
|
167
|
+
case hashString("localBundle"): return true;
|
|
168
|
+
case hashString("entry"): return true;
|
|
169
|
+
case hashString("paramsJson"): return true;
|
|
170
|
+
case hashString("bridgeScript"): return true;
|
|
171
|
+
case hashString("reuseKey"): return true;
|
|
172
|
+
case hashString("pooled"): return true;
|
|
173
|
+
case hashString("active"): return true;
|
|
174
|
+
case hashString("onMessage"): return true;
|
|
175
|
+
case hashString("onLoadEnd"): return true;
|
|
176
|
+
case hashString("onError"): return true;
|
|
177
|
+
case hashString("hybridRef"): return true;
|
|
178
|
+
default: return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
HybridChartWebviewComponentDescriptor::HybridChartWebviewComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
|
|
183
|
+
: ConcreteComponentDescriptor(parameters,
|
|
184
|
+
react::RawPropsParser(/* enableJsiParser */ true)) {}
|
|
185
|
+
|
|
186
|
+
std::shared_ptr<const react::Props> HybridChartWebviewComponentDescriptor::cloneProps(const react::PropsParserContext& context,
|
|
187
|
+
const std::shared_ptr<const react::Props>& props,
|
|
188
|
+
react::RawProps rawProps) const {
|
|
189
|
+
// 1. Prepare raw props parser
|
|
190
|
+
rawProps.parse(rawPropsParser_);
|
|
191
|
+
// 2. Copy props with Nitro's cached copy constructor
|
|
192
|
+
return HybridChartWebviewShadowNode::Props(context, /* & */ rawProps, props);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#ifdef ANDROID
|
|
196
|
+
void HybridChartWebviewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
197
|
+
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
198
|
+
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
199
|
+
auto& concreteShadowNode = dynamic_cast<HybridChartWebviewShadowNode&>(shadowNode);
|
|
200
|
+
const HybridChartWebviewProps& props = concreteShadowNode.getConcreteProps();
|
|
201
|
+
HybridChartWebviewState state;
|
|
202
|
+
state.setProps(props);
|
|
203
|
+
concreteShadowNode.setStateData(std::move(state));
|
|
204
|
+
}
|
|
205
|
+
#endif
|
|
206
|
+
|
|
207
|
+
} // namespace margelo::nitro::chartwebview::views
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewComponent.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
|
+
#include <optional>
|
|
11
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
12
|
+
#include <NitroModules/NitroHash.hpp>
|
|
13
|
+
#include <NitroModules/CachedProp.hpp>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include "HybridChartWebviewSpec.hpp"
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::chartwebview::views {
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The name of the actual native View.
|
|
31
|
+
*/
|
|
32
|
+
extern const char HybridChartWebviewComponentName[];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for the "ChartWebview" View.
|
|
36
|
+
*/
|
|
37
|
+
class HybridChartWebviewProps final: public react::ViewProps {
|
|
38
|
+
public:
|
|
39
|
+
HybridChartWebviewProps() = default;
|
|
40
|
+
HybridChartWebviewProps(const HybridChartWebviewProps&);
|
|
41
|
+
HybridChartWebviewProps(const react::PropsParserContext& context,
|
|
42
|
+
const HybridChartWebviewProps& sourceProps,
|
|
43
|
+
const react::RawProps& rawProps);
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
CachedProp<std::optional<std::string>> uri;
|
|
47
|
+
CachedProp<std::optional<std::string>> localBundle;
|
|
48
|
+
CachedProp<std::optional<std::string>> entry;
|
|
49
|
+
CachedProp<std::optional<std::string>> paramsJson;
|
|
50
|
+
CachedProp<std::optional<std::string>> bridgeScript;
|
|
51
|
+
CachedProp<std::optional<std::string>> reuseKey;
|
|
52
|
+
CachedProp<std::optional<bool>> pooled;
|
|
53
|
+
CachedProp<std::optional<bool>> active;
|
|
54
|
+
CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onMessage;
|
|
55
|
+
CachedProp<std::optional<std::function<void()>>> onLoadEnd;
|
|
56
|
+
CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onError;
|
|
57
|
+
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridChartWebviewSpec>& /* ref */)>>> hybridRef;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* State for the "ChartWebview" View.
|
|
65
|
+
*/
|
|
66
|
+
class HybridChartWebviewState final {
|
|
67
|
+
public:
|
|
68
|
+
HybridChartWebviewState() = default;
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
void setProps(const HybridChartWebviewProps& props) { _props.emplace(props); }
|
|
72
|
+
const std::optional<HybridChartWebviewProps>& getProps() const { return _props; }
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
#ifdef ANDROID
|
|
76
|
+
HybridChartWebviewState(const HybridChartWebviewState& /* previousState */, folly::dynamic /* data */) {}
|
|
77
|
+
folly::dynamic getDynamic() const {
|
|
78
|
+
throw std::runtime_error("HybridChartWebviewState does not support folly!");
|
|
79
|
+
}
|
|
80
|
+
react::MapBuffer getMapBuffer() const {
|
|
81
|
+
throw std::runtime_error("HybridChartWebviewState does not support MapBuffer!");
|
|
82
|
+
};
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
private:
|
|
86
|
+
std::optional<HybridChartWebviewProps> _props;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The Shadow Node for the "ChartWebview" View.
|
|
91
|
+
*/
|
|
92
|
+
using HybridChartWebviewShadowNode = react::ConcreteViewShadowNode<HybridChartWebviewComponentName /* "HybridChartWebview" */,
|
|
93
|
+
HybridChartWebviewProps /* custom props */,
|
|
94
|
+
react::ViewEventEmitter /* default */,
|
|
95
|
+
HybridChartWebviewState /* custom state */>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The Component Descriptor for the "ChartWebview" View.
|
|
99
|
+
*/
|
|
100
|
+
class HybridChartWebviewComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridChartWebviewShadowNode> {
|
|
101
|
+
public:
|
|
102
|
+
HybridChartWebviewComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
103
|
+
|
|
104
|
+
public:
|
|
105
|
+
/**
|
|
106
|
+
* A faster path for cloning props - reuses the caching logic from `HybridChartWebviewProps`.
|
|
107
|
+
*/
|
|
108
|
+
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
109
|
+
const std::shared_ptr<const react::Props>& props,
|
|
110
|
+
react::RawProps rawProps) const override;
|
|
111
|
+
#ifdef ANDROID
|
|
112
|
+
void adopt(react::ShadowNode& shadowNode) const override;
|
|
113
|
+
#endif
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/* The actual view for "ChartWebview" needs to be implemented in platform-specific code. */
|
|
117
|
+
|
|
118
|
+
} // namespace margelo::nitro::chartwebview::views
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "ChartWebview",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"uri": true,
|
|
8
|
+
"localBundle": true,
|
|
9
|
+
"entry": true,
|
|
10
|
+
"paramsJson": true,
|
|
11
|
+
"bridgeScript": true,
|
|
12
|
+
"reuseKey": true,
|
|
13
|
+
"pooled": true,
|
|
14
|
+
"active": true,
|
|
15
|
+
"onMessage": true,
|
|
16
|
+
"onLoadEnd": true,
|
|
17
|
+
"onError": true,
|
|
18
|
+
"hybridRef": true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::chartwebview {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `() -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void: public jni::JavaClass<JFunc_void> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/Func_void;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke() const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void()>("invoke");
|
|
34
|
+
method(self());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
|
|
44
|
+
return JFunc_void_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx() {
|
|
52
|
+
_func();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void()>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/Func_void_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void()> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::chartwebview {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(message: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/Func_void_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(const std::string& message) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* message */)>("invoke");
|
|
35
|
+
method(self(), jni::make_jstring(message));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* message */)>& func) {
|
|
45
|
+
return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<jni::JString> message) {
|
|
53
|
+
_func(message->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(const std::string& /* message */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/Func_void_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* message */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(const std::string& /* message */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::chartwebview
|