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

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 (224) hide show
  1. package/README.md +186 -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/lib/ReactFabricMirror.d.ts +4 -0
  33. package/lib/ReactFabricMirror.js +515 -0
  34. package/lib/UiListModule.d.ts +2 -0
  35. package/lib/UiListModule.js +2 -0
  36. package/lib/index.d.ts +8 -0
  37. package/lib/index.js +21 -0
  38. package/lib/privateGlobals.d.ts +14 -0
  39. package/lib/privateGlobals.js +2 -0
  40. package/lib/renderer/RenderHelper.d.ts +2 -0
  41. package/lib/renderer/RenderHelper.js +11 -0
  42. package/lib/renderer/UiManagerHelper.d.ts +2 -0
  43. package/lib/renderer/UiManagerHelper.js +2 -0
  44. package/lib/renderer/fabric/RenderHelper.d.ts +2 -0
  45. package/lib/renderer/fabric/RenderHelper.js +11 -0
  46. package/lib/renderer/fabric/UiManagerHelper.d.ts +2 -0
  47. package/lib/renderer/fabric/UiManagerHelper.js +2 -0
  48. package/lib/renderer/react/ReactFabricMirror.d.ts +4 -0
  49. package/lib/renderer/react/ReactFabricMirror.js +515 -0
  50. package/lib/renderer/react/ReactFabricRenderer.d.ts +3 -0
  51. package/lib/renderer/react/ReactFabricRenderer.js +9 -0
  52. package/lib/specs/IOSWorkletsModuleProxyHolder.nitro.d.ts +6 -0
  53. package/lib/specs/IOSWorkletsModuleProxyHolder.nitro.js +1 -0
  54. package/lib/specs/UIListModule.nitro.d.ts +9 -0
  55. package/lib/specs/UIListModule.nitro.js +1 -0
  56. package/lib/specs/UIManagerHelper.nitro.d.ts +13 -0
  57. package/lib/specs/UIManagerHelper.nitro.js +1 -0
  58. package/lib/specs/UiListView.nitro.d.ts +20 -0
  59. package/lib/specs/UiListView.nitro.js +1 -0
  60. package/lib/specs/ViewHolder.nitro.d.ts +6 -0
  61. package/lib/specs/ViewHolder.nitro.js +1 -0
  62. package/lib/views/List.d.ts +35 -0
  63. package/lib/views/List.js +225 -0
  64. package/lib/views/UiListHostComponent.d.ts +2 -0
  65. package/lib/views/UiListHostComponent.js +3 -0
  66. package/metro/RendererProxyThreadSwitch.js +66 -0
  67. package/metro-config.d.ts +1 -0
  68. package/metro-config.js +124 -0
  69. package/nitro.json +47 -0
  70. package/nitrogen/generated/.gitattributes +1 -0
  71. package/nitrogen/generated/android/ReactNativeList+autolinking.cmake +99 -0
  72. package/nitrogen/generated/android/ReactNativeList+autolinking.gradle +27 -0
  73. package/nitrogen/generated/android/ReactNativeListOnLoad.cpp +156 -0
  74. package/nitrogen/generated/android/ReactNativeListOnLoad.hpp +34 -0
  75. package/nitrogen/generated/android/c++/JFunc_bool_NativeListItem_NativeListItem.hpp +83 -0
  76. package/nitrogen/generated/android/c++/JFunc_bool_double_NativeListItem_double.hpp +83 -0
  77. package/nitrogen/generated/android/c++/JFunc_double_std__string.hpp +78 -0
  78. package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.cpp +49 -0
  79. package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.hpp +63 -0
  80. package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.cpp +63 -0
  81. package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.hpp +65 -0
  82. package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.cpp +101 -0
  83. package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.hpp +70 -0
  84. package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.cpp +49 -0
  85. package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.hpp +63 -0
  86. package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.cpp +65 -0
  87. package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.hpp +64 -0
  88. package/nitrogen/generated/android/c++/JHybridUiListViewSpec.cpp +92 -0
  89. package/nitrogen/generated/android/c++/JHybridUiListViewSpec.hpp +67 -0
  90. package/nitrogen/generated/android/c++/JHybridViewHolderSpec.cpp +49 -0
  91. package/nitrogen/generated/android/c++/JHybridViewHolderSpec.hpp +63 -0
  92. package/nitrogen/generated/android/c++/JNativeItemSizeEstimate.hpp +61 -0
  93. package/nitrogen/generated/android/c++/JNativeLinearListLayoutConfig.hpp +81 -0
  94. package/nitrogen/generated/android/c++/JNativeLinearListLayoutIOSConfig.hpp +59 -0
  95. package/nitrogen/generated/android/c++/JNativeListItem.hpp +76 -0
  96. package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.cpp +26 -0
  97. package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.hpp +72 -0
  98. package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.cpp +53 -0
  99. package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.hpp +49 -0
  100. package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.cpp +53 -0
  101. package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.hpp +49 -0
  102. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_NativeListItem_NativeListItem.kt +80 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_double_NativeListItem_double.kt +80 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_double_std__string.kt +80 -0
  105. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridIOSWorkletsModuleProxyHolderSpec.kt +52 -0
  106. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeLinearListLayoutSpec.kt +54 -0
  107. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListDataSourceSpec.kt +87 -0
  108. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListLayoutSpec.kt +52 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListModuleSpec.kt +59 -0
  110. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListViewSpec.kt +76 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridViewHolderSpec.kt +53 -0
  112. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeItemSizeEstimate.kt +56 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutConfig.kt +76 -0
  114. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutIOSConfig.kt +51 -0
  115. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeListItem.kt +71 -0
  116. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/ReactNativeListOnLoad.kt +35 -0
  117. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.kt +62 -0
  118. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewManager.kt +80 -0
  119. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewStateUpdater.kt +23 -0
  120. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderManager.kt +80 -0
  121. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderStateUpdater.kt +23 -0
  122. package/nitrogen/generated/ios/ReactNativeList+autolinking.rb +62 -0
  123. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.cpp +162 -0
  124. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.hpp +368 -0
  125. package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Umbrella.hpp +92 -0
  126. package/nitrogen/generated/ios/ReactNativeListAutolinking.mm +83 -0
  127. package/nitrogen/generated/ios/ReactNativeListAutolinking.swift +86 -0
  128. package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.cpp +11 -0
  129. package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.hpp +75 -0
  130. package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.cpp +11 -0
  131. package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.hpp +92 -0
  132. package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.cpp +11 -0
  133. package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.hpp +132 -0
  134. package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.cpp +11 -0
  135. package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.hpp +75 -0
  136. package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.cpp +11 -0
  137. package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.hpp +93 -0
  138. package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.cpp +11 -0
  139. package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.hpp +121 -0
  140. package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.cpp +11 -0
  141. package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.hpp +75 -0
  142. package/nitrogen/generated/ios/c++/views/HybridUiListViewComponent.mm +118 -0
  143. package/nitrogen/generated/ios/c++/views/HybridViewHolderComponent.mm +118 -0
  144. package/nitrogen/generated/ios/swift/Func_bool_NativeListItem_NativeListItem.swift +47 -0
  145. package/nitrogen/generated/ios/swift/Func_bool_double_NativeListItem_double.swift +47 -0
  146. package/nitrogen/generated/ios/swift/Func_double_std__string.swift +47 -0
  147. package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec.swift +55 -0
  148. package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec_cxx.swift +128 -0
  149. package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec.swift +55 -0
  150. package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec_cxx.swift +140 -0
  151. package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec.swift +62 -0
  152. package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec_cxx.swift +222 -0
  153. package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec.swift +55 -0
  154. package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec_cxx.swift +128 -0
  155. package/nitrogen/generated/ios/swift/HybridUiListModuleSpec.swift +56 -0
  156. package/nitrogen/generated/ios/swift/HybridUiListModuleSpec_cxx.swift +175 -0
  157. package/nitrogen/generated/ios/swift/HybridUiListViewSpec.swift +59 -0
  158. package/nitrogen/generated/ios/swift/HybridUiListViewSpec_cxx.swift +227 -0
  159. package/nitrogen/generated/ios/swift/HybridViewHolderSpec.swift +55 -0
  160. package/nitrogen/generated/ios/swift/HybridViewHolderSpec_cxx.swift +147 -0
  161. package/nitrogen/generated/ios/swift/NativeItemSizeEstimate.swift +60 -0
  162. package/nitrogen/generated/ios/swift/NativeLinearListLayoutConfig.swift +60 -0
  163. package/nitrogen/generated/ios/swift/NativeLinearListLayoutIOSConfig.swift +35 -0
  164. package/nitrogen/generated/ios/swift/NativeListItem.swift +75 -0
  165. package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridIOSWorkletsModuleProxyHolderSpec_.swift +30 -0
  166. package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.cpp +21 -0
  167. package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.hpp +62 -0
  168. package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.cpp +22 -0
  169. package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.hpp +67 -0
  170. package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.cpp +28 -0
  171. package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.hpp +72 -0
  172. package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.cpp +21 -0
  173. package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.hpp +62 -0
  174. package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.cpp +22 -0
  175. package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.hpp +68 -0
  176. package/nitrogen/generated/shared/c++/HybridUiListViewSpec.cpp +25 -0
  177. package/nitrogen/generated/shared/c++/HybridUiListViewSpec.hpp +79 -0
  178. package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.cpp +23 -0
  179. package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.hpp +65 -0
  180. package/nitrogen/generated/shared/c++/HybridViewHolderSpec.cpp +21 -0
  181. package/nitrogen/generated/shared/c++/HybridViewHolderSpec.hpp +62 -0
  182. package/nitrogen/generated/shared/c++/NativeItemSizeEstimate.hpp +87 -0
  183. package/nitrogen/generated/shared/c++/NativeLinearListLayoutConfig.hpp +105 -0
  184. package/nitrogen/generated/shared/c++/NativeLinearListLayoutIOSConfig.hpp +85 -0
  185. package/nitrogen/generated/shared/c++/NativeListItem.hpp +101 -0
  186. package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.cpp +72 -0
  187. package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.hpp +109 -0
  188. package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.cpp +72 -0
  189. package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.hpp +109 -0
  190. package/nitrogen/generated/shared/json/UiListViewConfig.json +9 -0
  191. package/nitrogen/generated/shared/json/ViewHolderConfig.json +9 -0
  192. package/package.json +152 -5
  193. package/react-native.config.js +16 -0
  194. package/src/ListDataSource.ts +232 -0
  195. package/src/ListLayout.ts +95 -0
  196. package/src/UiListModule.ts +5 -0
  197. package/src/hooks/useChangeEffect.ts +50 -0
  198. package/src/index.tsx +49 -0
  199. package/src/privateGlobals.ts +20 -0
  200. package/src/renderer/fabric/RenderHelper.ts +29 -0
  201. package/src/renderer/fabric/UiManagerHelper.ts +5 -0
  202. package/src/renderer/react/ReactFabricMirror.bundle.js +1984 -0
  203. package/src/renderer/react/ReactFabricMirror.ts +766 -0
  204. package/src/renderer/react/ReactFabricRenderer.ts +11 -0
  205. package/src/specs/IOSWorkletsModuleProxyHolder.nitro.ts +6 -0
  206. package/src/specs/NativeLinearListLayout.nitro.ts +23 -0
  207. package/src/specs/NativeListDataSource.nitro.ts +28 -0
  208. package/src/specs/NativeListLayout.nitro.ts +6 -0
  209. package/src/specs/UIListModule.nitro.ts +13 -0
  210. package/src/specs/UIManagerHelper.nitro.ts +34 -0
  211. package/src/specs/UiListView.nitro.ts +31 -0
  212. package/src/specs/ViewHolder.nitro.ts +11 -0
  213. package/src/views/List.tsx +525 -0
  214. package/src/views/UiListHostComponent.ts +8 -0
  215. package/FillRateHelper.js +0 -179
  216. package/FlatList.js +0 -494
  217. package/LICENSE.md +0 -31
  218. package/MetroListView.js +0 -166
  219. package/SectionList.js +0 -291
  220. package/ViewabilityHelper.js +0 -260
  221. package/VirtualizeUtils.js +0 -163
  222. package/VirtualizedList.js +0 -861
  223. package/VirtualizedSectionList.js +0 -397
  224. package/index.js +0 -5
@@ -0,0 +1,53 @@
1
+ ///
2
+ /// HybridViewHolderSpec.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.HybridObject
14
+ import com.margelo.nitro.views.HybridView
15
+
16
+ /**
17
+ * A Kotlin class representing the ViewHolder HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of ViewHolder.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridViewHolderSpec: HybridView() {
28
+ // Properties
29
+
30
+
31
+ // Methods
32
+
33
+
34
+ // Default implementation of `HybridObject.toString()`
35
+ override fun toString(): String {
36
+ return "[HybridObject ViewHolder]"
37
+ }
38
+
39
+ // C++ backing class
40
+ @DoNotStrip
41
+ @Keep
42
+ protected open class CxxPart(javaPart: HybridViewHolderSpec): HybridObject.CxxPart(javaPart) {
43
+ // C++ JHybridViewHolderSpec::CxxPart::initHybrid(...)
44
+ external override fun initHybrid(): HybridData
45
+ }
46
+ override fun createCxxPart(): CxxPart {
47
+ return CxxPart(this)
48
+ }
49
+
50
+ companion object {
51
+ protected const val TAG = "HybridViewHolderSpec"
52
+ }
53
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// NativeItemSizeEstimate.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeItemSizeEstimate".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeItemSizeEstimate(
21
+ @DoNotStrip
22
+ @Keep
23
+ val width: Double?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val height: Double?
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is NativeItemSizeEstimate) return false
33
+ return Objects.deepEquals(this.width, other.width)
34
+ && Objects.deepEquals(this.height, other.height)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf(
39
+ width,
40
+ height
41
+ ).contentDeepHashCode()
42
+ }
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(width: Double?, height: Double?): NativeItemSizeEstimate {
53
+ return NativeItemSizeEstimate(width, height)
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// NativeLinearListLayoutConfig.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeLinearListLayoutConfig".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeLinearListLayoutConfig(
21
+ @DoNotStrip
22
+ @Keep
23
+ val topInset: Double,
24
+ @DoNotStrip
25
+ @Keep
26
+ val bottomInset: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val itemSpacing: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val itemHorizontalInset: Double,
33
+ @DoNotStrip
34
+ @Keep
35
+ val itemVerticalInset: Double,
36
+ @DoNotStrip
37
+ @Keep
38
+ val iosConfig: NativeLinearListLayoutIOSConfig?
39
+ ) {
40
+ /* primary constructor */
41
+
42
+ override fun equals(other: Any?): Boolean {
43
+ if (this === other) return true
44
+ if (other !is NativeLinearListLayoutConfig) return false
45
+ return Objects.deepEquals(this.topInset, other.topInset)
46
+ && Objects.deepEquals(this.bottomInset, other.bottomInset)
47
+ && Objects.deepEquals(this.itemSpacing, other.itemSpacing)
48
+ && Objects.deepEquals(this.itemHorizontalInset, other.itemHorizontalInset)
49
+ && Objects.deepEquals(this.itemVerticalInset, other.itemVerticalInset)
50
+ && Objects.deepEquals(this.iosConfig, other.iosConfig)
51
+ }
52
+
53
+ override fun hashCode(): Int {
54
+ return arrayOf(
55
+ topInset,
56
+ bottomInset,
57
+ itemSpacing,
58
+ itemHorizontalInset,
59
+ itemVerticalInset,
60
+ iosConfig
61
+ ).contentDeepHashCode()
62
+ }
63
+
64
+ companion object {
65
+ /**
66
+ * Constructor called from C++
67
+ */
68
+ @DoNotStrip
69
+ @Keep
70
+ @Suppress("unused")
71
+ @JvmStatic
72
+ private fun fromCpp(topInset: Double, bottomInset: Double, itemSpacing: Double, itemHorizontalInset: Double, itemVerticalInset: Double, iosConfig: NativeLinearListLayoutIOSConfig?): NativeLinearListLayoutConfig {
73
+ return NativeLinearListLayoutConfig(topInset, bottomInset, itemSpacing, itemHorizontalInset, itemVerticalInset, iosConfig)
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,51 @@
1
+ ///
2
+ /// NativeLinearListLayoutIOSConfig.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeLinearListLayoutIOSConfig".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeLinearListLayoutIOSConfig(
21
+ @DoNotStrip
22
+ @Keep
23
+ val estimatedItemSize: NativeItemSizeEstimate?
24
+ ) {
25
+ /* primary constructor */
26
+
27
+ override fun equals(other: Any?): Boolean {
28
+ if (this === other) return true
29
+ if (other !is NativeLinearListLayoutIOSConfig) return false
30
+ return Objects.deepEquals(this.estimatedItemSize, other.estimatedItemSize)
31
+ }
32
+
33
+ override fun hashCode(): Int {
34
+ return arrayOf(
35
+ estimatedItemSize
36
+ ).contentDeepHashCode()
37
+ }
38
+
39
+ companion object {
40
+ /**
41
+ * Constructor called from C++
42
+ */
43
+ @DoNotStrip
44
+ @Keep
45
+ @Suppress("unused")
46
+ @JvmStatic
47
+ private fun fromCpp(estimatedItemSize: NativeItemSizeEstimate?): NativeLinearListLayoutIOSConfig {
48
+ return NativeLinearListLayoutIOSConfig(estimatedItemSize)
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,71 @@
1
+ ///
2
+ /// NativeListItem.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+ import com.margelo.nitro.core.AnyMap
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeListItem".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeListItem(
21
+ @DoNotStrip
22
+ @Keep
23
+ val key: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val type: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val width: Double?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val height: Double?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val data: AnyMap
36
+ ) {
37
+ /* primary constructor */
38
+
39
+ override fun equals(other: Any?): Boolean {
40
+ if (this === other) return true
41
+ if (other !is NativeListItem) return false
42
+ return Objects.deepEquals(this.key, other.key)
43
+ && Objects.deepEquals(this.type, other.type)
44
+ && Objects.deepEquals(this.width, other.width)
45
+ && Objects.deepEquals(this.height, other.height)
46
+ && Objects.deepEquals(this.data, other.data)
47
+ }
48
+
49
+ override fun hashCode(): Int {
50
+ return arrayOf(
51
+ key,
52
+ type,
53
+ width,
54
+ height,
55
+ data
56
+ ).contentDeepHashCode()
57
+ }
58
+
59
+ companion object {
60
+ /**
61
+ * Constructor called from C++
62
+ */
63
+ @DoNotStrip
64
+ @Keep
65
+ @Suppress("unused")
66
+ @JvmStatic
67
+ private fun fromCpp(key: String, type: String, width: Double?, height: Double?, data: AnyMap): NativeListItem {
68
+ return NativeListItem(key, type, width, height, data)
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// ReactNativeListOnLoad.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import android.util.Log
11
+
12
+ internal class ReactNativeListOnLoad {
13
+ companion object {
14
+ private const val TAG = "ReactNativeListOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "ReactNativeList".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading ReactNativeList C++ library...")
25
+ System.loadLibrary("ReactNativeList")
26
+ Log.i(TAG, "Successfully loaded ReactNativeList C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load ReactNativeList C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.kt
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
+ package com.margelo.nitro.reactnativelist
9
+
10
+ import com.facebook.proguard.annotations.DoNotStrip
11
+ import com.margelo.nitro.core.NullType
12
+
13
+ /**
14
+ * Represents the TypeScript variant "NullType | HybridIOSWorkletsModuleProxyHolderSpec".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: HybridIOSWorkletsModuleProxyHolderSpec): Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec()
23
+
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (NullType) -> R, second: (HybridIOSWorkletsModuleProxyHolderSpec) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
38
+ }
39
+
40
+ val isFirst: Boolean
41
+ get() = this is First
42
+ val isSecond: Boolean
43
+ get() = this is Second
44
+
45
+ fun asFirstOrNull(): NullType? {
46
+ val value = (this as? First)?.value ?: return null
47
+ return value
48
+ }
49
+ fun asSecondOrNull(): HybridIOSWorkletsModuleProxyHolderSpec? {
50
+ val value = (this as? Second)?.value ?: return null
51
+ return value
52
+ }
53
+
54
+ companion object {
55
+ @JvmStatic
56
+ @DoNotStrip
57
+ fun create(value: NullType): Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec = First(value)
58
+ @JvmStatic
59
+ @DoNotStrip
60
+ fun create(value: HybridIOSWorkletsModuleProxyHolderSpec): Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec = Second(value)
61
+ }
62
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// HybridUiListViewManager.kt
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
+ package com.margelo.nitro.reactnativelist.views
9
+
10
+ import android.view.View
11
+ import com.facebook.react.uimanager.ReactStylesDiffMap
12
+ import com.facebook.react.uimanager.SimpleViewManager
13
+ import com.facebook.react.uimanager.StateWrapper
14
+ import com.facebook.react.uimanager.ThemedReactContext
15
+ import com.margelo.nitro.R.id.associated_hybrid_view_tag
16
+ import com.margelo.nitro.views.RecyclableView
17
+ import com.margelo.nitro.reactnativelist.*
18
+
19
+ /**
20
+ * Represents the React Native `ViewManager` for the "UiListView" Nitro HybridView.
21
+ */
22
+ public class HybridUiListViewManager: SimpleViewManager<View>() {
23
+ init {
24
+ if (RecyclableView::class.java.isAssignableFrom(HybridUiListView::class.java)) {
25
+ // Enable view recycling
26
+ super.setupViewRecycling()
27
+ }
28
+ }
29
+
30
+ override fun getName(): String {
31
+ return "UiListView"
32
+ }
33
+
34
+ override fun createViewInstance(reactContext: ThemedReactContext): View {
35
+ val hybridView = HybridUiListView(reactContext)
36
+ val view = hybridView.view
37
+ view.setTag(associated_hybrid_view_tag, hybridView)
38
+ return view
39
+ }
40
+
41
+ override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
42
+ val hybridView = getHybridView(view)
43
+ ?: throw Error("Couldn't find view $view in local views table!")
44
+
45
+ // 1. Update each prop individually
46
+ hybridView.beforeUpdate()
47
+ HybridUiListViewStateUpdater.updateViewProps(hybridView, stateWrapper)
48
+ hybridView.afterUpdate()
49
+
50
+ // 2. Continue in base View props
51
+ return super.updateState(view, props, stateWrapper)
52
+ }
53
+
54
+ override fun onDropViewInstance(view: View) {
55
+ val hybridView = getHybridView(view)
56
+ hybridView?.onDropView()
57
+ return super.onDropViewInstance(view)
58
+ }
59
+
60
+ protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
61
+ super.prepareToRecycleView(reactContext, view)
62
+ val hybridView = getHybridView(view)
63
+ ?: return null
64
+
65
+ @Suppress("USELESS_IS_CHECK")
66
+ if (hybridView is RecyclableView) {
67
+ // Recycle in it's implementation
68
+ hybridView.prepareForRecycle()
69
+
70
+ // Maybe update the view if it changed
71
+ return hybridView.view
72
+ } else {
73
+ return null
74
+ }
75
+ }
76
+
77
+ private fun getHybridView(view: View): HybridUiListView? {
78
+ return view.getTag(associated_hybrid_view_tag) as? HybridUiListView
79
+ }
80
+ }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HybridUiListViewStateUpdater.kt
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
+ package com.margelo.nitro.reactnativelist.views
9
+
10
+ import com.facebook.react.uimanager.StateWrapper
11
+ import com.margelo.nitro.reactnativelist.*
12
+
13
+ internal class HybridUiListViewStateUpdater {
14
+ companion object {
15
+ /**
16
+ * Updates the props for [view] through C++.
17
+ * The [state] prop is expected to contain [view]'s props as wrapped Fabric state.
18
+ */
19
+ @Suppress("KotlinJniMissingFunction")
20
+ @JvmStatic
21
+ external fun updateViewProps(view: HybridUiListViewSpec, state: StateWrapper)
22
+ }
23
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// HybridViewHolderManager.kt
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
+ package com.margelo.nitro.reactnativelist.views
9
+
10
+ import android.view.View
11
+ import com.facebook.react.uimanager.ReactStylesDiffMap
12
+ import com.facebook.react.uimanager.SimpleViewManager
13
+ import com.facebook.react.uimanager.StateWrapper
14
+ import com.facebook.react.uimanager.ThemedReactContext
15
+ import com.margelo.nitro.R.id.associated_hybrid_view_tag
16
+ import com.margelo.nitro.views.RecyclableView
17
+ import com.margelo.nitro.reactnativelist.*
18
+
19
+ /**
20
+ * Represents the React Native `ViewManager` for the "ViewHolder" Nitro HybridView.
21
+ */
22
+ public class HybridViewHolderManager: SimpleViewManager<View>() {
23
+ init {
24
+ if (RecyclableView::class.java.isAssignableFrom(HybridViewHolder::class.java)) {
25
+ // Enable view recycling
26
+ super.setupViewRecycling()
27
+ }
28
+ }
29
+
30
+ override fun getName(): String {
31
+ return "ViewHolder"
32
+ }
33
+
34
+ override fun createViewInstance(reactContext: ThemedReactContext): View {
35
+ val hybridView = HybridViewHolder(reactContext)
36
+ val view = hybridView.view
37
+ view.setTag(associated_hybrid_view_tag, hybridView)
38
+ return view
39
+ }
40
+
41
+ override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
42
+ val hybridView = getHybridView(view)
43
+ ?: throw Error("Couldn't find view $view in local views table!")
44
+
45
+ // 1. Update each prop individually
46
+ hybridView.beforeUpdate()
47
+ HybridViewHolderStateUpdater.updateViewProps(hybridView, stateWrapper)
48
+ hybridView.afterUpdate()
49
+
50
+ // 2. Continue in base View props
51
+ return super.updateState(view, props, stateWrapper)
52
+ }
53
+
54
+ override fun onDropViewInstance(view: View) {
55
+ val hybridView = getHybridView(view)
56
+ hybridView?.onDropView()
57
+ return super.onDropViewInstance(view)
58
+ }
59
+
60
+ protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
61
+ super.prepareToRecycleView(reactContext, view)
62
+ val hybridView = getHybridView(view)
63
+ ?: return null
64
+
65
+ @Suppress("USELESS_IS_CHECK")
66
+ if (hybridView is RecyclableView) {
67
+ // Recycle in it's implementation
68
+ hybridView.prepareForRecycle()
69
+
70
+ // Maybe update the view if it changed
71
+ return hybridView.view
72
+ } else {
73
+ return null
74
+ }
75
+ }
76
+
77
+ private fun getHybridView(view: View): HybridViewHolder? {
78
+ return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
79
+ }
80
+ }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HybridViewHolderStateUpdater.kt
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
+ package com.margelo.nitro.reactnativelist.views
9
+
10
+ import com.facebook.react.uimanager.StateWrapper
11
+ import com.margelo.nitro.reactnativelist.*
12
+
13
+ internal class HybridViewHolderStateUpdater {
14
+ companion object {
15
+ /**
16
+ * Updates the props for [view] through C++.
17
+ * The [state] prop is expected to contain [view]'s props as wrapped Fabric state.
18
+ */
19
+ @Suppress("KotlinJniMissingFunction")
20
+ @JvmStatic
21
+ external fun updateViewProps(view: HybridViewHolderSpec, state: StateWrapper)
22
+ }
23
+ }
@@ -0,0 +1,62 @@
1
+ #
2
+ # ReactNativeList+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/ReactNativeList+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ReactNativeList 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/ReactNativeList-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