react-native-nitro-ark 0.0.105 → 0.0.106
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#include <jni.h>
|
|
2
1
|
#include "NitroArkOnLoad.hpp"
|
|
2
|
+
#include <fbjni/fbjni.h>
|
|
3
|
+
#include <jni.h>
|
|
3
4
|
|
|
4
5
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
5
|
-
return margelo::nitro::nitroark::
|
|
6
|
+
return facebook::jni::initialize(vm, []() { margelo::nitro::nitroark::registerAllNatives(); });
|
|
6
7
|
}
|
|
@@ -20,25 +20,30 @@
|
|
|
20
20
|
namespace margelo::nitro::nitroark {
|
|
21
21
|
|
|
22
22
|
int initialize(JavaVM* vm) {
|
|
23
|
+
return facebook::jni::initialize(vm, []() {
|
|
24
|
+
::margelo::nitro::nitroark::registerAllNatives();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
void registerAllNatives() {
|
|
23
31
|
using namespace margelo::nitro;
|
|
24
32
|
using namespace margelo::nitro::nitroark;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
});
|
|
33
|
+
|
|
34
|
+
// Register native JNI methods
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// Register Nitro Hybrid Objects
|
|
38
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
39
|
+
"NitroArk",
|
|
40
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
41
|
+
static_assert(std::is_default_constructible_v<NitroArk>,
|
|
42
|
+
"The HybridObject \"NitroArk\" is not default-constructible! "
|
|
43
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
44
|
+
return std::make_shared<NitroArk>();
|
|
45
|
+
}
|
|
46
|
+
);
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
} // namespace margelo::nitro::nitroark
|
|
@@ -6,20 +6,29 @@
|
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
9
10
|
#include <NitroModules/NitroDefines.hpp>
|
|
10
11
|
|
|
11
12
|
namespace margelo::nitro::nitroark {
|
|
12
13
|
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`)
|
|
18
|
+
* Register the native (C++) part of NitroArk, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
16
21
|
* Example:
|
|
17
22
|
* ```cpp (cpp-adapter.cpp)
|
|
18
23
|
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
-
* return
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all NitroArk HybridObjects
|
|
26
|
+
* margelo::nitro::nitroark::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
20
29
|
* }
|
|
21
30
|
* ```
|
|
22
31
|
*/
|
|
23
|
-
|
|
32
|
+
void registerAllNatives();
|
|
24
33
|
|
|
25
34
|
} // namespace margelo::nitro::nitroark
|
|
@@ -56,5 +56,7 @@ def add_nitrogen_files(spec)
|
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
59
61
|
})
|
|
60
62
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-ark",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.106",
|
|
4
4
|
"description": "Pure C++ Nitro Modules for Ark client",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"eslint-config-prettier": "^10.1.1",
|
|
85
85
|
"eslint-plugin-prettier": "^5.2.3",
|
|
86
86
|
"jest": "^29.7.0",
|
|
87
|
-
"nitrogen": "^0.
|
|
87
|
+
"nitrogen": "^0.35.6",
|
|
88
88
|
"prettier": "^3.0.3",
|
|
89
89
|
"react": "19.2.0",
|
|
90
90
|
"react-native": "0.83.2",
|
|
91
91
|
"react-native-builder-bob": "^0.40.13",
|
|
92
|
-
"react-native-nitro-modules": "^0.
|
|
92
|
+
"react-native-nitro-modules": "^0.35.6",
|
|
93
93
|
"release-it": "^17.10.0",
|
|
94
94
|
"turbo": "^1.10.7",
|
|
95
95
|
"typescript": "^5.2.2"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"react": "*",
|
|
99
99
|
"react-native": "*",
|
|
100
|
-
"react-native-nitro-modules": "^0.
|
|
100
|
+
"react-native-nitro-modules": "^0.35.6"
|
|
101
101
|
},
|
|
102
102
|
"workspaces": [
|
|
103
103
|
"example"
|