@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,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// chartwebview+autolinking.gradle
|
|
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 Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/chartwebview+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 chartwebview is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// chartwebviewOnLoad.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
|
+
#ifndef BUILDING_CHARTWEBVIEW_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error chartwebviewOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "chartwebviewOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridChartWebviewSpec.hpp"
|
|
19
|
+
#include "JFunc_void_std__string.hpp"
|
|
20
|
+
#include "JFunc_void.hpp"
|
|
21
|
+
#include "views/JHybridChartWebviewStateUpdater.hpp"
|
|
22
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::chartwebview {
|
|
25
|
+
|
|
26
|
+
int initialize(JavaVM* vm) {
|
|
27
|
+
using namespace margelo::nitro;
|
|
28
|
+
using namespace margelo::nitro::chartwebview;
|
|
29
|
+
using namespace facebook;
|
|
30
|
+
|
|
31
|
+
return facebook::jni::initialize(vm, [] {
|
|
32
|
+
// Register native JNI methods
|
|
33
|
+
margelo::nitro::chartwebview::JHybridChartWebviewSpec::registerNatives();
|
|
34
|
+
margelo::nitro::chartwebview::JFunc_void_std__string_cxx::registerNatives();
|
|
35
|
+
margelo::nitro::chartwebview::JFunc_void_cxx::registerNatives();
|
|
36
|
+
margelo::nitro::chartwebview::views::JHybridChartWebviewStateUpdater::registerNatives();
|
|
37
|
+
|
|
38
|
+
// Register Nitro Hybrid Objects
|
|
39
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
40
|
+
"ChartWebview",
|
|
41
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
42
|
+
static DefaultConstructableObject<JHybridChartWebviewSpec::javaobject> object("com/margelo/nitro/chartwebview/HybridChartWebview");
|
|
43
|
+
auto instance = object.create();
|
|
44
|
+
return instance->cthis()->shared();
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// chartwebviewOnLoad.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
|
+
#include <jni.h>
|
|
9
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
10
|
+
|
|
11
|
+
namespace margelo::nitro::chartwebview {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the native (C++) part of chartwebview, and autolinks all Hybrid Objects.
|
|
15
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
|
|
16
|
+
* Example:
|
|
17
|
+
* ```cpp (cpp-adapter.cpp)
|
|
18
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
+
* return margelo::nitro::chartwebview::initialize(vm);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
int initialize(JavaVM* vm);
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `() => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void: () -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `() => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_cxx: Func_void {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(): Unit
|
|
60
|
+
= invoke_cxx()
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `() => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `() -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_java(private val function: () -> Unit): Func_void {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(): Unit {
|
|
78
|
+
return this.function()
|
|
79
|
+
}
|
|
80
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_std__string: (String) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(message: String): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_std__string_cxx: Func_void_std__string {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(message: String): Unit
|
|
60
|
+
= invoke_cxx(message)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(message: String): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(String) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(message: String): Unit {
|
|
78
|
+
return this.function(message)
|
|
79
|
+
}
|
|
80
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewSpec.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.views.HybridView
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the ChartWebview HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of ChartWebview.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridChartWebviewSpec: HybridView() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Default implementation of `HybridObject.toString()`
|
|
40
|
+
override fun toString(): String {
|
|
41
|
+
return "[HybridObject ChartWebview]"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Properties
|
|
45
|
+
@get:DoNotStrip
|
|
46
|
+
@get:Keep
|
|
47
|
+
@set:DoNotStrip
|
|
48
|
+
@set:Keep
|
|
49
|
+
abstract var uri: String?
|
|
50
|
+
|
|
51
|
+
@get:DoNotStrip
|
|
52
|
+
@get:Keep
|
|
53
|
+
@set:DoNotStrip
|
|
54
|
+
@set:Keep
|
|
55
|
+
abstract var localBundle: String?
|
|
56
|
+
|
|
57
|
+
@get:DoNotStrip
|
|
58
|
+
@get:Keep
|
|
59
|
+
@set:DoNotStrip
|
|
60
|
+
@set:Keep
|
|
61
|
+
abstract var entry: String?
|
|
62
|
+
|
|
63
|
+
@get:DoNotStrip
|
|
64
|
+
@get:Keep
|
|
65
|
+
@set:DoNotStrip
|
|
66
|
+
@set:Keep
|
|
67
|
+
abstract var paramsJson: String?
|
|
68
|
+
|
|
69
|
+
@get:DoNotStrip
|
|
70
|
+
@get:Keep
|
|
71
|
+
@set:DoNotStrip
|
|
72
|
+
@set:Keep
|
|
73
|
+
abstract var bridgeScript: String?
|
|
74
|
+
|
|
75
|
+
@get:DoNotStrip
|
|
76
|
+
@get:Keep
|
|
77
|
+
@set:DoNotStrip
|
|
78
|
+
@set:Keep
|
|
79
|
+
abstract var reuseKey: String?
|
|
80
|
+
|
|
81
|
+
@get:DoNotStrip
|
|
82
|
+
@get:Keep
|
|
83
|
+
@set:DoNotStrip
|
|
84
|
+
@set:Keep
|
|
85
|
+
abstract var pooled: Boolean?
|
|
86
|
+
|
|
87
|
+
@get:DoNotStrip
|
|
88
|
+
@get:Keep
|
|
89
|
+
@set:DoNotStrip
|
|
90
|
+
@set:Keep
|
|
91
|
+
abstract var active: Boolean?
|
|
92
|
+
|
|
93
|
+
abstract var onMessage: ((message: String) -> Unit)?
|
|
94
|
+
|
|
95
|
+
private var onMessage_cxx: Func_void_std__string?
|
|
96
|
+
@Keep
|
|
97
|
+
@DoNotStrip
|
|
98
|
+
get() {
|
|
99
|
+
return onMessage?.let { Func_void_std__string_java(it) }
|
|
100
|
+
}
|
|
101
|
+
@Keep
|
|
102
|
+
@DoNotStrip
|
|
103
|
+
set(value) {
|
|
104
|
+
onMessage = value?.let { it }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
abstract var onLoadEnd: (() -> Unit)?
|
|
108
|
+
|
|
109
|
+
private var onLoadEnd_cxx: Func_void?
|
|
110
|
+
@Keep
|
|
111
|
+
@DoNotStrip
|
|
112
|
+
get() {
|
|
113
|
+
return onLoadEnd?.let { Func_void_java(it) }
|
|
114
|
+
}
|
|
115
|
+
@Keep
|
|
116
|
+
@DoNotStrip
|
|
117
|
+
set(value) {
|
|
118
|
+
onLoadEnd = value?.let { it }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
abstract var onError: ((message: String) -> Unit)?
|
|
122
|
+
|
|
123
|
+
private var onError_cxx: Func_void_std__string?
|
|
124
|
+
@Keep
|
|
125
|
+
@DoNotStrip
|
|
126
|
+
get() {
|
|
127
|
+
return onError?.let { Func_void_std__string_java(it) }
|
|
128
|
+
}
|
|
129
|
+
@Keep
|
|
130
|
+
@DoNotStrip
|
|
131
|
+
set(value) {
|
|
132
|
+
onError = value?.let { it }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Methods
|
|
136
|
+
@DoNotStrip
|
|
137
|
+
@Keep
|
|
138
|
+
abstract fun postMessage(message: String): Unit
|
|
139
|
+
|
|
140
|
+
@DoNotStrip
|
|
141
|
+
@Keep
|
|
142
|
+
abstract fun reload(): Unit
|
|
143
|
+
|
|
144
|
+
@DoNotStrip
|
|
145
|
+
@Keep
|
|
146
|
+
abstract fun clearSnapshot(): Unit
|
|
147
|
+
|
|
148
|
+
private external fun initHybrid(): HybridData
|
|
149
|
+
|
|
150
|
+
companion object {
|
|
151
|
+
protected const val TAG = "HybridChartWebviewSpec"
|
|
152
|
+
}
|
|
153
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// chartwebviewOnLoad.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class chartwebviewOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "chartwebviewOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "chartwebview".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading chartwebview C++ library...")
|
|
25
|
+
System.loadLibrary("chartwebview")
|
|
26
|
+
Log.i(TAG, "Successfully loaded chartwebview C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load chartwebview C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewManager.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.chartwebview.*
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents the React Native `ViewManager` for the "ChartWebview" Nitro HybridView.
|
|
19
|
+
*/
|
|
20
|
+
open class HybridChartWebviewManager: SimpleViewManager<View>() {
|
|
21
|
+
private val views = hashMapOf<View, HybridChartWebview>()
|
|
22
|
+
|
|
23
|
+
override fun getName(): String {
|
|
24
|
+
return "ChartWebview"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
28
|
+
val hybridView = HybridChartWebview(reactContext)
|
|
29
|
+
val view = hybridView.view
|
|
30
|
+
views[view] = hybridView
|
|
31
|
+
return view
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun onDropViewInstance(view: View) {
|
|
35
|
+
super.onDropViewInstance(view)
|
|
36
|
+
views.remove(view)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
40
|
+
val hybridView = views[view] ?: throw Error("Couldn't find view $view in local views table!")
|
|
41
|
+
|
|
42
|
+
// 1. Update each prop individually
|
|
43
|
+
hybridView.beforeUpdate()
|
|
44
|
+
HybridChartWebviewStateUpdater.updateViewProps(hybridView, stateWrapper)
|
|
45
|
+
hybridView.afterUpdate()
|
|
46
|
+
|
|
47
|
+
// 2. Continue in base View props
|
|
48
|
+
return super.updateState(view, props, stateWrapper)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewStateUpdater.kt
|
|
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
|
+
package com.margelo.nitro.chartwebview.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.chartwebview.*
|
|
12
|
+
|
|
13
|
+
internal class HybridChartWebviewStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [state] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridChartWebviewSpec, state: StateWrapper)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ChartWebview+autolinking.rb
|
|
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 Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/ChartWebview+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ChartWebview is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only C)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChartWebview-Swift-Cxx-Bridge.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 "ChartWebview-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "ChartWebview-Swift-Cxx-Umbrella.hpp"
|
|
12
|
+
#include "HybridChartWebviewSpecSwift.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::chartwebview::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const std::string& /* message */)>
|
|
18
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = ChartWebview::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const std::string& message) mutable -> void {
|
|
21
|
+
swiftClosure.call(message);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void()>
|
|
26
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = ChartWebview::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
29
|
+
swiftClosure.call();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::shared_ptr<HybridChartWebviewSpec>
|
|
34
|
+
std::shared_ptr<HybridChartWebviewSpec> create_std__shared_ptr_HybridChartWebviewSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
35
|
+
ChartWebview::HybridChartWebviewSpec_cxx swiftPart = ChartWebview::HybridChartWebviewSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
36
|
+
return std::make_shared<margelo::nitro::chartwebview::HybridChartWebviewSpecSwift>(swiftPart);
|
|
37
|
+
}
|
|
38
|
+
void* NON_NULL get_std__shared_ptr_HybridChartWebviewSpec_(std__shared_ptr_HybridChartWebviewSpec_ cppType) {
|
|
39
|
+
std::shared_ptr<margelo::nitro::chartwebview::HybridChartWebviewSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::chartwebview::HybridChartWebviewSpecSwift>(cppType);
|
|
40
|
+
#ifdef NITRO_DEBUG
|
|
41
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
42
|
+
throw std::runtime_error("Class \"HybridChartWebviewSpec\" is not implemented in Swift!");
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
ChartWebview::HybridChartWebviewSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
46
|
+
return swiftPart.toUnsafe();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::chartwebview::bridge::swift
|