@onekeyfe/react-native-native-list 3.0.105

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 (181) hide show
  1. package/README.md +342 -0
  2. package/android/CMakeLists.txt +20 -0
  3. package/android/build.gradle +105 -0
  4. package/android/gradle.properties +4 -0
  5. package/android/src/main/AndroidManifest.xml +1 -0
  6. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  7. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +125 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +165 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +147 -0
  10. package/android/src/main/java/com/onekey/nativelist/NativeListPackage.kt +25 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +2939 -0
  12. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1794 -0
  13. package/common/fonts/Roobert-Bold.ttf +0 -0
  14. package/common/fonts/Roobert-Medium.ttf +0 -0
  15. package/common/fonts/Roobert-Regular.ttf +0 -0
  16. package/common/fonts/Roobert-SemiBold.ttf +0 -0
  17. package/docs/DESIGN.md +129 -0
  18. package/ios/HybridNativeList.swift +131 -0
  19. package/ios/NativeListCell.swift +2858 -0
  20. package/ios/NativeListDesignAssets.swift +110 -0
  21. package/ios/NativeListModels.swift +215 -0
  22. package/ios/RNCNativeListView.swift +1737 -0
  23. package/ios/Resources/NativeListIcons.xcassets/Contents.json +1 -0
  24. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +1 -0
  25. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +1 -0
  26. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +1 -0
  27. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +1 -0
  28. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +1 -0
  29. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +1 -0
  30. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +1 -0
  31. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +1 -0
  32. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +1 -0
  33. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +1 -0
  34. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +1 -0
  35. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +1 -0
  36. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +1 -0
  37. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +1 -0
  38. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +1 -0
  39. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +1 -0
  40. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +1 -0
  41. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +1 -0
  42. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +1 -0
  43. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +1 -0
  44. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +1 -0
  45. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +1 -0
  46. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +1 -0
  47. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +1 -0
  48. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +1 -0
  49. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +1 -0
  50. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +1 -0
  51. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +1 -0
  52. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +1 -0
  53. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +1 -0
  54. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +1 -0
  55. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +1 -0
  56. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +1 -0
  57. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +1 -0
  58. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +1 -0
  59. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +1 -0
  60. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +1 -0
  61. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +1 -0
  62. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +1 -0
  63. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +1 -0
  64. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +1 -0
  65. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +1 -0
  66. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +1 -0
  67. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +1 -0
  68. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +1 -0
  69. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +1 -0
  70. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +1 -0
  71. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +1 -0
  72. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +1 -0
  73. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +1 -0
  74. package/lib/module/NativeList.js +183 -0
  75. package/lib/module/NativeList.nitro.js +4 -0
  76. package/lib/module/NativeList.types.js +4 -0
  77. package/lib/module/NativeList.web.js +167 -0
  78. package/lib/module/index.js +6 -0
  79. package/lib/module/models.js +2 -0
  80. package/lib/module/package.json +1 -0
  81. package/lib/module/scrolling.js +121 -0
  82. package/lib/module/selection.js +85 -0
  83. package/lib/module/validation.js +562 -0
  84. package/lib/module/web/NativeListWebEngine.js +2238 -0
  85. package/lib/nitrogen/generated/.gitattributes +1 -0
  86. package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  87. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
  88. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
  89. package/lib/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
  90. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
  91. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
  92. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
  93. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
  94. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
  95. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
  96. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
  97. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
  98. package/lib/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
  99. package/lib/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
  100. package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
  101. package/lib/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
  102. package/lib/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
  103. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
  104. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
  105. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
  106. package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
  107. package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
  108. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
  109. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
  110. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
  111. package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  112. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
  113. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
  114. package/lib/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
  115. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
  116. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
  117. package/lib/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
  118. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
  119. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
  120. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
  121. package/lib/typescript/package.json +1 -0
  122. package/lib/typescript/src/NativeList.d.ts +18 -0
  123. package/lib/typescript/src/NativeList.nitro.d.ts +29 -0
  124. package/lib/typescript/src/NativeList.types.d.ts +87 -0
  125. package/lib/typescript/src/NativeList.web.d.ts +19 -0
  126. package/lib/typescript/src/index.d.ts +7 -0
  127. package/lib/typescript/src/models.d.ts +456 -0
  128. package/lib/typescript/src/scrolling.d.ts +32 -0
  129. package/lib/typescript/src/selection.d.ts +27 -0
  130. package/lib/typescript/src/validation.d.ts +7 -0
  131. package/lib/typescript/src/web/NativeListWebEngine.d.ts +203 -0
  132. package/nitro.json +23 -0
  133. package/nitrogen/generated/.gitattributes +1 -0
  134. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  135. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
  136. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
  137. package/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
  138. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
  139. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
  140. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
  141. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
  142. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
  146. package/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
  147. package/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
  148. package/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
  149. package/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
  150. package/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
  151. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
  152. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
  153. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
  154. package/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
  155. package/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
  156. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
  157. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
  158. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
  159. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  160. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
  161. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
  162. package/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
  163. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
  164. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
  165. package/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
  166. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
  167. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
  168. package/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
  169. package/package.json +126 -0
  170. package/react-native-native-list.podspec +38 -0
  171. package/react-native.config.js +19 -0
  172. package/src/NativeList.nitro.ts +48 -0
  173. package/src/NativeList.tsx +298 -0
  174. package/src/NativeList.types.ts +125 -0
  175. package/src/NativeList.web.tsx +258 -0
  176. package/src/index.ts +35 -0
  177. package/src/models.ts +604 -0
  178. package/src/scrolling.ts +189 -0
  179. package/src/selection.ts +159 -0
  180. package/src/validation.ts +877 -0
  181. package/src/web/NativeListWebEngine.ts +3767 -0
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// nativelist+autolinking.gradle
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
+ /// 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/nativelist+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 nativelist 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,58 @@
1
+ ///
2
+ /// nativelistOnLoad.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
+ #ifndef BUILDING_NATIVELIST_WITH_GENERATED_CMAKE_PROJECT
9
+ #error nativelistOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "nativelistOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridNativeListSpec.hpp"
19
+ #include "JFunc_void_std__string.hpp"
20
+ #include "views/JHybridNativeListStateUpdater.hpp"
21
+ #include <NitroModules/DefaultConstructableObject.hpp>
22
+
23
+ namespace margelo::nitro::nativelist {
24
+
25
+ int initialize(JavaVM* vm) {
26
+ return facebook::jni::initialize(vm, []() {
27
+ ::margelo::nitro::nativelist::registerAllNatives();
28
+ });
29
+ }
30
+
31
+ struct JHybridNativeListSpecImpl: public jni::JavaClass<JHybridNativeListSpecImpl, JHybridNativeListSpec::JavaPart> {
32
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/HybridNativeList;";
33
+ static std::shared_ptr<JHybridNativeListSpec> create() {
34
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNativeListSpecImpl::javaobject()>();
35
+ jni::local_ref<JHybridNativeListSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
36
+ return javaPart->getJHybridNativeListSpec();
37
+ }
38
+ };
39
+
40
+ void registerAllNatives() {
41
+ using namespace margelo::nitro;
42
+ using namespace margelo::nitro::nativelist;
43
+
44
+ // Register native JNI methods
45
+ margelo::nitro::nativelist::JHybridNativeListSpec::CxxPart::registerNatives();
46
+ margelo::nitro::nativelist::JFunc_void_std__string_cxx::registerNatives();
47
+ margelo::nitro::nativelist::views::JHybridNativeListStateUpdater::registerNatives();
48
+
49
+ // Register Nitro Hybrid Objects
50
+ HybridObjectRegistry::registerHybridObjectConstructor(
51
+ "NativeList",
52
+ []() -> std::shared_ptr<HybridObject> {
53
+ return JHybridNativeListSpecImpl::create();
54
+ }
55
+ );
56
+ }
57
+
58
+ } // namespace margelo::nitro::nativelist
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// nativelistOnLoad.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
+ #include <jni.h>
9
+ #include <functional>
10
+ #include <NitroModules/NitroDefines.hpp>
11
+
12
+ namespace margelo::nitro::nativelist {
13
+
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
17
+ /**
18
+ * Register the native (C++) part of nativelist, 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.
21
+ * Example:
22
+ * ```cpp (cpp-adapter.cpp)
23
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all nativelist HybridObjects
26
+ * margelo::nitro::nativelist::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
29
+ * }
30
+ * ```
31
+ */
32
+ void registerAllNatives();
33
+
34
+ } // namespace margelo::nitro::nativelist
@@ -0,0 +1,62 @@
1
+ #
2
+ # NativeListModule+autolinking.rb
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
+ # 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/NativeListModule+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 NativeListModule 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/NativeListModule-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 ObjC)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
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",
61
+ })
62
+ end
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// NativeListModule-Swift-Cxx-Bridge.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 "NativeListModule-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridNativeListSpecSwift.hpp"
12
+ #include "NativeListModule-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::nativelist::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void(const std::string& /* payloadJson */)>
18
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = NativeListModule::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](const std::string& payloadJson) mutable -> void {
21
+ swiftClosure.call(payloadJson);
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::shared_ptr<HybridNativeListSpec>
26
+ std::shared_ptr<HybridNativeListSpec> create_std__shared_ptr_HybridNativeListSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
27
+ NativeListModule::HybridNativeListSpec_cxx swiftPart = NativeListModule::HybridNativeListSpec_cxx::fromUnsafe(swiftUnsafePointer);
28
+ return std::make_shared<margelo::nitro::nativelist::HybridNativeListSpecSwift>(swiftPart);
29
+ }
30
+ void* NON_NULL get_std__shared_ptr_HybridNativeListSpec_(std__shared_ptr_HybridNativeListSpec_ cppType) {
31
+ std::shared_ptr<margelo::nitro::nativelist::HybridNativeListSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nativelist::HybridNativeListSpecSwift>(cppType);
32
+ #ifdef NITRO_DEBUG
33
+ if (swiftWrapper == nullptr) [[unlikely]] {
34
+ throw std::runtime_error("Class \"HybridNativeListSpec\" is not implemented in Swift!");
35
+ }
36
+ #endif
37
+ NativeListModule::HybridNativeListSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
38
+ return swiftPart.toUnsafe();
39
+ }
40
+
41
+ } // namespace margelo::nitro::nativelist::bridge::swift
@@ -0,0 +1,91 @@
1
+ ///
2
+ /// NativeListModule-Swift-Cxx-Bridge.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridNativeListSpec` to properly resolve imports.
12
+ namespace margelo::nitro::nativelist { class HybridNativeListSpec; }
13
+
14
+ // Forward declarations of Swift defined types
15
+ // Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
16
+ namespace NativeListModule { class HybridNativeListSpec_cxx; }
17
+
18
+ // Include C++ defined types
19
+ #include "HybridNativeListSpec.hpp"
20
+ #include <NitroModules/Result.hpp>
21
+ #include <exception>
22
+ #include <functional>
23
+ #include <memory>
24
+ #include <optional>
25
+ #include <string>
26
+
27
+ /**
28
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
29
+ * as well as helper functions to interact with those C++ types from Swift.
30
+ */
31
+ namespace margelo::nitro::nativelist::bridge::swift {
32
+
33
+ // pragma MARK: std::function<void(const std::string& /* payloadJson */)>
34
+ /**
35
+ * Specialized version of `std::function<void(const std::string&)>`.
36
+ */
37
+ using Func_void_std__string = std::function<void(const std::string& /* payloadJson */)>;
38
+ /**
39
+ * Wrapper class for a `std::function<void(const std::string& / * payloadJson * /)>`, this can be used from Swift.
40
+ */
41
+ class Func_void_std__string_Wrapper final {
42
+ public:
43
+ explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* payloadJson */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* payloadJson */)>>(std::move(func))) {}
44
+ inline void call(std::string payloadJson) const noexcept {
45
+ _function->operator()(payloadJson);
46
+ }
47
+ private:
48
+ std::unique_ptr<std::function<void(const std::string& /* payloadJson */)>> _function;
49
+ } SWIFT_NONCOPYABLE;
50
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
51
+ inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
52
+ return Func_void_std__string_Wrapper(std::move(value));
53
+ }
54
+
55
+ // pragma MARK: std::optional<std::function<void(const std::string& /* payloadJson */)>>
56
+ /**
57
+ * Specialized version of `std::optional<std::function<void(const std::string& / * payloadJson * /)>>`.
58
+ */
59
+ using std__optional_std__function_void_const_std__string_____payloadJson______ = std::optional<std::function<void(const std::string& /* payloadJson */)>>;
60
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> create_std__optional_std__function_void_const_std__string_____payloadJson______(const std::function<void(const std::string& /* payloadJson */)>& value) noexcept {
61
+ return std::optional<std::function<void(const std::string& /* payloadJson */)>>(value);
62
+ }
63
+ inline bool has_value_std__optional_std__function_void_const_std__string_____payloadJson______(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& optional) noexcept {
64
+ return optional.has_value();
65
+ }
66
+ inline std::function<void(const std::string& /* payloadJson */)> get_std__optional_std__function_void_const_std__string_____payloadJson______(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& optional) noexcept {
67
+ return optional.value();
68
+ }
69
+
70
+ // pragma MARK: std::shared_ptr<HybridNativeListSpec>
71
+ /**
72
+ * Specialized version of `std::shared_ptr<HybridNativeListSpec>`.
73
+ */
74
+ using std__shared_ptr_HybridNativeListSpec_ = std::shared_ptr<HybridNativeListSpec>;
75
+ std::shared_ptr<HybridNativeListSpec> create_std__shared_ptr_HybridNativeListSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
76
+ void* NON_NULL get_std__shared_ptr_HybridNativeListSpec_(std__shared_ptr_HybridNativeListSpec_ cppType);
77
+
78
+ // pragma MARK: std::weak_ptr<HybridNativeListSpec>
79
+ using std__weak_ptr_HybridNativeListSpec_ = std::weak_ptr<HybridNativeListSpec>;
80
+ inline std__weak_ptr_HybridNativeListSpec_ weakify_std__shared_ptr_HybridNativeListSpec_(const std::shared_ptr<HybridNativeListSpec>& strong) noexcept { return strong; }
81
+
82
+ // pragma MARK: Result<void>
83
+ using Result_void_ = Result<void>;
84
+ inline Result_void_ create_Result_void_() noexcept {
85
+ return Result<void>::withValue();
86
+ }
87
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
88
+ return Result<void>::withError(error);
89
+ }
90
+
91
+ } // namespace margelo::nitro::nativelist::bridge::swift
@@ -0,0 +1,49 @@
1
+ ///
2
+ /// NativeListModule-Swift-Cxx-Umbrella.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridNativeListSpec` to properly resolve imports.
12
+ namespace margelo::nitro::nativelist { class HybridNativeListSpec; }
13
+ // Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
14
+ namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
15
+
16
+ // Include C++ defined types
17
+ #include "HybridNativeListSpec.hpp"
18
+ #include "NativeListScrollAlignment.hpp"
19
+ #include <NitroModules/Result.hpp>
20
+ #include <exception>
21
+ #include <functional>
22
+ #include <memory>
23
+ #include <optional>
24
+ #include <string>
25
+
26
+ // C++ helpers for Swift
27
+ #include "NativeListModule-Swift-Cxx-Bridge.hpp"
28
+
29
+ // Common C++ types used in Swift
30
+ #include <NitroModules/ArrayBufferHolder.hpp>
31
+ #include <NitroModules/AnyMapUtils.hpp>
32
+ #include <NitroModules/RuntimeError.hpp>
33
+ #include <NitroModules/DateToChronoDate.hpp>
34
+
35
+ // Forward declarations of Swift defined types
36
+ // Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
37
+ namespace NativeListModule { class HybridNativeListSpec_cxx; }
38
+
39
+ // Include Swift defined types
40
+ #if __has_include("NativeListModule-Swift.h")
41
+ // This header is generated by Xcode/Swift on every app build.
42
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NativeListModule".
43
+ #include "NativeListModule-Swift.h"
44
+ // Same as above, but used when building with frameworks (`use_frameworks`)
45
+ #elif __has_include(<NativeListModule/NativeListModule-Swift.h>)
46
+ #include <NativeListModule/NativeListModule-Swift.h>
47
+ #else
48
+ #error NativeListModule's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NativeListModule", and try building the app first.
49
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// NativeListModuleAutolinking.mm
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
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "NativeListModule-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridNativeListSpecSwift.hpp"
14
+
15
+ @interface NativeListModuleAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation NativeListModuleAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::nativelist;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "NativeList",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridNativeListSpec> hybridObject = NativeListModule::NativeListModuleAutolinking::createNativeList();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// NativeListModuleAutolinking.swift
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
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class NativeListModuleAutolinking {
13
+ public typealias bridge = margelo.nitro.nativelist.bridge.swift
14
+
15
+ public static func createNativeList() -> bridge.std__shared_ptr_HybridNativeListSpec_ {
16
+ let hybridObject = HybridNativeList()
17
+ return { () -> bridge.std__shared_ptr_HybridNativeListSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isNativeListRecyclable() -> Bool {
24
+ return HybridNativeList.self is any RecyclableView.Type
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridNativeListSpecSwift.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 "HybridNativeListSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::nativelist {
11
+ } // namespace margelo::nitro::nativelist
@@ -0,0 +1,180 @@
1
+ ///
2
+ /// HybridNativeListSpecSwift.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 "HybridNativeListSpec.hpp"
11
+
12
+ // Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
13
+ namespace NativeListModule { class HybridNativeListSpec_cxx; }
14
+
15
+ // Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
16
+ namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
17
+
18
+ #include <string>
19
+ #include <functional>
20
+ #include <optional>
21
+ #include "NativeListScrollAlignment.hpp"
22
+
23
+ #include "NativeListModule-Swift-Cxx-Umbrella.hpp"
24
+
25
+ namespace margelo::nitro::nativelist {
26
+
27
+ /**
28
+ * The C++ part of HybridNativeListSpec_cxx.swift.
29
+ *
30
+ * HybridNativeListSpecSwift (C++) accesses HybridNativeListSpec_cxx (Swift), and might
31
+ * contain some additional bridging code for C++ <> Swift interop.
32
+ *
33
+ * Since this obviously introduces an overhead, I hope at some point in
34
+ * the future, HybridNativeListSpec_cxx can directly inherit from the C++ class HybridNativeListSpec
35
+ * to simplify the whole structure and memory management.
36
+ */
37
+ class HybridNativeListSpecSwift: public virtual HybridNativeListSpec {
38
+ public:
39
+ // Constructor from a Swift instance
40
+ explicit HybridNativeListSpecSwift(const NativeListModule::HybridNativeListSpec_cxx& swiftPart):
41
+ HybridObject(HybridNativeListSpec::TAG),
42
+ _swiftPart(swiftPart) { }
43
+
44
+ public:
45
+ // Get the Swift part
46
+ inline NativeListModule::HybridNativeListSpec_cxx& getSwiftPart() noexcept {
47
+ return _swiftPart;
48
+ }
49
+
50
+ public:
51
+ inline size_t getExternalMemorySize() noexcept override {
52
+ return _swiftPart.getMemorySize();
53
+ }
54
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
55
+ if (auto otherCast = std::dynamic_pointer_cast<HybridNativeListSpecSwift>(other)) {
56
+ return _swiftPart.equals(otherCast->_swiftPart);
57
+ }
58
+ return false;
59
+ }
60
+ void dispose() noexcept override {
61
+ _swiftPart.dispose();
62
+ }
63
+ std::string toString() override {
64
+ return _swiftPart.toString();
65
+ }
66
+
67
+ public:
68
+ // Properties
69
+ inline std::string getSnapshotJson() noexcept override {
70
+ auto __result = _swiftPart.getSnapshotJson();
71
+ return __result;
72
+ }
73
+ inline void setSnapshotJson(const std::string& snapshotJson) noexcept override {
74
+ _swiftPart.setSnapshotJson(snapshotJson);
75
+ }
76
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() noexcept override {
77
+ auto __result = _swiftPart.getOnRowAction();
78
+ return __result;
79
+ }
80
+ inline void setOnRowAction(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onRowAction) noexcept override {
81
+ _swiftPart.setOnRowAction(onRowAction);
82
+ }
83
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnActionAnchorInvalidated() noexcept override {
84
+ auto __result = _swiftPart.getOnActionAnchorInvalidated();
85
+ return __result;
86
+ }
87
+ inline void setOnActionAnchorInvalidated(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onActionAnchorInvalidated) noexcept override {
88
+ _swiftPart.setOnActionAnchorInvalidated(onActionAnchorInvalidated);
89
+ }
90
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnSelectionDelta() noexcept override {
91
+ auto __result = _swiftPart.getOnSelectionDelta();
92
+ return __result;
93
+ }
94
+ inline void setOnSelectionDelta(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onSelectionDelta) noexcept override {
95
+ _swiftPart.setOnSelectionDelta(onSelectionDelta);
96
+ }
97
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnReorder() noexcept override {
98
+ auto __result = _swiftPart.getOnReorder();
99
+ return __result;
100
+ }
101
+ inline void setOnReorder(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onReorder) noexcept override {
102
+ _swiftPart.setOnReorder(onReorder);
103
+ }
104
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnEndReached() noexcept override {
105
+ auto __result = _swiftPart.getOnEndReached();
106
+ return __result;
107
+ }
108
+ inline void setOnEndReached(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onEndReached) noexcept override {
109
+ _swiftPart.setOnEndReached(onEndReached);
110
+ }
111
+ inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnVisibleRangeChanged() noexcept override {
112
+ auto __result = _swiftPart.getOnVisibleRangeChanged();
113
+ return __result;
114
+ }
115
+ inline void setOnVisibleRangeChanged(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onVisibleRangeChanged) noexcept override {
116
+ _swiftPart.setOnVisibleRangeChanged(onVisibleRangeChanged);
117
+ }
118
+
119
+ public:
120
+ // Methods
121
+ inline void applySnapshot(const std::string& snapshotJson) override {
122
+ auto __result = _swiftPart.applySnapshot(snapshotJson);
123
+ if (__result.hasError()) [[unlikely]] {
124
+ std::rethrow_exception(__result.error());
125
+ }
126
+ }
127
+ inline void applyPatches(const std::string& patchesJson) override {
128
+ auto __result = _swiftPart.applyPatches(patchesJson);
129
+ if (__result.hasError()) [[unlikely]] {
130
+ std::rethrow_exception(__result.error());
131
+ }
132
+ }
133
+ inline void reconcileSelection(const std::string& selectedKeysJson) override {
134
+ auto __result = _swiftPart.reconcileSelection(selectedKeysJson);
135
+ if (__result.hasError()) [[unlikely]] {
136
+ std::rethrow_exception(__result.error());
137
+ }
138
+ }
139
+ inline void scrollToKey(const std::string& key, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) override {
140
+ auto __result = _swiftPart.scrollToKey(key, std::forward<decltype(animated)>(animated), static_cast<int>(alignment), std::forward<decltype(viewPosition)>(viewPosition), std::forward<decltype(viewOffset)>(viewOffset));
141
+ if (__result.hasError()) [[unlikely]] {
142
+ std::rethrow_exception(__result.error());
143
+ }
144
+ }
145
+ inline void scrollToIndex(double index, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) override {
146
+ auto __result = _swiftPart.scrollToIndex(std::forward<decltype(index)>(index), std::forward<decltype(animated)>(animated), static_cast<int>(alignment), std::forward<decltype(viewPosition)>(viewPosition), std::forward<decltype(viewOffset)>(viewOffset));
147
+ if (__result.hasError()) [[unlikely]] {
148
+ std::rethrow_exception(__result.error());
149
+ }
150
+ }
151
+ inline void scrollToOffset(double offset, bool animated) override {
152
+ auto __result = _swiftPart.scrollToOffset(std::forward<decltype(offset)>(offset), std::forward<decltype(animated)>(animated));
153
+ if (__result.hasError()) [[unlikely]] {
154
+ std::rethrow_exception(__result.error());
155
+ }
156
+ }
157
+ inline void scrollToEnd(bool animated) override {
158
+ auto __result = _swiftPart.scrollToEnd(std::forward<decltype(animated)>(animated));
159
+ if (__result.hasError()) [[unlikely]] {
160
+ std::rethrow_exception(__result.error());
161
+ }
162
+ }
163
+ inline void setActionAnchorState(const std::string& stateJson) override {
164
+ auto __result = _swiftPart.setActionAnchorState(stateJson);
165
+ if (__result.hasError()) [[unlikely]] {
166
+ std::rethrow_exception(__result.error());
167
+ }
168
+ }
169
+ inline void setRefreshing(bool refreshing) override {
170
+ auto __result = _swiftPart.setRefreshing(std::forward<decltype(refreshing)>(refreshing));
171
+ if (__result.hasError()) [[unlikely]] {
172
+ std::rethrow_exception(__result.error());
173
+ }
174
+ }
175
+
176
+ private:
177
+ NativeListModule::HybridNativeListSpec_cxx _swiftPart;
178
+ };
179
+
180
+ } // namespace margelo::nitro::nativelist