react-native-list 1.0.0 → 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 (200) hide show
  1. package/README.md +190 -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/ListView/__mocks__/ListViewMock.js +0 -55
  185. package/MetroListView.js +0 -166
  186. package/SectionList.js +0 -291
  187. package/ViewabilityHelper.js +0 -260
  188. package/VirtualizeUtils.js +0 -163
  189. package/VirtualizedList.js +0 -861
  190. package/VirtualizedSectionList.js +0 -397
  191. package/__flowtests__/FlatList-flowtest.js +0 -90
  192. package/__flowtests__/SectionList-flowtest.js +0 -89
  193. package/__tests__/FillRateHelper-test.js +0 -106
  194. package/__tests__/FlatList-test.js +0 -64
  195. package/__tests__/SectionList-test.js +0 -67
  196. package/__tests__/ViewabilityHelper-test.js +0 -359
  197. package/__tests__/VirtualizeUtils-test.js +0 -74
  198. package/__tests__/__snapshots__/FlatList-test.js.snap +0 -251
  199. package/__tests__/__snapshots__/SectionList-test.js.snap +0 -283
  200. package/index.js +0 -5
@@ -0,0 +1,140 @@
1
+ ///
2
+ /// HybridNativeLinearListLayoutSpec_cxx.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
+ /**
11
+ * A class implementation that bridges HybridNativeLinearListLayoutSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridNativeLinearListLayoutSpec_cxx : HybridNativeListLayoutSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativelist::bridge::swift`)
22
+ * from `ReactNativeList-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNativeLinearListLayoutSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNativeLinearListLayoutSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridNativeLinearListLayoutSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNativeLinearListLayoutSpec_cxx` that wraps the given `HybridNativeLinearListLayoutSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNativeLinearListLayoutSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ super.init(implementation)
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNativeLinearListLayoutSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNativeLinearListLayoutSpec() -> any HybridNativeLinearListLayoutSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public override func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridNativeLinearListLayoutSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNativeLinearListLayoutSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public override class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNativeLinearListLayoutSpec_cxx {
69
+ return Unmanaged<HybridNativeLinearListLayoutSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridNativeLinearListLayoutSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNativeLinearListLayoutSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNativeLinearListLayoutSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNativeLinearListLayoutSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+ public override func getCxxPart() -> bridge.std__shared_ptr_HybridNativeListLayoutSpec_ {
88
+ let ownCxxPart: bridge.std__shared_ptr_HybridNativeLinearListLayoutSpec_ = getCxxPart()
89
+ return bridge.upcast_NativeLinearListLayout_to_NativeListLayout(ownCxxPart)
90
+ }
91
+
92
+ /**
93
+ * Get the memory size of the Swift class (plus size of any other allocations)
94
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
95
+ */
96
+ @inline(__always)
97
+ public override var memorySize: Int {
98
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
99
+ }
100
+
101
+ /**
102
+ * Compares this object with the given [other] object for reference equality.
103
+ */
104
+ @inline(__always)
105
+ public func equals(other: HybridNativeLinearListLayoutSpec_cxx) -> Bool {
106
+ return self.__implementation === other.__implementation
107
+ }
108
+
109
+ /**
110
+ * Call dispose() on the Swift class.
111
+ * This _may_ be called manually from JS.
112
+ */
113
+ @inline(__always)
114
+ public override func dispose() {
115
+ self.__implementation.dispose()
116
+ }
117
+
118
+ /**
119
+ * Call toString() on the Swift class.
120
+ */
121
+ @inline(__always)
122
+ public override func toString() -> String {
123
+ return self.__implementation.toString()
124
+ }
125
+
126
+ // Properties
127
+
128
+
129
+ // Methods
130
+ @inline(__always)
131
+ public final func setConfig(config: NativeLinearListLayoutConfig) -> bridge.Result_void_ {
132
+ do {
133
+ try self.__implementation.setConfig(config: config)
134
+ return bridge.create_Result_void_()
135
+ } catch (let __error) {
136
+ let __exceptionPtr = __error.toCpp()
137
+ return bridge.create_Result_void_(__exceptionPtr)
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// HybridNativeListDataSourceSpec.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
+ /// See ``HybridNativeListDataSourceSpec``
11
+ public protocol HybridNativeListDataSourceSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func setContentEqualCallback(isContentEqual: @escaping (_ oldItem: NativeListItem, _ newItem: NativeListItem) -> Bool) throws -> Void
17
+ func replaceData(items: [NativeListItem], animated: Bool) throws -> Void
18
+ func insertItem(index: Double, item: NativeListItem) throws -> Void
19
+ func updateItem(index: Double, item: NativeListItem) throws -> Void
20
+ func removeItem(index: Double) throws -> Void
21
+ func moveItem(fromIndex: Double, toIndex: Double) throws -> Void
22
+ func getCount() throws -> Double
23
+ func getItem(index: Double) throws -> NativeListItem
24
+ }
25
+
26
+ public extension HybridNativeListDataSourceSpec_protocol {
27
+ /// Default implementation of ``HybridObject.toString``
28
+ func toString() -> String {
29
+ return "[HybridObject NativeListDataSource]"
30
+ }
31
+ }
32
+
33
+ /// See ``HybridNativeListDataSourceSpec``
34
+ open class HybridNativeListDataSourceSpec_base {
35
+ private weak var cxxWrapper: HybridNativeListDataSourceSpec_cxx? = nil
36
+ public init() { }
37
+ public func getCxxWrapper() -> HybridNativeListDataSourceSpec_cxx {
38
+ #if DEBUG
39
+ guard self is any HybridNativeListDataSourceSpec else {
40
+ fatalError("`self` is not a `HybridNativeListDataSourceSpec`! Did you accidentally inherit from `HybridNativeListDataSourceSpec_base` instead of `HybridNativeListDataSourceSpec`?")
41
+ }
42
+ #endif
43
+ if let cxxWrapper = self.cxxWrapper {
44
+ return cxxWrapper
45
+ } else {
46
+ let cxxWrapper = HybridNativeListDataSourceSpec_cxx(self as! any HybridNativeListDataSourceSpec)
47
+ self.cxxWrapper = cxxWrapper
48
+ return cxxWrapper
49
+ }
50
+ }
51
+ }
52
+
53
+ /**
54
+ * A Swift base-protocol representing the NativeListDataSource HybridObject.
55
+ * Implement this protocol to create Swift-based instances of NativeListDataSource.
56
+ * ```swift
57
+ * class HybridNativeListDataSource : HybridNativeListDataSourceSpec {
58
+ * // ...
59
+ * }
60
+ * ```
61
+ */
62
+ public typealias HybridNativeListDataSourceSpec = HybridNativeListDataSourceSpec_protocol & HybridNativeListDataSourceSpec_base
@@ -0,0 +1,222 @@
1
+ ///
2
+ /// HybridNativeListDataSourceSpec_cxx.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
+ /**
11
+ * A class implementation that bridges HybridNativeListDataSourceSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridNativeListDataSourceSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativelist::bridge::swift`)
22
+ * from `ReactNativeList-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNativeListDataSourceSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNativeListDataSourceSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridNativeListDataSourceSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNativeListDataSourceSpec_cxx` that wraps the given `HybridNativeListDataSourceSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNativeListDataSourceSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNativeListDataSourceSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNativeListDataSourceSpec() -> any HybridNativeListDataSourceSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridNativeListDataSourceSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNativeListDataSourceSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNativeListDataSourceSpec_cxx {
69
+ return Unmanaged<HybridNativeListDataSourceSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridNativeListDataSourceSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNativeListDataSourceSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNativeListDataSourceSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNativeListDataSourceSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridNativeListDataSourceSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+
125
+
126
+ // Methods
127
+ @inline(__always)
128
+ public final func setContentEqualCallback(isContentEqual: bridge.Func_bool_NativeListItem_NativeListItem) -> bridge.Result_void_ {
129
+ do {
130
+ try self.__implementation.setContentEqualCallback(isContentEqual: { () -> (NativeListItem, NativeListItem) -> Bool in
131
+ let __wrappedFunction = bridge.wrap_Func_bool_NativeListItem_NativeListItem(isContentEqual)
132
+ return { (__oldItem: NativeListItem, __newItem: NativeListItem) -> Bool in
133
+ let __result = __wrappedFunction.call(__oldItem, __newItem)
134
+ return __result
135
+ }
136
+ }())
137
+ return bridge.create_Result_void_()
138
+ } catch (let __error) {
139
+ let __exceptionPtr = __error.toCpp()
140
+ return bridge.create_Result_void_(__exceptionPtr)
141
+ }
142
+ }
143
+
144
+ @inline(__always)
145
+ public final func replaceData(items: bridge.std__vector_NativeListItem_, animated: Bool) -> bridge.Result_void_ {
146
+ do {
147
+ try self.__implementation.replaceData(items: items.map({ __item in __item }), animated: animated)
148
+ return bridge.create_Result_void_()
149
+ } catch (let __error) {
150
+ let __exceptionPtr = __error.toCpp()
151
+ return bridge.create_Result_void_(__exceptionPtr)
152
+ }
153
+ }
154
+
155
+ @inline(__always)
156
+ public final func insertItem(index: Double, item: NativeListItem) -> bridge.Result_void_ {
157
+ do {
158
+ try self.__implementation.insertItem(index: index, item: item)
159
+ return bridge.create_Result_void_()
160
+ } catch (let __error) {
161
+ let __exceptionPtr = __error.toCpp()
162
+ return bridge.create_Result_void_(__exceptionPtr)
163
+ }
164
+ }
165
+
166
+ @inline(__always)
167
+ public final func updateItem(index: Double, item: NativeListItem) -> bridge.Result_void_ {
168
+ do {
169
+ try self.__implementation.updateItem(index: index, item: item)
170
+ return bridge.create_Result_void_()
171
+ } catch (let __error) {
172
+ let __exceptionPtr = __error.toCpp()
173
+ return bridge.create_Result_void_(__exceptionPtr)
174
+ }
175
+ }
176
+
177
+ @inline(__always)
178
+ public final func removeItem(index: Double) -> bridge.Result_void_ {
179
+ do {
180
+ try self.__implementation.removeItem(index: index)
181
+ return bridge.create_Result_void_()
182
+ } catch (let __error) {
183
+ let __exceptionPtr = __error.toCpp()
184
+ return bridge.create_Result_void_(__exceptionPtr)
185
+ }
186
+ }
187
+
188
+ @inline(__always)
189
+ public final func moveItem(fromIndex: Double, toIndex: Double) -> bridge.Result_void_ {
190
+ do {
191
+ try self.__implementation.moveItem(fromIndex: fromIndex, toIndex: toIndex)
192
+ return bridge.create_Result_void_()
193
+ } catch (let __error) {
194
+ let __exceptionPtr = __error.toCpp()
195
+ return bridge.create_Result_void_(__exceptionPtr)
196
+ }
197
+ }
198
+
199
+ @inline(__always)
200
+ public final func getCount() -> bridge.Result_double_ {
201
+ do {
202
+ let __result = try self.__implementation.getCount()
203
+ let __resultCpp = __result
204
+ return bridge.create_Result_double_(__resultCpp)
205
+ } catch (let __error) {
206
+ let __exceptionPtr = __error.toCpp()
207
+ return bridge.create_Result_double_(__exceptionPtr)
208
+ }
209
+ }
210
+
211
+ @inline(__always)
212
+ public final func getItem(index: Double) -> bridge.Result_NativeListItem_ {
213
+ do {
214
+ let __result = try self.__implementation.getItem(index: index)
215
+ let __resultCpp = __result
216
+ return bridge.create_Result_NativeListItem_(__resultCpp)
217
+ } catch (let __error) {
218
+ let __exceptionPtr = __error.toCpp()
219
+ return bridge.create_Result_NativeListItem_(__exceptionPtr)
220
+ }
221
+ }
222
+ }
@@ -0,0 +1,55 @@
1
+ ///
2
+ /// HybridNativeListLayoutSpec.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
+ /// See ``HybridNativeListLayoutSpec``
11
+ public protocol HybridNativeListLayoutSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+
17
+ }
18
+
19
+ public extension HybridNativeListLayoutSpec_protocol {
20
+ /// Default implementation of ``HybridObject.toString``
21
+ func toString() -> String {
22
+ return "[HybridObject NativeListLayout]"
23
+ }
24
+ }
25
+
26
+ /// See ``HybridNativeListLayoutSpec``
27
+ open class HybridNativeListLayoutSpec_base {
28
+ private weak var cxxWrapper: HybridNativeListLayoutSpec_cxx? = nil
29
+ public init() { }
30
+ public func getCxxWrapper() -> HybridNativeListLayoutSpec_cxx {
31
+ #if DEBUG
32
+ guard self is any HybridNativeListLayoutSpec else {
33
+ fatalError("`self` is not a `HybridNativeListLayoutSpec`! Did you accidentally inherit from `HybridNativeListLayoutSpec_base` instead of `HybridNativeListLayoutSpec`?")
34
+ }
35
+ #endif
36
+ if let cxxWrapper = self.cxxWrapper {
37
+ return cxxWrapper
38
+ } else {
39
+ let cxxWrapper = HybridNativeListLayoutSpec_cxx(self as! any HybridNativeListLayoutSpec)
40
+ self.cxxWrapper = cxxWrapper
41
+ return cxxWrapper
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * A Swift base-protocol representing the NativeListLayout HybridObject.
48
+ * Implement this protocol to create Swift-based instances of NativeListLayout.
49
+ * ```swift
50
+ * class HybridNativeListLayout : HybridNativeListLayoutSpec {
51
+ * // ...
52
+ * }
53
+ * ```
54
+ */
55
+ public typealias HybridNativeListLayoutSpec = HybridNativeListLayoutSpec_protocol & HybridNativeListLayoutSpec_base
@@ -0,0 +1,128 @@
1
+ ///
2
+ /// HybridNativeListLayoutSpec_cxx.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
+ /**
11
+ * A class implementation that bridges HybridNativeListLayoutSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridNativeListLayoutSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativelist::bridge::swift`)
22
+ * from `ReactNativeList-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNativeListLayoutSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNativeListLayoutSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridNativeListLayoutSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNativeListLayoutSpec_cxx` that wraps the given `HybridNativeListLayoutSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNativeListLayoutSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNativeListLayoutSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNativeListLayoutSpec() -> any HybridNativeListLayoutSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridNativeListLayoutSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNativeListLayoutSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNativeListLayoutSpec_cxx {
69
+ return Unmanaged<HybridNativeListLayoutSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridNativeListLayoutSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNativeListLayoutSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNativeListLayoutSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNativeListLayoutSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridNativeListLayoutSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+
125
+
126
+ // Methods
127
+
128
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridUiListModuleSpec.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
+ /// See ``HybridUiListModuleSpec``
11
+ public protocol HybridUiListModuleSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func iosGetWorkletsModule() throws -> (any HybridIOSWorkletsModuleProxyHolderSpec)
17
+ func setupRuntime(workletsModuleHolder: Variant_NullType__any_HybridIOSWorkletsModuleProxyHolderSpec_?) throws -> Void
18
+ }
19
+
20
+ public extension HybridUiListModuleSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject UiListModule]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridUiListModuleSpec``
28
+ open class HybridUiListModuleSpec_base {
29
+ private weak var cxxWrapper: HybridUiListModuleSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridUiListModuleSpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridUiListModuleSpec else {
34
+ fatalError("`self` is not a `HybridUiListModuleSpec`! Did you accidentally inherit from `HybridUiListModuleSpec_base` instead of `HybridUiListModuleSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridUiListModuleSpec_cxx(self as! any HybridUiListModuleSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the UiListModule HybridObject.
49
+ * Implement this protocol to create Swift-based instances of UiListModule.
50
+ * ```swift
51
+ * class HybridUiListModule : HybridUiListModuleSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridUiListModuleSpec = HybridUiListModuleSpec_protocol & HybridUiListModuleSpec_base