@secondts/bark-react-native 0.1.0-beta.6

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.
Files changed (117) hide show
  1. package/BarkReactNative.podspec +44 -0
  2. package/README.md +46 -0
  3. package/android/CMakeLists.txt +76 -0
  4. package/android/build.gradle +144 -0
  5. package/android/cpp-adapter.cpp +42 -0
  6. package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeBarkReactNativeSpec.java +41 -0
  7. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/RNBarkReactNativeSpec-generated.cpp +38 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/RNBarkReactNativeSpec.h +31 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/ComponentDescriptors.h +24 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/EventEmitters.cpp +16 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/EventEmitters.h +17 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/Props.cpp +19 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/Props.h +18 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/RNBarkReactNativeSpecJSI-generated.cpp +32 -0
  17. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/RNBarkReactNativeSpecJSI.h +76 -0
  18. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/ShadowNodes.cpp +17 -0
  19. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/ShadowNodes.h +23 -0
  20. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/States.cpp +16 -0
  21. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBarkReactNativeSpec/States.h +19 -0
  22. package/android/src/main/AndroidManifest.xml +5 -0
  23. package/android/src/main/java/com/barkreactnative/BarkReactNativeModule.kt +43 -0
  24. package/android/src/main/java/com/barkreactnative/BarkReactNativePackage.kt +34 -0
  25. package/app.plugin.js +1 -0
  26. package/cpp/bark-react-native.cpp +16 -0
  27. package/cpp/bark-react-native.h +15 -0
  28. package/cpp/generated/bark.cpp +6665 -0
  29. package/cpp/generated/bark.hpp +212 -0
  30. package/cpp/secondts-bark-react-native.cpp +16 -0
  31. package/cpp/secondts-bark-react-native.h +15 -0
  32. package/ios/BarkReactNative.h +16 -0
  33. package/ios/BarkReactNative.mm +66 -0
  34. package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2321 -0
  35. package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +2761 -0
  36. package/ios/generated/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +2923 -0
  37. package/ios/generated/build/generated/ios/FBReactNativeSpecJSI.h +7718 -0
  38. package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.h +18 -0
  39. package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm +33 -0
  40. package/ios/generated/build/generated/ios/RNBarkReactNativeSpec/RNBarkReactNativeSpec-generated.mm +46 -0
  41. package/ios/generated/build/generated/ios/RNBarkReactNativeSpec/RNBarkReactNativeSpec.h +60 -0
  42. package/ios/generated/build/generated/ios/RNBarkReactNativeSpecJSI-generated.cpp +32 -0
  43. package/ios/generated/build/generated/ios/RNBarkReactNativeSpecJSI.h +76 -0
  44. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  45. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/ComponentDescriptors.h +24 -0
  46. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/EventEmitters.cpp +16 -0
  47. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/EventEmitters.h +17 -0
  48. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/Props.cpp +19 -0
  49. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/Props.h +18 -0
  50. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/RCTComponentViewHelpers.h +18 -0
  51. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/ShadowNodes.cpp +17 -0
  52. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/ShadowNodes.h +23 -0
  53. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/States.cpp +16 -0
  54. package/ios/generated/build/generated/ios/react/renderer/components/RNBarkReactNativeSpec/States.h +19 -0
  55. package/lib/commonjs/NativeBarkReactNative.js +10 -0
  56. package/lib/commonjs/NativeBarkReactNative.js.map +1 -0
  57. package/lib/commonjs/generated/bark-ffi.js +44 -0
  58. package/lib/commonjs/generated/bark-ffi.js.map +1 -0
  59. package/lib/commonjs/generated/bark.js +3175 -0
  60. package/lib/commonjs/generated/bark.js.map +1 -0
  61. package/lib/commonjs/index.js +63 -0
  62. package/lib/commonjs/index.js.map +1 -0
  63. package/lib/commonjs/package.json +1 -0
  64. package/lib/module/NativeBarkReactNative.js +7 -0
  65. package/lib/module/NativeBarkReactNative.js.map +1 -0
  66. package/lib/module/generated/bark-ffi.js +43 -0
  67. package/lib/module/generated/bark-ffi.js.map +1 -0
  68. package/lib/module/generated/bark.js +3164 -0
  69. package/lib/module/generated/bark.js.map +1 -0
  70. package/lib/module/index.js +43 -0
  71. package/lib/module/index.js.map +1 -0
  72. package/lib/module/package.json +1 -0
  73. package/lib/typescript/commonjs/package.json +1 -0
  74. package/lib/typescript/commonjs/plugin/src/index.d.ts +11 -0
  75. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
  76. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +6 -0
  77. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +7 -0
  79. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/src/NativeBarkReactNative.d.ts +8 -0
  81. package/lib/typescript/commonjs/src/NativeBarkReactNative.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +264 -0
  83. package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/src/generated/bark.d.ts +2963 -0
  85. package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/index.d.ts +8 -0
  87. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  88. package/lib/typescript/module/package.json +1 -0
  89. package/lib/typescript/module/plugin/src/index.d.ts +11 -0
  90. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
  91. package/lib/typescript/module/plugin/src/withAndroid.d.ts +6 -0
  92. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
  93. package/lib/typescript/module/plugin/src/withIOS.d.ts +7 -0
  94. package/lib/typescript/module/plugin/src/withIOS.d.ts.map +1 -0
  95. package/lib/typescript/module/src/NativeBarkReactNative.d.ts +8 -0
  96. package/lib/typescript/module/src/NativeBarkReactNative.d.ts.map +1 -0
  97. package/lib/typescript/module/src/generated/bark-ffi.d.ts +264 -0
  98. package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -0
  99. package/lib/typescript/module/src/generated/bark.d.ts +2963 -0
  100. package/lib/typescript/module/src/generated/bark.d.ts.map +1 -0
  101. package/lib/typescript/module/src/index.d.ts +8 -0
  102. package/lib/typescript/module/src/index.d.ts.map +1 -0
  103. package/package.json +154 -0
  104. package/plugin/build/index.d.ts +10 -0
  105. package/plugin/build/index.js +16 -0
  106. package/plugin/build/withAndroid.d.ts +5 -0
  107. package/plugin/build/withAndroid.js +26 -0
  108. package/plugin/build/withIOS.d.ts +6 -0
  109. package/plugin/build/withIOS.js +13 -0
  110. package/plugin/tsconfig.json +9 -0
  111. package/plugin/tsconfig.tsbuildinfo +1 -0
  112. package/react-native.config.js +12 -0
  113. package/scripts/postinstall.js +233 -0
  114. package/src/NativeBarkReactNative.ts +10 -0
  115. package/src/generated/bark-ffi.ts +694 -0
  116. package/src/generated/bark.ts +6068 -0
  117. package/src/index.tsx +41 -0
@@ -0,0 +1,44 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ require "json"
3
+
4
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
6
+
7
+ Pod::Spec.new do |s|
8
+ s.name = "BarkReactNative"
9
+ s.version = package["version"]
10
+ s.summary = package["description"]
11
+ s.homepage = package["homepage"]
12
+ s.license = package["license"]
13
+ s.authors = package["author"]
14
+
15
+ s.platforms = { :ios => min_ios_version_supported }
16
+ s.source = { :git => "https://gitlab.com/ark-bitcoin/bark-ffi-bindings.git", :tag => "#{s.version}" }
17
+
18
+ s.source_files = "ios/*.{h,m,mm,swift}", "ios/generated/**/*.{h}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
19
+ s.vendored_frameworks = "build/RnBark.xcframework"
20
+ s.dependency "uniffi-bindgen-react-native", "0.29.3-1"
21
+
22
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
24
+ if respond_to?(:install_modules_dependencies, true)
25
+ install_modules_dependencies(s)
26
+ else
27
+ s.dependency "React-Core"
28
+
29
+ # Don't install the dependencies when we run `pod install` in the old architecture.
30
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
31
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
32
+ s.pod_target_xcconfig = {
33
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
34
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
35
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
36
+ }
37
+ s.dependency "React-Codegen"
38
+ s.dependency "RCT-Folly"
39
+ s.dependency "RCTRequired"
40
+ s.dependency "RCTTypeSafety"
41
+ s.dependency "ReactCommon/turbomodule/core"
42
+ end
43
+ end
44
+ end
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ ![bark: Ark on bitcoin](https://gitlab.com/ark-bitcoin/bark-ffi-bindings/-/raw/master/react-native/assets/bark-react-native-header-white.jpg)
2
+
3
+ <div align="center">
4
+ <h1>bark-react-native</h1>
5
+ <p>React Native bindings for Bark</p>
6
+ </div>
7
+
8
+ <br />
9
+
10
+ Bark is an implementation of the Ark protocol on bitcoin, led by [Second](https://second.tech). The Ark protocol is a bitcoin layer 2 for making fast, low-cost, self-custodial payments at scale. Ark uses a client-server model to enable users to transact off-chain while still being able to "exit" their balances on-chain at any time.
11
+
12
+ ## Installation
13
+
14
+ ### Expo
15
+
16
+ 1. Install the package:
17
+
18
+ ```bash
19
+ npx expo install @secondts/bark-react-native
20
+ ```
21
+
22
+ 2. Add the plugin to `app.json` or `app.config.js`:
23
+
24
+ ```json
25
+ {
26
+ "expo": {
27
+ "plugins": ["@secondts/bark-react-native"]
28
+ }
29
+ }
30
+ ```
31
+
32
+ 3. Run prebuild
33
+
34
+ ```bash
35
+ npx expo prebuild
36
+ ```
37
+
38
+ Note: `bark-react-native` contains native code and requires a development build. It will not work with Expo Go.
39
+
40
+ ### Bare React Native
41
+
42
+ 1. Install the package
43
+
44
+ ```bash
45
+ npx expo install @secondts/bark-react-native
46
+ ```
@@ -0,0 +1,76 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+ project(BarkReactNative)
4
+
5
+ set (CMAKE_VERBOSE_MAKEFILE ON)
6
+ set (CMAKE_CXX_STANDARD 17)
7
+
8
+ # Resolve the path to the uniffi-bindgen-react-native package
9
+ execute_process(
10
+ COMMAND node -p "require.resolve('uniffi-bindgen-react-native/package.json')"
11
+ OUTPUT_VARIABLE UNIFFI_BINDGEN_PATH
12
+ OUTPUT_STRIP_TRAILING_WHITESPACE
13
+ )
14
+ # Get the directory; get_filename_component and cmake_path will normalize
15
+ # paths with Windows path separators.
16
+ get_filename_component(UNIFFI_BINDGEN_PATH "${UNIFFI_BINDGEN_PATH}" DIRECTORY)
17
+
18
+ # Specifies a path to native header files.
19
+ include_directories(
20
+ ../cpp
21
+ ../cpp/generated
22
+
23
+ ${UNIFFI_BINDGEN_PATH}/cpp/includes
24
+ )
25
+
26
+ add_library(secondts-bark-react-native SHARED
27
+ ../cpp/secondts-bark-react-native.cpp
28
+ ../cpp/generated/bark.cpp
29
+ cpp-adapter.cpp
30
+ )
31
+
32
+ # Set C++ compiler flags
33
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
34
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
35
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti")
36
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
37
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
38
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
39
+
40
+ cmake_path(
41
+ SET MY_RUST_LIB
42
+ ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libbark_ffi_react_native.so
43
+ NORMALIZE
44
+ )
45
+ add_library(my_rust_lib SHARED IMPORTED)
46
+ set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB} IMPORTED_NO_SONAME ON)
47
+
48
+ # Add ReactAndroid libraries, being careful to account for different versions.
49
+ find_package(ReactAndroid REQUIRED CONFIG)
50
+ find_library(LOGCAT log)
51
+
52
+ # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
53
+ # which we don't use. Thus falling back to version number sniffing.
54
+ if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
55
+ set(REACTNATIVE_MERGED_SO true)
56
+ endif()
57
+
58
+ # https://github.com/react-native-community/discussions-and-proposals/discussions/816
59
+ # This if-then-else can be removed once this library does not support version below 0.76
60
+ if (REACTNATIVE_MERGED_SO)
61
+ target_link_libraries(secondts-bark-react-native ReactAndroid::reactnative)
62
+ else()
63
+ target_link_libraries(secondts-bark-react-native
64
+ ReactAndroid::turbomodulejsijni
65
+ ReactAndroid::react_nativemodule_core
66
+ )
67
+ endif()
68
+
69
+ find_package(fbjni REQUIRED CONFIG)
70
+ target_link_libraries(
71
+ secondts-bark-react-native
72
+ fbjni::fbjni
73
+ ReactAndroid::jsi
74
+ ${LOGCAT}
75
+ my_rust_lib
76
+ )
@@ -0,0 +1,144 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+
3
+ buildscript {
4
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
5
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["DummyLibForAndroid_kotlinVersion"]
6
+
7
+ repositories {
8
+ google()
9
+ mavenCentral()
10
+ }
11
+
12
+ dependencies {
13
+ classpath "com.android.tools.build:gradle:7.2.1"
14
+ // noinspection DifferentKotlinGradleVersion
15
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16
+ }
17
+ }
18
+
19
+ def reactNativeArchitectures() {
20
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
21
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
22
+ }
23
+
24
+ def isNewArchitectureEnabled() {
25
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
26
+ }
27
+
28
+ apply plugin: "com.android.library"
29
+ apply plugin: "kotlin-android"
30
+
31
+ if (isNewArchitectureEnabled()) {
32
+ apply plugin: "com.facebook.react"
33
+ }
34
+
35
+ def getExtOrDefault(name) {
36
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["BarkReactNative_" + name]
37
+ }
38
+
39
+ def getExtOrIntegerDefault(name) {
40
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["BarkReactNative_" + name]).toInteger()
41
+ }
42
+
43
+ def supportsNamespace() {
44
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
45
+ def major = parsed[0].toInteger()
46
+ def minor = parsed[1].toInteger()
47
+
48
+ // Namespace support was added in 7.3.0
49
+ return (major == 7 && minor >= 3) || major >= 8
50
+ }
51
+
52
+ android {
53
+ if (supportsNamespace()) {
54
+ namespace "com.barkreactnative"
55
+
56
+ sourceSets {
57
+ main {
58
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
59
+ }
60
+ }
61
+ }
62
+
63
+ ndkVersion getExtOrDefault("ndkVersion")
64
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
65
+
66
+ defaultConfig {
67
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
68
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
69
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
70
+ consumerProguardFiles 'proguard-rules.pro'
71
+
72
+ buildFeatures {
73
+ prefab true
74
+ }
75
+ externalNativeBuild {
76
+ cmake {
77
+ arguments '-DANDROID_STL=c++_shared'
78
+ abiFilters (*reactNativeArchitectures())
79
+ }
80
+ }
81
+ ndk {
82
+ abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
83
+ }
84
+ }
85
+
86
+ externalNativeBuild {
87
+ cmake {
88
+ path "CMakeLists.txt"
89
+ }
90
+ }
91
+
92
+ buildFeatures {
93
+ buildConfig true
94
+ }
95
+
96
+ buildTypes {
97
+ release {
98
+ minifyEnabled false
99
+ }
100
+ }
101
+
102
+ lintOptions {
103
+ disable "GradleCompatible"
104
+ }
105
+
106
+ compileOptions {
107
+ sourceCompatibility JavaVersion.VERSION_1_8
108
+ targetCompatibility JavaVersion.VERSION_1_8
109
+ }
110
+
111
+ sourceSets {
112
+ main {
113
+ if (isNewArchitectureEnabled()) {
114
+ java.srcDirs += [
115
+ "generated/java",
116
+ "generated/jni"
117
+ ]
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ repositories {
124
+ mavenCentral()
125
+ google()
126
+ }
127
+
128
+ def kotlin_version = getExtOrDefault("kotlinVersion")
129
+
130
+ dependencies {
131
+ // For < 0.71, this will be from the local maven repo
132
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
133
+ //noinspection GradleDynamicVersion
134
+ implementation "com.facebook.react:react-native:+"
135
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
136
+ }
137
+
138
+ if (isNewArchitectureEnabled()) {
139
+ react {
140
+ jsRootDir = file("../src/")
141
+ libraryName = "BarkReactNative"
142
+ codegenJavaPackageName = "com.barkreactnative"
143
+ }
144
+ }
@@ -0,0 +1,42 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ #include <jni.h>
3
+ #include <jsi/jsi.h>
4
+ #include <fbjni/fbjni.h>
5
+ #include <ReactCommon/CallInvokerHolder.h>
6
+ #include "secondts-bark-react-native.h"
7
+
8
+ namespace jsi = facebook::jsi;
9
+ namespace react = facebook::react;
10
+
11
+ // Automated testing checks Java_com_barkreactnative_BarkReactNativeModule and secondts_barkreactnative
12
+ // by comparing the whole line here.
13
+ /*
14
+ Java_com_barkreactnative_BarkReactNativeModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
15
+ return secondts_barkreactnative::multiply(a, b);
16
+ }
17
+ */
18
+
19
+ // Installer coming from BarkReactNativeModule
20
+ extern "C"
21
+ JNIEXPORT jboolean JNICALL
22
+ Java_com_barkreactnative_BarkReactNativeModule_nativeInstallRustCrate(
23
+ JNIEnv *env,
24
+ jclass type,
25
+ jlong rtPtr,
26
+ jobject callInvokerHolderJavaObj
27
+ ) {
28
+ using JCallInvokerHolder = facebook::react::CallInvokerHolder;
29
+ auto holderLocal = facebook::jni::make_local(callInvokerHolderJavaObj);
30
+ auto holderRef = facebook::jni::static_ref_cast<JCallInvokerHolder::javaobject>(holderLocal);
31
+ auto jsCallInvoker = holderRef->cthis()->getCallInvoker();
32
+
33
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
34
+ return secondts_barkreactnative::installRustCrate(*runtime, jsCallInvoker);
35
+ }
36
+
37
+ extern "C"
38
+ JNIEXPORT jboolean JNICALL
39
+ Java_com_barkreactnative_BarkReactNativeModule_nativeCleanupRustCrate(JNIEnv *env, jclass type, jlong rtPtr) {
40
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
41
+ return secondts_barkreactnative::cleanupRustCrate(*runtime);
42
+ }
@@ -0,0 +1,41 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.facebook.fbreact.specs;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.ReactApplicationContext;
17
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
+ import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
+ import javax.annotation.Nonnull;
21
+
22
+ public abstract class NativeBarkReactNativeSpec extends ReactContextBaseJavaModule implements TurboModule {
23
+ public static final String NAME = "BarkReactNative";
24
+
25
+ public NativeBarkReactNativeSpec(ReactApplicationContext reactContext) {
26
+ super(reactContext);
27
+ }
28
+
29
+ @Override
30
+ public @Nonnull String getName() {
31
+ return NAME;
32
+ }
33
+
34
+ @ReactMethod(isBlockingSynchronousMethod = true)
35
+ @DoNotStrip
36
+ public abstract boolean installRustCrate();
37
+
38
+ @ReactMethod(isBlockingSynchronousMethod = true)
39
+ @DoNotStrip
40
+ public abstract boolean cleanupRustCrate();
41
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNBarkReactNativeSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNBarkReactNativeSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNBarkReactNativeSpec PUBLIC . react/renderer/components/RNBarkReactNativeSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNBarkReactNativeSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNBarkReactNativeSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,38 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNBarkReactNativeSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeBarkReactNativeSpecJSI_installRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "installRustCrate", "()Z", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeBarkReactNativeSpecJSI_cleanupRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "cleanupRustCrate", "()Z", args, count, cachedMethodId);
23
+ }
24
+
25
+ NativeBarkReactNativeSpecJSI::NativeBarkReactNativeSpecJSI(const JavaTurboModule::InitParams &params)
26
+ : JavaTurboModule(params) {
27
+ methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeBarkReactNativeSpecJSI_installRustCrate};
28
+ methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeBarkReactNativeSpecJSI_cleanupRustCrate};
29
+ }
30
+
31
+ std::shared_ptr<TurboModule> RNBarkReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
32
+ if (moduleName == "BarkReactNative") {
33
+ return std::make_shared<NativeBarkReactNativeSpecJSI>(params);
34
+ }
35
+ return nullptr;
36
+ }
37
+
38
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeBarkReactNative'
21
+ */
22
+ class JSI_EXPORT NativeBarkReactNativeSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeBarkReactNativeSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNBarkReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNBarkReactNativeSpec/ComponentDescriptors.h>
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void RNBarkReactNativeSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/RNBarkReactNativeSpec/ShadowNodes.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void RNBarkReactNativeSpec_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNBarkReactNativeSpec/EventEmitters.h>
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNBarkReactNativeSpec/Props.h>
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNBarkReactNativeSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeBarkReactNativeCxxSpecJSI_installRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeBarkReactNativeCxxSpecJSI *>(&turboModule)->installRustCrate(
16
+ rt
17
+ );
18
+ }
19
+ static jsi::Value __hostFunction_NativeBarkReactNativeCxxSpecJSI_cleanupRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
+ return static_cast<NativeBarkReactNativeCxxSpecJSI *>(&turboModule)->cleanupRustCrate(
21
+ rt
22
+ );
23
+ }
24
+
25
+ NativeBarkReactNativeCxxSpecJSI::NativeBarkReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
26
+ : TurboModule("BarkReactNative", jsInvoker) {
27
+ methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeBarkReactNativeCxxSpecJSI_installRustCrate};
28
+ methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeBarkReactNativeCxxSpecJSI_cleanupRustCrate};
29
+ }
30
+
31
+
32
+ } // namespace facebook::react