react-native-list 1.0.1 → 2.0.0-alpha.1

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 (190) hide show
  1. package/README.md +188 -32
  2. package/ReactNativeList.podspec +39 -0
  3. package/android/CMakeLists.txt +48 -0
  4. package/android/build.gradle +151 -0
  5. package/android/fix-prefab.gradle +51 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/JHybridUiListModule.cpp +192 -0
  9. package/android/src/main/cpp/JHybridUiListModule.h +50 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +12 -0
  11. package/android/src/main/java/com/hannojg/reactnativelist/ReactNativeListPackage.kt +27 -0
  12. package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridNativeListDataSource.kt +146 -0
  13. package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridNativeListLayout.kt +86 -0
  14. package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridUiListModule.kt +116 -0
  15. package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridUiListView.kt +410 -0
  16. package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridViewHolder.kt +9 -0
  17. package/android/src/main/java/com/margelo/nitro/reactnativelist/NativeListAdapter.kt +217 -0
  18. package/ios/DataSource/HybridNativeListDataSource.swift +213 -0
  19. package/ios/HybridObjects/HybridUiListModule.swift +49 -0
  20. package/ios/HybridObjects/HybridViewHolder.swift +16 -0
  21. package/ios/Layout/HybridNativeListLayout.swift +128 -0
  22. package/ios/Utils/ErrorUtils.h +26 -0
  23. package/ios/Utils/HybridIOSWorkletsModuleProxyHolder.swift +10 -0
  24. package/ios/Utils/SurfaceHelper.h +20 -0
  25. package/ios/Utils/SurfaceHelper.mm +144 -0
  26. package/ios/Utils/SurfacePresenterRegistry.h +17 -0
  27. package/ios/Utils/SurfacePresenterRegistry.m +31 -0
  28. package/ios/Utils/TurboModuleInstaller.h +18 -0
  29. package/ios/Utils/TurboModuleInstaller.mm +267 -0
  30. package/ios/Views/HostCell.swift +216 -0
  31. package/ios/Views/HybridUiListView.swift +695 -0
  32. package/metro/RendererProxyThreadSwitch.js +66 -0
  33. package/metro-config.d.ts +1 -0
  34. package/metro-config.js +52 -0
  35. package/nitro.json +47 -0
  36. package/nitrogen/generated/.gitattributes +1 -0
  37. package/nitrogen/generated/android/ReactNativeList+autolinking.cmake +99 -0
  38. package/nitrogen/generated/android/ReactNativeList+autolinking.gradle +27 -0
  39. package/nitrogen/generated/android/ReactNativeListOnLoad.cpp +156 -0
  40. package/nitrogen/generated/android/ReactNativeListOnLoad.hpp +34 -0
  41. package/nitrogen/generated/android/c++/JFunc_bool_NativeListItem_NativeListItem.hpp +83 -0
  42. package/nitrogen/generated/android/c++/JFunc_bool_double_NativeListItem_double.hpp +83 -0
  43. package/nitrogen/generated/android/c++/JFunc_double_std__string.hpp +78 -0
  44. package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.cpp +49 -0
  45. package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.hpp +63 -0
  46. package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.cpp +63 -0
  47. package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.hpp +65 -0
  48. package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.cpp +101 -0
  49. package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.hpp +70 -0
  50. package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.cpp +49 -0
  51. package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.hpp +63 -0
  52. package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.cpp +65 -0
  53. package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.hpp +64 -0
  54. package/nitrogen/generated/android/c++/JHybridUiListViewSpec.cpp +92 -0
  55. package/nitrogen/generated/android/c++/JHybridUiListViewSpec.hpp +67 -0
  56. package/nitrogen/generated/android/c++/JHybridViewHolderSpec.cpp +49 -0
  57. package/nitrogen/generated/android/c++/JHybridViewHolderSpec.hpp +63 -0
  58. package/nitrogen/generated/android/c++/JNativeItemSizeEstimate.hpp +61 -0
  59. package/nitrogen/generated/android/c++/JNativeLinearListLayoutConfig.hpp +81 -0
  60. package/nitrogen/generated/android/c++/JNativeLinearListLayoutIOSConfig.hpp +59 -0
  61. package/nitrogen/generated/android/c++/JNativeListItem.hpp +76 -0
  62. package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.cpp +26 -0
  63. package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.hpp +72 -0
  64. package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.cpp +53 -0
  65. package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.hpp +49 -0
  66. package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.cpp +53 -0
  67. package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.hpp +49 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_NativeListItem_NativeListItem.kt +80 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_double_NativeListItem_double.kt +80 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_double_std__string.kt +80 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridIOSWorkletsModuleProxyHolderSpec.kt +52 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeLinearListLayoutSpec.kt +54 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListDataSourceSpec.kt +87 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListLayoutSpec.kt +52 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListModuleSpec.kt +59 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListViewSpec.kt +76 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridViewHolderSpec.kt +53 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeItemSizeEstimate.kt +56 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutConfig.kt +76 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutIOSConfig.kt +51 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeListItem.kt +71 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/ReactNativeListOnLoad.kt +35 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.kt +62 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewManager.kt +80 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewStateUpdater.kt +23 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderManager.kt +80 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderStateUpdater.kt +23 -0
  88. package/nitrogen/generated/ios/ReactNativeList+autolinking.rb +62 -0
  89. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.cpp +162 -0
  90. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.hpp +368 -0
  91. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Umbrella.hpp +92 -0
  92. package/nitrogen/generated/ios/ReactNativeListAutolinking.mm +83 -0
  93. package/nitrogen/generated/ios/ReactNativeListAutolinking.swift +86 -0
  94. package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.cpp +11 -0
  95. package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.hpp +75 -0
  96. package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.cpp +11 -0
  97. package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.hpp +92 -0
  98. package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.cpp +11 -0
  99. package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.hpp +132 -0
  100. package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.cpp +11 -0
  101. package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.hpp +75 -0
  102. package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.cpp +11 -0
  103. package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.hpp +93 -0
  104. package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.cpp +11 -0
  105. package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.hpp +121 -0
  106. package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.cpp +11 -0
  107. package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.hpp +75 -0
  108. package/nitrogen/generated/ios/c++/views/HybridUiListViewComponent.mm +118 -0
  109. package/nitrogen/generated/ios/c++/views/HybridViewHolderComponent.mm +118 -0
  110. package/nitrogen/generated/ios/swift/Func_bool_NativeListItem_NativeListItem.swift +47 -0
  111. package/nitrogen/generated/ios/swift/Func_bool_double_NativeListItem_double.swift +47 -0
  112. package/nitrogen/generated/ios/swift/Func_double_std__string.swift +47 -0
  113. package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec.swift +55 -0
  114. package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec_cxx.swift +128 -0
  115. package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec.swift +55 -0
  116. package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec_cxx.swift +140 -0
  117. package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec.swift +62 -0
  118. package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec_cxx.swift +222 -0
  119. package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec.swift +55 -0
  120. package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec_cxx.swift +128 -0
  121. package/nitrogen/generated/ios/swift/HybridUiListModuleSpec.swift +56 -0
  122. package/nitrogen/generated/ios/swift/HybridUiListModuleSpec_cxx.swift +175 -0
  123. package/nitrogen/generated/ios/swift/HybridUiListViewSpec.swift +59 -0
  124. package/nitrogen/generated/ios/swift/HybridUiListViewSpec_cxx.swift +227 -0
  125. package/nitrogen/generated/ios/swift/HybridViewHolderSpec.swift +55 -0
  126. package/nitrogen/generated/ios/swift/HybridViewHolderSpec_cxx.swift +147 -0
  127. package/nitrogen/generated/ios/swift/NativeItemSizeEstimate.swift +60 -0
  128. package/nitrogen/generated/ios/swift/NativeLinearListLayoutConfig.swift +60 -0
  129. package/nitrogen/generated/ios/swift/NativeLinearListLayoutIOSConfig.swift +35 -0
  130. package/nitrogen/generated/ios/swift/NativeListItem.swift +75 -0
  131. package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridIOSWorkletsModuleProxyHolderSpec_.swift +30 -0
  132. package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.cpp +21 -0
  133. package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.hpp +62 -0
  134. package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.cpp +22 -0
  135. package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.hpp +67 -0
  136. package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.cpp +28 -0
  137. package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.hpp +72 -0
  138. package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.cpp +21 -0
  139. package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.hpp +62 -0
  140. package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.cpp +22 -0
  141. package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.hpp +68 -0
  142. package/nitrogen/generated/shared/c++/HybridUiListViewSpec.cpp +25 -0
  143. package/nitrogen/generated/shared/c++/HybridUiListViewSpec.hpp +79 -0
  144. package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.cpp +23 -0
  145. package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.hpp +65 -0
  146. package/nitrogen/generated/shared/c++/HybridViewHolderSpec.cpp +21 -0
  147. package/nitrogen/generated/shared/c++/HybridViewHolderSpec.hpp +62 -0
  148. package/nitrogen/generated/shared/c++/NativeItemSizeEstimate.hpp +87 -0
  149. package/nitrogen/generated/shared/c++/NativeLinearListLayoutConfig.hpp +105 -0
  150. package/nitrogen/generated/shared/c++/NativeLinearListLayoutIOSConfig.hpp +85 -0
  151. package/nitrogen/generated/shared/c++/NativeListItem.hpp +101 -0
  152. package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.cpp +72 -0
  153. package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.hpp +109 -0
  154. package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.cpp +72 -0
  155. package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.hpp +109 -0
  156. package/nitrogen/generated/shared/json/UiListViewConfig.json +9 -0
  157. package/nitrogen/generated/shared/json/ViewHolderConfig.json +9 -0
  158. package/package.json +152 -5
  159. package/react-native.config.js +16 -0
  160. package/src/ListDataSource.ts +232 -0
  161. package/src/ListLayout.ts +95 -0
  162. package/src/UiListModule.ts +5 -0
  163. package/src/hooks/useChangeEffect.ts +50 -0
  164. package/src/index.tsx +49 -0
  165. package/src/privateGlobals.ts +20 -0
  166. package/src/renderer/fabric/RenderHelper.ts +29 -0
  167. package/src/renderer/fabric/UiManagerHelper.ts +5 -0
  168. package/src/renderer/react/ReactFabricMirror.bundle.js +1984 -0
  169. package/src/renderer/react/ReactFabricMirror.ts +766 -0
  170. package/src/renderer/react/ReactFabricRenderer.ts +11 -0
  171. package/src/specs/IOSWorkletsModuleProxyHolder.nitro.ts +6 -0
  172. package/src/specs/NativeLinearListLayout.nitro.ts +23 -0
  173. package/src/specs/NativeListDataSource.nitro.ts +28 -0
  174. package/src/specs/NativeListLayout.nitro.ts +6 -0
  175. package/src/specs/UIListModule.nitro.ts +13 -0
  176. package/src/specs/UIManagerHelper.nitro.ts +34 -0
  177. package/src/specs/UiListView.nitro.ts +31 -0
  178. package/src/specs/ViewHolder.nitro.ts +11 -0
  179. package/src/views/List.tsx +525 -0
  180. package/src/views/UiListHostComponent.ts +8 -0
  181. package/FillRateHelper.js +0 -179
  182. package/FlatList.js +0 -494
  183. package/LICENSE.md +0 -31
  184. package/MetroListView.js +0 -166
  185. package/SectionList.js +0 -291
  186. package/ViewabilityHelper.js +0 -260
  187. package/VirtualizeUtils.js +0 -163
  188. package/VirtualizedList.js +0 -861
  189. package/VirtualizedSectionList.js +0 -397
  190. package/index.js +0 -5
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// JFunc_double_std__string.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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::reactnativelist {
18
+
19
+ using namespace facebook;
20
+
21
+ /**
22
+ * Represents the Java/Kotlin callback `(type: String) -> Double`.
23
+ * This can be passed around between C++ and Java/Kotlin.
24
+ */
25
+ struct JFunc_double_std__string: public jni::JavaClass<JFunc_double_std__string> {
26
+ public:
27
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_double_std__string;";
28
+
29
+ public:
30
+ /**
31
+ * Invokes the function this `JFunc_double_std__string` instance holds through JNI.
32
+ */
33
+ double invoke(const std::string& type) const {
34
+ static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<jni::JString> /* type */)>("invoke");
35
+ auto __result = method(self(), jni::make_jstring(type));
36
+ return __result;
37
+ }
38
+ };
39
+
40
+ /**
41
+ * An implementation of Func_double_std__string that is backed by a C++ implementation (using `std::function<...>`)
42
+ */
43
+ class JFunc_double_std__string_cxx final: public jni::HybridClass<JFunc_double_std__string_cxx, JFunc_double_std__string> {
44
+ public:
45
+ static jni::local_ref<JFunc_double_std__string::javaobject> fromCpp(const std::function<double(const std::string& /* type */)>& func) {
46
+ return JFunc_double_std__string_cxx::newObjectCxxArgs(func);
47
+ }
48
+
49
+ public:
50
+ /**
51
+ * Invokes the C++ `std::function<...>` this `JFunc_double_std__string_cxx` instance holds.
52
+ */
53
+ double invoke_cxx(jni::alias_ref<jni::JString> type) {
54
+ double __result = _func(type->toStdString());
55
+ return __result;
56
+ }
57
+
58
+ public:
59
+ [[nodiscard]]
60
+ inline const std::function<double(const std::string& /* type */)>& getFunction() const {
61
+ return _func;
62
+ }
63
+
64
+ public:
65
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_double_std__string_cxx;";
66
+ static void registerNatives() {
67
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_double_std__string_cxx::invoke_cxx)});
68
+ }
69
+
70
+ private:
71
+ explicit JFunc_double_std__string_cxx(const std::function<double(const std::string& /* type */)>& func): _func(func) { }
72
+
73
+ private:
74
+ friend HybridBase;
75
+ std::function<double(const std::string& /* type */)> _func;
76
+ };
77
+
78
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,49 @@
1
+ ///
2
+ /// JHybridIOSWorkletsModuleProxyHolderSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JHybridIOSWorkletsModuleProxyHolderSpec.hpp"
9
+
10
+
11
+
12
+
13
+
14
+ namespace margelo::nitro::reactnativelist {
15
+
16
+ std::shared_ptr<JHybridIOSWorkletsModuleProxyHolderSpec> JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart::getJHybridIOSWorkletsModuleProxyHolderSpec() {
17
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
18
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridIOSWorkletsModuleProxyHolderSpec>(hybridObject);
19
+ if (castHybridObject == nullptr) [[unlikely]] {
20
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridIOSWorkletsModuleProxyHolderSpec!");
21
+ }
22
+ return castHybridObject;
23
+ }
24
+
25
+ jni::local_ref<JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::jhybriddata> JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
26
+ return makeCxxInstance(jThis);
27
+ }
28
+
29
+ std::shared_ptr<JHybridObject> JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
30
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart>(javaPart);
31
+ if (castJavaPart == nullptr) [[unlikely]] {
32
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart!");
33
+ }
34
+ return std::make_shared<JHybridIOSWorkletsModuleProxyHolderSpec>(castJavaPart);
35
+ }
36
+
37
+ void JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::registerNatives() {
38
+ registerHybrid({
39
+ makeNativeMethod("initHybrid", JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::initHybrid),
40
+ });
41
+ }
42
+
43
+ // Properties
44
+
45
+
46
+ // Methods
47
+
48
+
49
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,63 @@
1
+ ///
2
+ /// HybridIOSWorkletsModuleProxyHolderSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridIOSWorkletsModuleProxyHolderSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::reactnativelist {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridIOSWorkletsModuleProxyHolderSpec: public virtual HybridIOSWorkletsModuleProxyHolderSpec, public virtual JHybridObject {
22
+ public:
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridIOSWorkletsModuleProxyHolderSpec;";
25
+ std::shared_ptr<JHybridIOSWorkletsModuleProxyHolderSpec> getJHybridIOSWorkletsModuleProxyHolderSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridIOSWorkletsModuleProxyHolderSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
35
+
36
+ public:
37
+ explicit JHybridIOSWorkletsModuleProxyHolderSpec(const jni::local_ref<JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridIOSWorkletsModuleProxyHolderSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
41
+ ~JHybridIOSWorkletsModuleProxyHolderSpec() override {
42
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
43
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
44
+ }
45
+
46
+ public:
47
+ inline const jni::global_ref<JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart>& getJavaPart() const noexcept {
48
+ return _javaPart;
49
+ }
50
+
51
+ public:
52
+ // Properties
53
+
54
+
55
+ public:
56
+ // Methods
57
+
58
+
59
+ private:
60
+ jni::global_ref<JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart> _javaPart;
61
+ };
62
+
63
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,63 @@
1
+ ///
2
+ /// JHybridNativeLinearListLayoutSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JHybridNativeLinearListLayoutSpec.hpp"
9
+
10
+ // Forward declaration of `NativeLinearListLayoutConfig` to properly resolve imports.
11
+ namespace margelo::nitro::reactnativelist { struct NativeLinearListLayoutConfig; }
12
+ // Forward declaration of `NativeLinearListLayoutIOSConfig` to properly resolve imports.
13
+ namespace margelo::nitro::reactnativelist { struct NativeLinearListLayoutIOSConfig; }
14
+ // Forward declaration of `NativeItemSizeEstimate` to properly resolve imports.
15
+ namespace margelo::nitro::reactnativelist { struct NativeItemSizeEstimate; }
16
+
17
+ #include "NativeLinearListLayoutConfig.hpp"
18
+ #include "JNativeLinearListLayoutConfig.hpp"
19
+ #include "NativeLinearListLayoutIOSConfig.hpp"
20
+ #include <optional>
21
+ #include "JNativeLinearListLayoutIOSConfig.hpp"
22
+ #include "NativeItemSizeEstimate.hpp"
23
+ #include "JNativeItemSizeEstimate.hpp"
24
+
25
+ namespace margelo::nitro::reactnativelist {
26
+
27
+ std::shared_ptr<JHybridNativeLinearListLayoutSpec> JHybridNativeLinearListLayoutSpec::JavaPart::getJHybridNativeLinearListLayoutSpec() {
28
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
29
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridNativeLinearListLayoutSpec>(hybridObject);
30
+ if (castHybridObject == nullptr) [[unlikely]] {
31
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridNativeLinearListLayoutSpec!");
32
+ }
33
+ return castHybridObject;
34
+ }
35
+
36
+ jni::local_ref<JHybridNativeLinearListLayoutSpec::CxxPart::jhybriddata> JHybridNativeLinearListLayoutSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
37
+ return makeCxxInstance(jThis);
38
+ }
39
+
40
+ std::shared_ptr<JHybridObject> JHybridNativeLinearListLayoutSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
41
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridNativeLinearListLayoutSpec::JavaPart>(javaPart);
42
+ if (castJavaPart == nullptr) [[unlikely]] {
43
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridNativeLinearListLayoutSpec::JavaPart!");
44
+ }
45
+ return std::make_shared<JHybridNativeLinearListLayoutSpec>(castJavaPart);
46
+ }
47
+
48
+ void JHybridNativeLinearListLayoutSpec::CxxPart::registerNatives() {
49
+ registerHybrid({
50
+ makeNativeMethod("initHybrid", JHybridNativeLinearListLayoutSpec::CxxPart::initHybrid),
51
+ });
52
+ }
53
+
54
+ // Properties
55
+
56
+
57
+ // Methods
58
+ void JHybridNativeLinearListLayoutSpec::setConfig(const NativeLinearListLayoutConfig& config) {
59
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNativeLinearListLayoutConfig> /* config */)>("setConfig");
60
+ method(_javaPart, JNativeLinearListLayoutConfig::fromCpp(config));
61
+ }
62
+
63
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// HybridNativeLinearListLayoutSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridNativeLinearListLayoutSpec.hpp"
13
+
14
+ // Forward declaration of `JHybridNativeListLayoutSpec` to properly resolve imports.
15
+ namespace margelo::nitro::reactnativelist { class JHybridNativeListLayoutSpec; }
16
+ #include "JHybridNativeListLayoutSpec.hpp"
17
+
18
+ namespace margelo::nitro::reactnativelist {
19
+
20
+ using namespace facebook;
21
+
22
+ class JHybridNativeLinearListLayoutSpec: public virtual HybridNativeLinearListLayoutSpec, public virtual JHybridNativeListLayoutSpec {
23
+ public:
24
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridNativeListLayoutSpec::JavaPart> {
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeLinearListLayoutSpec;";
26
+ std::shared_ptr<JHybridNativeLinearListLayoutSpec> getJHybridNativeLinearListLayoutSpec();
27
+ };
28
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridNativeListLayoutSpec::CxxPart> {
29
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeLinearListLayoutSpec$CxxPart;";
30
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
31
+ static void registerNatives();
32
+ using HybridBase::HybridBase;
33
+ protected:
34
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
35
+ };
36
+
37
+ public:
38
+ explicit JHybridNativeLinearListLayoutSpec(const jni::local_ref<JHybridNativeLinearListLayoutSpec::JavaPart>& javaPart):
39
+ HybridObject(HybridNativeLinearListLayoutSpec::TAG),
40
+ JHybridObject(javaPart),
41
+ JHybridNativeListLayoutSpec(javaPart),
42
+ _javaPart(jni::make_global(javaPart)) {}
43
+ ~JHybridNativeLinearListLayoutSpec() override {
44
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
45
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
46
+ }
47
+
48
+ public:
49
+ inline const jni::global_ref<JHybridNativeLinearListLayoutSpec::JavaPart>& getJavaPart() const noexcept {
50
+ return _javaPart;
51
+ }
52
+
53
+ public:
54
+ // Properties
55
+
56
+
57
+ public:
58
+ // Methods
59
+ void setConfig(const NativeLinearListLayoutConfig& config) override;
60
+
61
+ private:
62
+ jni::global_ref<JHybridNativeLinearListLayoutSpec::JavaPart> _javaPart;
63
+ };
64
+
65
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,101 @@
1
+ ///
2
+ /// JHybridNativeListDataSourceSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JHybridNativeListDataSourceSpec.hpp"
9
+
10
+ // Forward declaration of `NativeListItem` to properly resolve imports.
11
+ namespace margelo::nitro::reactnativelist { struct NativeListItem; }
12
+
13
+ #include "NativeListItem.hpp"
14
+ #include "JNativeListItem.hpp"
15
+ #include <string>
16
+ #include <optional>
17
+ #include <NitroModules/AnyMap.hpp>
18
+ #include <NitroModules/JAnyMap.hpp>
19
+ #include <functional>
20
+ #include "JFunc_bool_NativeListItem_NativeListItem.hpp"
21
+ #include <NitroModules/JNICallable.hpp>
22
+ #include <vector>
23
+
24
+ namespace margelo::nitro::reactnativelist {
25
+
26
+ std::shared_ptr<JHybridNativeListDataSourceSpec> JHybridNativeListDataSourceSpec::JavaPart::getJHybridNativeListDataSourceSpec() {
27
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
28
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridNativeListDataSourceSpec>(hybridObject);
29
+ if (castHybridObject == nullptr) [[unlikely]] {
30
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridNativeListDataSourceSpec!");
31
+ }
32
+ return castHybridObject;
33
+ }
34
+
35
+ jni::local_ref<JHybridNativeListDataSourceSpec::CxxPart::jhybriddata> JHybridNativeListDataSourceSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
36
+ return makeCxxInstance(jThis);
37
+ }
38
+
39
+ std::shared_ptr<JHybridObject> JHybridNativeListDataSourceSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
40
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridNativeListDataSourceSpec::JavaPart>(javaPart);
41
+ if (castJavaPart == nullptr) [[unlikely]] {
42
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridNativeListDataSourceSpec::JavaPart!");
43
+ }
44
+ return std::make_shared<JHybridNativeListDataSourceSpec>(castJavaPart);
45
+ }
46
+
47
+ void JHybridNativeListDataSourceSpec::CxxPart::registerNatives() {
48
+ registerHybrid({
49
+ makeNativeMethod("initHybrid", JHybridNativeListDataSourceSpec::CxxPart::initHybrid),
50
+ });
51
+ }
52
+
53
+ // Properties
54
+
55
+
56
+ // Methods
57
+ void JHybridNativeListDataSourceSpec::setContentEqualCallback(const std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)>& isContentEqual) {
58
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_bool_NativeListItem_NativeListItem::javaobject> /* isContentEqual */)>("setContentEqualCallback_cxx");
59
+ method(_javaPart, JFunc_bool_NativeListItem_NativeListItem_cxx::fromCpp(isContentEqual));
60
+ }
61
+ void JHybridNativeListDataSourceSpec::replaceData(const std::vector<NativeListItem>& items, bool animated) {
62
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JNativeListItem>> /* items */, jboolean /* animated */)>("replaceData");
63
+ method(_javaPart, [&](auto&& __input) {
64
+ size_t __size = __input.size();
65
+ jni::local_ref<jni::JArrayClass<JNativeListItem>> __array = jni::JArrayClass<JNativeListItem>::newArray(__size);
66
+ for (size_t __i = 0; __i < __size; __i++) {
67
+ const auto& __element = __input[__i];
68
+ auto __elementJni = JNativeListItem::fromCpp(__element);
69
+ __array->setElement(__i, *__elementJni);
70
+ }
71
+ return __array;
72
+ }(items), animated);
73
+ }
74
+ void JHybridNativeListDataSourceSpec::insertItem(double index, const NativeListItem& item) {
75
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* index */, jni::alias_ref<JNativeListItem> /* item */)>("insertItem");
76
+ method(_javaPart, index, JNativeListItem::fromCpp(item));
77
+ }
78
+ void JHybridNativeListDataSourceSpec::updateItem(double index, const NativeListItem& item) {
79
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* index */, jni::alias_ref<JNativeListItem> /* item */)>("updateItem");
80
+ method(_javaPart, index, JNativeListItem::fromCpp(item));
81
+ }
82
+ void JHybridNativeListDataSourceSpec::removeItem(double index) {
83
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* index */)>("removeItem");
84
+ method(_javaPart, index);
85
+ }
86
+ void JHybridNativeListDataSourceSpec::moveItem(double fromIndex, double toIndex) {
87
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* fromIndex */, double /* toIndex */)>("moveItem");
88
+ method(_javaPart, fromIndex, toIndex);
89
+ }
90
+ double JHybridNativeListDataSourceSpec::getCount() {
91
+ static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getCount");
92
+ auto __result = method(_javaPart);
93
+ return __result;
94
+ }
95
+ NativeListItem JHybridNativeListDataSourceSpec::getItem(double index) {
96
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListItem>(double /* index */)>("getItem");
97
+ auto __result = method(_javaPart, index);
98
+ return __result->toCpp();
99
+ }
100
+
101
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,70 @@
1
+ ///
2
+ /// HybridNativeListDataSourceSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridNativeListDataSourceSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::reactnativelist {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridNativeListDataSourceSpec: public virtual HybridNativeListDataSourceSpec, public virtual JHybridObject {
22
+ public:
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListDataSourceSpec;";
25
+ std::shared_ptr<JHybridNativeListDataSourceSpec> getJHybridNativeListDataSourceSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListDataSourceSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
35
+
36
+ public:
37
+ explicit JHybridNativeListDataSourceSpec(const jni::local_ref<JHybridNativeListDataSourceSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridNativeListDataSourceSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
41
+ ~JHybridNativeListDataSourceSpec() override {
42
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
43
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
44
+ }
45
+
46
+ public:
47
+ inline const jni::global_ref<JHybridNativeListDataSourceSpec::JavaPart>& getJavaPart() const noexcept {
48
+ return _javaPart;
49
+ }
50
+
51
+ public:
52
+ // Properties
53
+
54
+
55
+ public:
56
+ // Methods
57
+ void setContentEqualCallback(const std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)>& isContentEqual) override;
58
+ void replaceData(const std::vector<NativeListItem>& items, bool animated) override;
59
+ void insertItem(double index, const NativeListItem& item) override;
60
+ void updateItem(double index, const NativeListItem& item) override;
61
+ void removeItem(double index) override;
62
+ void moveItem(double fromIndex, double toIndex) override;
63
+ double getCount() override;
64
+ NativeListItem getItem(double index) override;
65
+
66
+ private:
67
+ jni::global_ref<JHybridNativeListDataSourceSpec::JavaPart> _javaPart;
68
+ };
69
+
70
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,49 @@
1
+ ///
2
+ /// JHybridNativeListLayoutSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JHybridNativeListLayoutSpec.hpp"
9
+
10
+
11
+
12
+
13
+
14
+ namespace margelo::nitro::reactnativelist {
15
+
16
+ std::shared_ptr<JHybridNativeListLayoutSpec> JHybridNativeListLayoutSpec::JavaPart::getJHybridNativeListLayoutSpec() {
17
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
18
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridNativeListLayoutSpec>(hybridObject);
19
+ if (castHybridObject == nullptr) [[unlikely]] {
20
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridNativeListLayoutSpec!");
21
+ }
22
+ return castHybridObject;
23
+ }
24
+
25
+ jni::local_ref<JHybridNativeListLayoutSpec::CxxPart::jhybriddata> JHybridNativeListLayoutSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
26
+ return makeCxxInstance(jThis);
27
+ }
28
+
29
+ std::shared_ptr<JHybridObject> JHybridNativeListLayoutSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
30
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridNativeListLayoutSpec::JavaPart>(javaPart);
31
+ if (castJavaPart == nullptr) [[unlikely]] {
32
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridNativeListLayoutSpec::JavaPart!");
33
+ }
34
+ return std::make_shared<JHybridNativeListLayoutSpec>(castJavaPart);
35
+ }
36
+
37
+ void JHybridNativeListLayoutSpec::CxxPart::registerNatives() {
38
+ registerHybrid({
39
+ makeNativeMethod("initHybrid", JHybridNativeListLayoutSpec::CxxPart::initHybrid),
40
+ });
41
+ }
42
+
43
+ // Properties
44
+
45
+
46
+ // Methods
47
+
48
+
49
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,63 @@
1
+ ///
2
+ /// HybridNativeListLayoutSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridNativeListLayoutSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::reactnativelist {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridNativeListLayoutSpec: public virtual HybridNativeListLayoutSpec, public virtual JHybridObject {
22
+ public:
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListLayoutSpec;";
25
+ std::shared_ptr<JHybridNativeListLayoutSpec> getJHybridNativeListLayoutSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListLayoutSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
35
+
36
+ public:
37
+ explicit JHybridNativeListLayoutSpec(const jni::local_ref<JHybridNativeListLayoutSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridNativeListLayoutSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
41
+ ~JHybridNativeListLayoutSpec() override {
42
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
43
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
44
+ }
45
+
46
+ public:
47
+ inline const jni::global_ref<JHybridNativeListLayoutSpec::JavaPart>& getJavaPart() const noexcept {
48
+ return _javaPart;
49
+ }
50
+
51
+ public:
52
+ // Properties
53
+
54
+
55
+ public:
56
+ // Methods
57
+
58
+
59
+ private:
60
+ jni::global_ref<JHybridNativeListLayoutSpec::JavaPart> _javaPart;
61
+ };
62
+
63
+ } // namespace margelo::nitro::reactnativelist
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// JHybridUiListModuleSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JHybridUiListModuleSpec.hpp"
9
+
10
+ // Forward declaration of `HybridIOSWorkletsModuleProxyHolderSpec` to properly resolve imports.
11
+ namespace margelo::nitro::reactnativelist { class HybridIOSWorkletsModuleProxyHolderSpec; }
12
+
13
+ #include <memory>
14
+ #include "HybridIOSWorkletsModuleProxyHolderSpec.hpp"
15
+ #include "JHybridIOSWorkletsModuleProxyHolderSpec.hpp"
16
+ #include <NitroModules/Null.hpp>
17
+ #include <variant>
18
+ #include <optional>
19
+ #include "JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.hpp"
20
+ #include <NitroModules/JNull.hpp>
21
+
22
+ namespace margelo::nitro::reactnativelist {
23
+
24
+ std::shared_ptr<JHybridUiListModuleSpec> JHybridUiListModuleSpec::JavaPart::getJHybridUiListModuleSpec() {
25
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
26
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridUiListModuleSpec>(hybridObject);
27
+ if (castHybridObject == nullptr) [[unlikely]] {
28
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridUiListModuleSpec!");
29
+ }
30
+ return castHybridObject;
31
+ }
32
+
33
+ jni::local_ref<JHybridUiListModuleSpec::CxxPart::jhybriddata> JHybridUiListModuleSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
34
+ return makeCxxInstance(jThis);
35
+ }
36
+
37
+ std::shared_ptr<JHybridObject> JHybridUiListModuleSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
38
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridUiListModuleSpec::JavaPart>(javaPart);
39
+ if (castJavaPart == nullptr) [[unlikely]] {
40
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridUiListModuleSpec::JavaPart!");
41
+ }
42
+ return std::make_shared<JHybridUiListModuleSpec>(castJavaPart);
43
+ }
44
+
45
+ void JHybridUiListModuleSpec::CxxPart::registerNatives() {
46
+ registerHybrid({
47
+ makeNativeMethod("initHybrid", JHybridUiListModuleSpec::CxxPart::initHybrid),
48
+ });
49
+ }
50
+
51
+ // Properties
52
+
53
+
54
+ // Methods
55
+ std::shared_ptr<HybridIOSWorkletsModuleProxyHolderSpec> JHybridUiListModuleSpec::iosGetWorkletsModule() {
56
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JHybridIOSWorkletsModuleProxyHolderSpec::JavaPart>()>("iosGetWorkletsModule");
57
+ auto __result = method(_javaPart);
58
+ return __result->getJHybridIOSWorkletsModuleProxyHolderSpec();
59
+ }
60
+ void JHybridUiListModuleSpec::setupRuntime(const std::optional<std::variant<nitro::NullType, std::shared_ptr<HybridIOSWorkletsModuleProxyHolderSpec>>>& workletsModuleHolder) {
61
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec> /* workletsModuleHolder */)>("setupRuntime");
62
+ method(_javaPart, workletsModuleHolder.has_value() ? JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec::fromCpp(workletsModuleHolder.value()) : nullptr);
63
+ }
64
+
65
+ } // namespace margelo::nitro::reactnativelist