@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,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
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridChartWebviewSpec.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 "JHybridChartWebviewSpec.hpp"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#include <string>
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include "JFunc_void_std__string.hpp"
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include "JFunc_void.hpp"
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::chartwebview {
|
|
20
|
+
|
|
21
|
+
jni::local_ref<JHybridChartWebviewSpec::jhybriddata> JHybridChartWebviewSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
22
|
+
return makeCxxInstance(jThis);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void JHybridChartWebviewSpec::registerNatives() {
|
|
26
|
+
registerHybrid({
|
|
27
|
+
makeNativeMethod("initHybrid", JHybridChartWebviewSpec::initHybrid),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
size_t JHybridChartWebviewSpec::getExternalMemorySize() noexcept {
|
|
32
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
33
|
+
return method(_javaPart);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void JHybridChartWebviewSpec::dispose() noexcept {
|
|
37
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
38
|
+
method(_javaPart);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
std::string JHybridChartWebviewSpec::toString() {
|
|
42
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
43
|
+
auto javaString = method(_javaPart);
|
|
44
|
+
return javaString->toStdString();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Properties
|
|
48
|
+
std::optional<std::string> JHybridChartWebviewSpec::getUri() {
|
|
49
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getUri");
|
|
50
|
+
auto __result = method(_javaPart);
|
|
51
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
52
|
+
}
|
|
53
|
+
void JHybridChartWebviewSpec::setUri(const std::optional<std::string>& uri) {
|
|
54
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* uri */)>("setUri");
|
|
55
|
+
method(_javaPart, uri.has_value() ? jni::make_jstring(uri.value()) : nullptr);
|
|
56
|
+
}
|
|
57
|
+
std::optional<std::string> JHybridChartWebviewSpec::getLocalBundle() {
|
|
58
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getLocalBundle");
|
|
59
|
+
auto __result = method(_javaPart);
|
|
60
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
61
|
+
}
|
|
62
|
+
void JHybridChartWebviewSpec::setLocalBundle(const std::optional<std::string>& localBundle) {
|
|
63
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* localBundle */)>("setLocalBundle");
|
|
64
|
+
method(_javaPart, localBundle.has_value() ? jni::make_jstring(localBundle.value()) : nullptr);
|
|
65
|
+
}
|
|
66
|
+
std::optional<std::string> JHybridChartWebviewSpec::getEntry() {
|
|
67
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getEntry");
|
|
68
|
+
auto __result = method(_javaPart);
|
|
69
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
70
|
+
}
|
|
71
|
+
void JHybridChartWebviewSpec::setEntry(const std::optional<std::string>& entry) {
|
|
72
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* entry */)>("setEntry");
|
|
73
|
+
method(_javaPart, entry.has_value() ? jni::make_jstring(entry.value()) : nullptr);
|
|
74
|
+
}
|
|
75
|
+
std::optional<std::string> JHybridChartWebviewSpec::getParamsJson() {
|
|
76
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getParamsJson");
|
|
77
|
+
auto __result = method(_javaPart);
|
|
78
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
79
|
+
}
|
|
80
|
+
void JHybridChartWebviewSpec::setParamsJson(const std::optional<std::string>& paramsJson) {
|
|
81
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* paramsJson */)>("setParamsJson");
|
|
82
|
+
method(_javaPart, paramsJson.has_value() ? jni::make_jstring(paramsJson.value()) : nullptr);
|
|
83
|
+
}
|
|
84
|
+
std::optional<std::string> JHybridChartWebviewSpec::getBridgeScript() {
|
|
85
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getBridgeScript");
|
|
86
|
+
auto __result = method(_javaPart);
|
|
87
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
88
|
+
}
|
|
89
|
+
void JHybridChartWebviewSpec::setBridgeScript(const std::optional<std::string>& bridgeScript) {
|
|
90
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* bridgeScript */)>("setBridgeScript");
|
|
91
|
+
method(_javaPart, bridgeScript.has_value() ? jni::make_jstring(bridgeScript.value()) : nullptr);
|
|
92
|
+
}
|
|
93
|
+
std::optional<std::string> JHybridChartWebviewSpec::getReuseKey() {
|
|
94
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getReuseKey");
|
|
95
|
+
auto __result = method(_javaPart);
|
|
96
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
97
|
+
}
|
|
98
|
+
void JHybridChartWebviewSpec::setReuseKey(const std::optional<std::string>& reuseKey) {
|
|
99
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* reuseKey */)>("setReuseKey");
|
|
100
|
+
method(_javaPart, reuseKey.has_value() ? jni::make_jstring(reuseKey.value()) : nullptr);
|
|
101
|
+
}
|
|
102
|
+
std::optional<bool> JHybridChartWebviewSpec::getPooled() {
|
|
103
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getPooled");
|
|
104
|
+
auto __result = method(_javaPart);
|
|
105
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
106
|
+
}
|
|
107
|
+
void JHybridChartWebviewSpec::setPooled(std::optional<bool> pooled) {
|
|
108
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* pooled */)>("setPooled");
|
|
109
|
+
method(_javaPart, pooled.has_value() ? jni::JBoolean::valueOf(pooled.value()) : nullptr);
|
|
110
|
+
}
|
|
111
|
+
std::optional<bool> JHybridChartWebviewSpec::getActive() {
|
|
112
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getActive");
|
|
113
|
+
auto __result = method(_javaPart);
|
|
114
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
115
|
+
}
|
|
116
|
+
void JHybridChartWebviewSpec::setActive(std::optional<bool> active) {
|
|
117
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* active */)>("setActive");
|
|
118
|
+
method(_javaPart, active.has_value() ? jni::JBoolean::valueOf(active.value()) : nullptr);
|
|
119
|
+
}
|
|
120
|
+
std::optional<std::function<void(const std::string& /* message */)>> JHybridChartWebviewSpec::getOnMessage() {
|
|
121
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnMessage_cxx");
|
|
122
|
+
auto __result = method(_javaPart);
|
|
123
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* message */)> {
|
|
124
|
+
if (__result->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
|
|
125
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(__result);
|
|
126
|
+
return downcast->cthis()->getFunction();
|
|
127
|
+
} else {
|
|
128
|
+
auto __resultRef = jni::make_global(__result);
|
|
129
|
+
return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(__resultRef));
|
|
130
|
+
}
|
|
131
|
+
}()) : std::nullopt;
|
|
132
|
+
}
|
|
133
|
+
void JHybridChartWebviewSpec::setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) {
|
|
134
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onMessage */)>("setOnMessage_cxx");
|
|
135
|
+
method(_javaPart, onMessage.has_value() ? JFunc_void_std__string_cxx::fromCpp(onMessage.value()) : nullptr);
|
|
136
|
+
}
|
|
137
|
+
std::optional<std::function<void()>> JHybridChartWebviewSpec::getOnLoadEnd() {
|
|
138
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnLoadEnd_cxx");
|
|
139
|
+
auto __result = method(_javaPart);
|
|
140
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
141
|
+
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
142
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
143
|
+
return downcast->cthis()->getFunction();
|
|
144
|
+
} else {
|
|
145
|
+
auto __resultRef = jni::make_global(__result);
|
|
146
|
+
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
|
|
147
|
+
}
|
|
148
|
+
}()) : std::nullopt;
|
|
149
|
+
}
|
|
150
|
+
void JHybridChartWebviewSpec::setOnLoadEnd(const std::optional<std::function<void()>>& onLoadEnd) {
|
|
151
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onLoadEnd */)>("setOnLoadEnd_cxx");
|
|
152
|
+
method(_javaPart, onLoadEnd.has_value() ? JFunc_void_cxx::fromCpp(onLoadEnd.value()) : nullptr);
|
|
153
|
+
}
|
|
154
|
+
std::optional<std::function<void(const std::string& /* message */)>> JHybridChartWebviewSpec::getOnError() {
|
|
155
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnError_cxx");
|
|
156
|
+
auto __result = method(_javaPart);
|
|
157
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* message */)> {
|
|
158
|
+
if (__result->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
|
|
159
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(__result);
|
|
160
|
+
return downcast->cthis()->getFunction();
|
|
161
|
+
} else {
|
|
162
|
+
auto __resultRef = jni::make_global(__result);
|
|
163
|
+
return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(__resultRef));
|
|
164
|
+
}
|
|
165
|
+
}()) : std::nullopt;
|
|
166
|
+
}
|
|
167
|
+
void JHybridChartWebviewSpec::setOnError(const std::optional<std::function<void(const std::string& /* message */)>>& onError) {
|
|
168
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onError */)>("setOnError_cxx");
|
|
169
|
+
method(_javaPart, onError.has_value() ? JFunc_void_std__string_cxx::fromCpp(onError.value()) : nullptr);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Methods
|
|
173
|
+
void JHybridChartWebviewSpec::postMessage(const std::string& message) {
|
|
174
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* message */)>("postMessage");
|
|
175
|
+
method(_javaPart, jni::make_jstring(message));
|
|
176
|
+
}
|
|
177
|
+
void JHybridChartWebviewSpec::reload() {
|
|
178
|
+
static const auto method = javaClassStatic()->getMethod<void()>("reload");
|
|
179
|
+
method(_javaPart);
|
|
180
|
+
}
|
|
181
|
+
void JHybridChartWebviewSpec::clearSnapshot() {
|
|
182
|
+
static const auto method = javaClassStatic()->getMethod<void()>("clearSnapshot");
|
|
183
|
+
method(_javaPart);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridChartWebviewSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::chartwebview {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridChartWebviewSpec: public jni::HybridClass<JHybridChartWebviewSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridChartWebviewSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/HybridChartWebviewSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridChartWebviewSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridChartWebviewSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridChartWebviewSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
std::string toString() override;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridChartWebviewSpec::javaobject>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
std::optional<std::string> getUri() override;
|
|
54
|
+
void setUri(const std::optional<std::string>& uri) override;
|
|
55
|
+
std::optional<std::string> getLocalBundle() override;
|
|
56
|
+
void setLocalBundle(const std::optional<std::string>& localBundle) override;
|
|
57
|
+
std::optional<std::string> getEntry() override;
|
|
58
|
+
void setEntry(const std::optional<std::string>& entry) override;
|
|
59
|
+
std::optional<std::string> getParamsJson() override;
|
|
60
|
+
void setParamsJson(const std::optional<std::string>& paramsJson) override;
|
|
61
|
+
std::optional<std::string> getBridgeScript() override;
|
|
62
|
+
void setBridgeScript(const std::optional<std::string>& bridgeScript) override;
|
|
63
|
+
std::optional<std::string> getReuseKey() override;
|
|
64
|
+
void setReuseKey(const std::optional<std::string>& reuseKey) override;
|
|
65
|
+
std::optional<bool> getPooled() override;
|
|
66
|
+
void setPooled(std::optional<bool> pooled) override;
|
|
67
|
+
std::optional<bool> getActive() override;
|
|
68
|
+
void setActive(std::optional<bool> active) override;
|
|
69
|
+
std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() override;
|
|
70
|
+
void setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) override;
|
|
71
|
+
std::optional<std::function<void()>> getOnLoadEnd() override;
|
|
72
|
+
void setOnLoadEnd(const std::optional<std::function<void()>>& onLoadEnd) override;
|
|
73
|
+
std::optional<std::function<void(const std::string& /* message */)>> getOnError() override;
|
|
74
|
+
void setOnError(const std::optional<std::function<void(const std::string& /* message */)>>& onError) override;
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
// Methods
|
|
78
|
+
void postMessage(const std::string& message) override;
|
|
79
|
+
void reload() override;
|
|
80
|
+
void clearSnapshot() override;
|
|
81
|
+
|
|
82
|
+
private:
|
|
83
|
+
friend HybridBase;
|
|
84
|
+
using HybridBase::HybridBase;
|
|
85
|
+
jni::global_ref<JHybridChartWebviewSpec::javaobject> _javaPart;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridChartWebviewStateUpdater.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 "JHybridChartWebviewStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridChartWebviewComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::chartwebview::views {
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
using ConcreteStateData = react::ConcreteState<HybridChartWebviewState>;
|
|
16
|
+
|
|
17
|
+
void JHybridChartWebviewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
18
|
+
jni::alias_ref<JHybridChartWebviewSpec::javaobject> javaView,
|
|
19
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface) {
|
|
20
|
+
JHybridChartWebviewSpec* view = javaView->cthis();
|
|
21
|
+
|
|
22
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
23
|
+
jobject rawStateWrapper = stateWrapperInterface.get();
|
|
24
|
+
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) {
|
|
25
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
26
|
+
}
|
|
27
|
+
auto stateWrapper = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
28
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
|
|
29
|
+
|
|
30
|
+
std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
|
|
31
|
+
auto concreteState = std::dynamic_pointer_cast<const ConcreteStateData>(state);
|
|
32
|
+
const HybridChartWebviewState& data = concreteState->getData();
|
|
33
|
+
const std::optional<HybridChartWebviewProps>& maybeProps = data.getProps();
|
|
34
|
+
if (!maybeProps.has_value()) {
|
|
35
|
+
// Props aren't set yet!
|
|
36
|
+
throw std::runtime_error("HybridChartWebviewState's data doesn't contain any props!");
|
|
37
|
+
}
|
|
38
|
+
const HybridChartWebviewProps& props = maybeProps.value();
|
|
39
|
+
if (props.uri.isDirty) {
|
|
40
|
+
view->setUri(props.uri.value);
|
|
41
|
+
// TODO: Set isDirty = false
|
|
42
|
+
}
|
|
43
|
+
if (props.localBundle.isDirty) {
|
|
44
|
+
view->setLocalBundle(props.localBundle.value);
|
|
45
|
+
// TODO: Set isDirty = false
|
|
46
|
+
}
|
|
47
|
+
if (props.entry.isDirty) {
|
|
48
|
+
view->setEntry(props.entry.value);
|
|
49
|
+
// TODO: Set isDirty = false
|
|
50
|
+
}
|
|
51
|
+
if (props.paramsJson.isDirty) {
|
|
52
|
+
view->setParamsJson(props.paramsJson.value);
|
|
53
|
+
// TODO: Set isDirty = false
|
|
54
|
+
}
|
|
55
|
+
if (props.bridgeScript.isDirty) {
|
|
56
|
+
view->setBridgeScript(props.bridgeScript.value);
|
|
57
|
+
// TODO: Set isDirty = false
|
|
58
|
+
}
|
|
59
|
+
if (props.reuseKey.isDirty) {
|
|
60
|
+
view->setReuseKey(props.reuseKey.value);
|
|
61
|
+
// TODO: Set isDirty = false
|
|
62
|
+
}
|
|
63
|
+
if (props.pooled.isDirty) {
|
|
64
|
+
view->setPooled(props.pooled.value);
|
|
65
|
+
// TODO: Set isDirty = false
|
|
66
|
+
}
|
|
67
|
+
if (props.active.isDirty) {
|
|
68
|
+
view->setActive(props.active.value);
|
|
69
|
+
// TODO: Set isDirty = false
|
|
70
|
+
}
|
|
71
|
+
if (props.onMessage.isDirty) {
|
|
72
|
+
view->setOnMessage(props.onMessage.value);
|
|
73
|
+
// TODO: Set isDirty = false
|
|
74
|
+
}
|
|
75
|
+
if (props.onLoadEnd.isDirty) {
|
|
76
|
+
view->setOnLoadEnd(props.onLoadEnd.value);
|
|
77
|
+
// TODO: Set isDirty = false
|
|
78
|
+
}
|
|
79
|
+
if (props.onError.isDirty) {
|
|
80
|
+
view->setOnError(props.onError.value);
|
|
81
|
+
// TODO: Set isDirty = false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Update hybridRef if it changed
|
|
85
|
+
if (props.hybridRef.isDirty) {
|
|
86
|
+
// hybridRef changed - call it with new this
|
|
87
|
+
const auto& maybeFunc = props.hybridRef.value;
|
|
88
|
+
if (maybeFunc.has_value()) {
|
|
89
|
+
std::shared_ptr<JHybridChartWebviewSpec> shared = javaView->cthis()->shared_cast<JHybridChartWebviewSpec>();
|
|
90
|
+
maybeFunc.value()(shared);
|
|
91
|
+
}
|
|
92
|
+
// TODO: Set isDirty = false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
} // namespace margelo::nitro::chartwebview::views
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridChartWebviewStateUpdater.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
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error chartwebview was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
16
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridChartWebviewSpec.hpp"
|
|
21
|
+
#include "views/HybridChartWebviewComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::chartwebview::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridChartWebviewStateUpdater: public jni::JavaClass<JHybridChartWebviewStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridChartWebviewSpec::javaobject> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface);
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
static void registerNatives() {
|
|
38
|
+
// Register JNI calls
|
|
39
|
+
javaClassStatic()->registerNatives({
|
|
40
|
+
makeNativeMethod("updateViewProps", JHybridChartWebviewStateUpdater::updateViewProps),
|
|
41
|
+
});
|
|
42
|
+
// Register React Native view component descriptor
|
|
43
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridChartWebviewComponentDescriptor>();
|
|
44
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
45
|
+
providerRegistry->add(provider);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::chartwebview::views
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# chartwebview+autolinking.cmake
|
|
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
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/chartwebview+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_CHARTWEBVIEW_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
chartwebview PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/chartwebviewOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp
|
|
38
|
+
# Android-specific Nitrogen C++ sources
|
|
39
|
+
../nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp
|
|
40
|
+
../nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
44
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
45
|
+
target_compile_definitions(
|
|
46
|
+
chartwebview PRIVATE
|
|
47
|
+
-DFOLLY_NO_CONFIG=1
|
|
48
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
49
|
+
-DFOLLY_USE_LIBCPP=1
|
|
50
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
51
|
+
-DFOLLY_MOBILE=1
|
|
52
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
53
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
54
|
+
# Once we target android-23 above, we can comment
|
|
55
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
56
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add all libraries required by the generated specs
|
|
60
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
61
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
62
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
63
|
+
|
|
64
|
+
# Link all libraries together
|
|
65
|
+
target_link_libraries(
|
|
66
|
+
chartwebview
|
|
67
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
68
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
69
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
73
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
chartwebview
|
|
76
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
77
|
+
)
|
|
78
|
+
else()
|
|
79
|
+
target_link_libraries(
|
|
80
|
+
chartwebview
|
|
81
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
82
|
+
)
|
|
83
|
+
endif()
|