@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,177 @@
1
+ ///
2
+ /// HybridNativeListSpec.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.nativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.HybridObject
15
+ import com.margelo.nitro.views.HybridView
16
+
17
+ /**
18
+ * A Kotlin class representing the NativeList HybridObject.
19
+ * Implement this abstract class to create Kotlin-based instances of NativeList.
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress(
24
+ "KotlinJniMissingFunction", "unused",
25
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
26
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
27
+ )
28
+ abstract class HybridNativeListSpec: HybridView() {
29
+ // Properties
30
+ @get:DoNotStrip
31
+ @get:Keep
32
+ @set:DoNotStrip
33
+ @set:Keep
34
+ abstract var snapshotJson: String
35
+
36
+ abstract var onRowAction: ((payloadJson: String) -> Unit)?
37
+
38
+ private var onRowAction_cxx: Func_void_std__string?
39
+ @Keep
40
+ @DoNotStrip
41
+ get() {
42
+ return onRowAction?.let { Func_void_std__string_java(it) }
43
+ }
44
+ @Keep
45
+ @DoNotStrip
46
+ set(value) {
47
+ onRowAction = value?.let { it }
48
+ }
49
+
50
+ abstract var onActionAnchorInvalidated: ((payloadJson: String) -> Unit)?
51
+
52
+ private var onActionAnchorInvalidated_cxx: Func_void_std__string?
53
+ @Keep
54
+ @DoNotStrip
55
+ get() {
56
+ return onActionAnchorInvalidated?.let { Func_void_std__string_java(it) }
57
+ }
58
+ @Keep
59
+ @DoNotStrip
60
+ set(value) {
61
+ onActionAnchorInvalidated = value?.let { it }
62
+ }
63
+
64
+ abstract var onSelectionDelta: ((payloadJson: String) -> Unit)?
65
+
66
+ private var onSelectionDelta_cxx: Func_void_std__string?
67
+ @Keep
68
+ @DoNotStrip
69
+ get() {
70
+ return onSelectionDelta?.let { Func_void_std__string_java(it) }
71
+ }
72
+ @Keep
73
+ @DoNotStrip
74
+ set(value) {
75
+ onSelectionDelta = value?.let { it }
76
+ }
77
+
78
+ abstract var onReorder: ((payloadJson: String) -> Unit)?
79
+
80
+ private var onReorder_cxx: Func_void_std__string?
81
+ @Keep
82
+ @DoNotStrip
83
+ get() {
84
+ return onReorder?.let { Func_void_std__string_java(it) }
85
+ }
86
+ @Keep
87
+ @DoNotStrip
88
+ set(value) {
89
+ onReorder = value?.let { it }
90
+ }
91
+
92
+ abstract var onEndReached: ((payloadJson: String) -> Unit)?
93
+
94
+ private var onEndReached_cxx: Func_void_std__string?
95
+ @Keep
96
+ @DoNotStrip
97
+ get() {
98
+ return onEndReached?.let { Func_void_std__string_java(it) }
99
+ }
100
+ @Keep
101
+ @DoNotStrip
102
+ set(value) {
103
+ onEndReached = value?.let { it }
104
+ }
105
+
106
+ abstract var onVisibleRangeChanged: ((payloadJson: String) -> Unit)?
107
+
108
+ private var onVisibleRangeChanged_cxx: Func_void_std__string?
109
+ @Keep
110
+ @DoNotStrip
111
+ get() {
112
+ return onVisibleRangeChanged?.let { Func_void_std__string_java(it) }
113
+ }
114
+ @Keep
115
+ @DoNotStrip
116
+ set(value) {
117
+ onVisibleRangeChanged = value?.let { it }
118
+ }
119
+
120
+ // Methods
121
+ @DoNotStrip
122
+ @Keep
123
+ abstract fun applySnapshot(snapshotJson: String): Unit
124
+
125
+ @DoNotStrip
126
+ @Keep
127
+ abstract fun applyPatches(patchesJson: String): Unit
128
+
129
+ @DoNotStrip
130
+ @Keep
131
+ abstract fun reconcileSelection(selectedKeysJson: String): Unit
132
+
133
+ @DoNotStrip
134
+ @Keep
135
+ abstract fun scrollToKey(key: String, animated: Boolean, alignment: NativeListScrollAlignment, viewPosition: Double, viewOffset: Double): Unit
136
+
137
+ @DoNotStrip
138
+ @Keep
139
+ abstract fun scrollToIndex(index: Double, animated: Boolean, alignment: NativeListScrollAlignment, viewPosition: Double, viewOffset: Double): Unit
140
+
141
+ @DoNotStrip
142
+ @Keep
143
+ abstract fun scrollToOffset(offset: Double, animated: Boolean): Unit
144
+
145
+ @DoNotStrip
146
+ @Keep
147
+ abstract fun scrollToEnd(animated: Boolean): Unit
148
+
149
+ @DoNotStrip
150
+ @Keep
151
+ abstract fun setActionAnchorState(stateJson: String): Unit
152
+
153
+ @DoNotStrip
154
+ @Keep
155
+ abstract fun setRefreshing(refreshing: Boolean): Unit
156
+
157
+ // Default implementation of `HybridObject.toString()`
158
+ override fun toString(): String {
159
+ return "[HybridObject NativeList]"
160
+ }
161
+
162
+ // C++ backing class
163
+ @DoNotStrip
164
+ @Keep
165
+ protected open class CxxPart(javaPart: HybridNativeListSpec): HybridObject.CxxPart(javaPart) {
166
+ // C++ JHybridNativeListSpec::CxxPart::initHybrid(...)
167
+ @FastNative
168
+ external override fun initHybrid(): HybridData
169
+ }
170
+ override fun createCxxPart(): CxxPart {
171
+ return CxxPart(this)
172
+ }
173
+
174
+ companion object {
175
+ protected const val TAG = "HybridNativeListSpec"
176
+ }
177
+ }
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// NativeListScrollAlignment.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.nativelist
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "NativeListScrollAlignment".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class NativeListScrollAlignment(@DoNotStrip @Keep val value: Int) {
19
+ START(0),
20
+ CENTER(1),
21
+ END(2),
22
+ NEAREST(3);
23
+
24
+ companion object
25
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// nativelistOnLoad.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.nativelist
9
+
10
+ import android.util.Log
11
+
12
+ internal class nativelistOnLoad {
13
+ companion object {
14
+ private const val TAG = "nativelistOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "nativelist".
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 nativelist C++ library...")
25
+ System.loadLibrary("nativelist")
26
+ Log.i(TAG, "Successfully loaded nativelist C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load nativelist 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,96 @@
1
+ ///
2
+ /// HybridNativeListManager.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.nativelist.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.nativelist.*
18
+
19
+ /**
20
+ * Represents the React Native `ViewManager` for the "NativeList" Nitro HybridView.
21
+ */
22
+ public class HybridNativeListManager: SimpleViewManager<View>() {
23
+ /**
24
+ * Represents the View and its last state snapshot (mutable)
25
+ */
26
+ private class HybridViewHolder(
27
+ val hybridView: HybridNativeList,
28
+ var lastState: StateWrapper? = null,
29
+ )
30
+
31
+ init {
32
+ if (RecyclableView::class.java.isAssignableFrom(HybridNativeList::class.java)) {
33
+ // Enable view recycling
34
+ super.setupViewRecycling()
35
+ }
36
+ }
37
+
38
+ override fun getName(): String {
39
+ return "NativeList"
40
+ }
41
+
42
+ override fun createViewInstance(reactContext: ThemedReactContext): View {
43
+ val hybridView = HybridNativeList(reactContext)
44
+ val view = hybridView.view
45
+ view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView))
46
+ return view
47
+ }
48
+
49
+ override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
50
+ val holder = getHybridViewHolder(view)
51
+ ?: throw Error("Couldn't find view $view in local views table!")
52
+ val hybridView = holder.hybridView
53
+ val oldState = holder.lastState
54
+ val newState = stateWrapper
55
+
56
+ // 1. Update each prop individually
57
+ hybridView.beforeUpdate()
58
+ HybridNativeListStateUpdater.updateViewProps(hybridView, newState, oldState)
59
+ hybridView.afterUpdate()
60
+ holder.lastState = newState
61
+
62
+ // 2. Continue in base View props
63
+ return super.updateState(view, props, newState)
64
+ }
65
+
66
+ override fun onDropViewInstance(view: View) {
67
+ val holder = getHybridViewHolder(view)
68
+ holder?.lastState = null
69
+ holder?.hybridView?.onDropView()
70
+ return super.onDropViewInstance(view)
71
+ }
72
+
73
+ protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
74
+ val preparedView = super.prepareToRecycleView(reactContext, view)
75
+ ?: return null
76
+ val holder = getHybridViewHolder(preparedView)
77
+ ?: return null
78
+ val hybridView = holder.hybridView
79
+ holder.lastState = null
80
+
81
+ @Suppress("USELESS_IS_CHECK")
82
+ if (hybridView is RecyclableView) {
83
+ // Recycle in it's implementation
84
+ hybridView.prepareForRecycle()
85
+
86
+ // Maybe update the view if it changed
87
+ return hybridView.view
88
+ } else {
89
+ return null
90
+ }
91
+ }
92
+
93
+ private fun getHybridViewHolder(view: View): HybridViewHolder? {
94
+ return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
95
+ }
96
+ }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HybridNativeListStateUpdater.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.nativelist.views
9
+
10
+ import com.facebook.react.uimanager.StateWrapper
11
+ import com.margelo.nitro.nativelist.*
12
+
13
+ internal class HybridNativeListStateUpdater {
14
+ companion object {
15
+ /**
16
+ * Updates the props for [view] through C++.
17
+ * The [newState] prop is expected to contain [view]'s props as wrapped Fabric state.
18
+ */
19
+ @Suppress("KotlinJniMissingFunction")
20
+ @JvmStatic
21
+ external fun updateViewProps(view: HybridNativeListSpec, newState: StateWrapper, oldState: StateWrapper?)
22
+ }
23
+ }
@@ -0,0 +1,83 @@
1
+ #
2
+ # nativelist+autolinking.cmake
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 CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/nativelist+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_NATIVELIST_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ nativelist PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/nativelistOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridNativeListSpec.cpp
37
+ ../nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp
38
+ # Android-specific Nitrogen C++ sources
39
+ ../nitrogen/generated/android/c++/JHybridNativeListSpec.cpp
40
+ ../nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp
41
+ )
42
+
43
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
44
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
45
+ target_compile_definitions(
46
+ nativelist PRIVATE
47
+ -DFOLLY_NO_CONFIG=1
48
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
49
+ -DFOLLY_USE_LIBCPP=1
50
+ -DFOLLY_CFG_NO_COROUTINES=1
51
+ -DFOLLY_MOBILE=1
52
+ -DFOLLY_HAVE_RECVMMSG=1
53
+ -DFOLLY_HAVE_PTHREAD=1
54
+ # Once we target android-23 above, we can comment
55
+ # the following line. NDK uses GNU style stderror_r() after API 23.
56
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
57
+ )
58
+
59
+ # Add all libraries required by the generated specs
60
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
61
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
62
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
63
+
64
+ # Link all libraries together
65
+ target_link_libraries(
66
+ nativelist
67
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
68
+ ReactAndroid::jsi # <-- RN: JSI
69
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
70
+ )
71
+
72
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
73
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
74
+ target_link_libraries(
75
+ nativelist
76
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
77
+ )
78
+ else()
79
+ target_link_libraries(
80
+ nativelist
81
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
82
+ )
83
+ endif()
@@ -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