@react-native-ohos/flash-list 1.6.4-rc.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 (298) hide show
  1. package/LICENSE +7 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +9 -0
  4. package/dist/AnimatedFlashList.d.ts +6 -0
  5. package/dist/AnimatedFlashList.d.ts.map +1 -0
  6. package/dist/AnimatedFlashList.js +8 -0
  7. package/dist/AnimatedFlashList.js.map +1 -0
  8. package/dist/FlashList.d.ts +126 -0
  9. package/dist/FlashList.d.ts.map +1 -0
  10. package/dist/FlashList.js +524 -0
  11. package/dist/FlashList.js.map +1 -0
  12. package/dist/FlashListProps.d.ts +256 -0
  13. package/dist/FlashListProps.d.ts.map +1 -0
  14. package/dist/FlashListProps.js +9 -0
  15. package/dist/FlashListProps.js.map +1 -0
  16. package/dist/GridLayoutProviderWithProps.d.ts +42 -0
  17. package/dist/GridLayoutProviderWithProps.d.ts.map +1 -0
  18. package/dist/GridLayoutProviderWithProps.js +115 -0
  19. package/dist/GridLayoutProviderWithProps.js.map +1 -0
  20. package/dist/MasonryFlashList.d.ts +51 -0
  21. package/dist/MasonryFlashList.d.ts.map +1 -0
  22. package/dist/MasonryFlashList.js +252 -0
  23. package/dist/MasonryFlashList.js.map +1 -0
  24. package/dist/PureComponentWrapper.d.ts +22 -0
  25. package/dist/PureComponentWrapper.d.ts.map +1 -0
  26. package/dist/PureComponentWrapper.js +37 -0
  27. package/dist/PureComponentWrapper.js.map +1 -0
  28. package/dist/__tests__/AverageWindow.test.d.ts +2 -0
  29. package/dist/__tests__/AverageWindow.test.d.ts.map +1 -0
  30. package/dist/__tests__/AverageWindow.test.js +69 -0
  31. package/dist/__tests__/AverageWindow.test.js.map +1 -0
  32. package/dist/__tests__/ContentContainerUtils.test.d.ts +2 -0
  33. package/dist/__tests__/ContentContainerUtils.test.d.ts.map +1 -0
  34. package/dist/__tests__/ContentContainerUtils.test.js +85 -0
  35. package/dist/__tests__/ContentContainerUtils.test.js.map +1 -0
  36. package/dist/__tests__/FlashList.test.d.ts +2 -0
  37. package/dist/__tests__/FlashList.test.d.ts.map +1 -0
  38. package/dist/__tests__/FlashList.test.js +792 -0
  39. package/dist/__tests__/FlashList.test.js.map +1 -0
  40. package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts +2 -0
  41. package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts.map +1 -0
  42. package/dist/__tests__/GridLayoutProviderWithProps.test.js +143 -0
  43. package/dist/__tests__/GridLayoutProviderWithProps.test.js.map +1 -0
  44. package/dist/__tests__/MasonryFlashList.test.d.ts +2 -0
  45. package/dist/__tests__/MasonryFlashList.test.d.ts.map +1 -0
  46. package/dist/__tests__/MasonryFlashList.test.js +254 -0
  47. package/dist/__tests__/MasonryFlashList.test.js.map +1 -0
  48. package/dist/__tests__/PlatformHelper.web.test.d.ts +2 -0
  49. package/dist/__tests__/PlatformHelper.web.test.d.ts.map +1 -0
  50. package/dist/__tests__/PlatformHelper.web.test.js +33 -0
  51. package/dist/__tests__/PlatformHelper.web.test.js.map +1 -0
  52. package/dist/__tests__/ViewabilityHelper.test.d.ts +2 -0
  53. package/dist/__tests__/ViewabilityHelper.test.d.ts.map +1 -0
  54. package/dist/__tests__/ViewabilityHelper.test.js +187 -0
  55. package/dist/__tests__/ViewabilityHelper.test.js.map +1 -0
  56. package/dist/__tests__/helpers/mountFlashList.d.ts +19 -0
  57. package/dist/__tests__/helpers/mountFlashList.d.ts.map +1 -0
  58. package/dist/__tests__/helpers/mountFlashList.js +44 -0
  59. package/dist/__tests__/helpers/mountFlashList.js.map +1 -0
  60. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts +18 -0
  61. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts.map +1 -0
  62. package/dist/__tests__/helpers/mountMasonryFlashList.js +49 -0
  63. package/dist/__tests__/helpers/mountMasonryFlashList.js.map +1 -0
  64. package/dist/__tests__/useBlankAreaTracker.test.d.ts +2 -0
  65. package/dist/__tests__/useBlankAreaTracker.test.d.ts.map +1 -0
  66. package/dist/__tests__/useBlankAreaTracker.test.js +177 -0
  67. package/dist/__tests__/useBlankAreaTracker.test.js.map +1 -0
  68. package/dist/benchmark/AutoScrollHelper.d.ts +18 -0
  69. package/dist/benchmark/AutoScrollHelper.d.ts.map +1 -0
  70. package/dist/benchmark/AutoScrollHelper.js +68 -0
  71. package/dist/benchmark/AutoScrollHelper.js.map +1 -0
  72. package/dist/benchmark/JSFPSMonitor.d.ts +23 -0
  73. package/dist/benchmark/JSFPSMonitor.d.ts.map +1 -0
  74. package/dist/benchmark/JSFPSMonitor.js +65 -0
  75. package/dist/benchmark/JSFPSMonitor.js.map +1 -0
  76. package/dist/benchmark/roundToDecimalPlaces.d.ts +2 -0
  77. package/dist/benchmark/roundToDecimalPlaces.d.ts.map +1 -0
  78. package/dist/benchmark/roundToDecimalPlaces.js +9 -0
  79. package/dist/benchmark/roundToDecimalPlaces.js.map +1 -0
  80. package/dist/benchmark/useBenchmark.d.ts +35 -0
  81. package/dist/benchmark/useBenchmark.d.ts.map +1 -0
  82. package/dist/benchmark/useBenchmark.js +167 -0
  83. package/dist/benchmark/useBenchmark.js.map +1 -0
  84. package/dist/benchmark/useBlankAreaTracker.d.ts +34 -0
  85. package/dist/benchmark/useBlankAreaTracker.d.ts.map +1 -0
  86. package/dist/benchmark/useBlankAreaTracker.js +67 -0
  87. package/dist/benchmark/useBlankAreaTracker.js.map +1 -0
  88. package/dist/benchmark/useDataMultiplier.d.ts +9 -0
  89. package/dist/benchmark/useDataMultiplier.d.ts.map +1 -0
  90. package/dist/benchmark/useDataMultiplier.js +25 -0
  91. package/dist/benchmark/useDataMultiplier.js.map +1 -0
  92. package/dist/benchmark/useFlatListBenchmark.d.ts +13 -0
  93. package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -0
  94. package/dist/benchmark/useFlatListBenchmark.js +100 -0
  95. package/dist/benchmark/useFlatListBenchmark.js.map +1 -0
  96. package/dist/errors/CustomError.d.ts +8 -0
  97. package/dist/errors/CustomError.d.ts.map +1 -0
  98. package/dist/errors/CustomError.js +14 -0
  99. package/dist/errors/CustomError.js.map +1 -0
  100. package/dist/errors/ExceptionList.d.ts +24 -0
  101. package/dist/errors/ExceptionList.d.ts.map +1 -0
  102. package/dist/errors/ExceptionList.js +26 -0
  103. package/dist/errors/ExceptionList.js.map +1 -0
  104. package/dist/errors/Warnings.d.ts +9 -0
  105. package/dist/errors/Warnings.d.ts.map +1 -0
  106. package/dist/errors/Warnings.js +13 -0
  107. package/dist/errors/Warnings.js.map +1 -0
  108. package/dist/fabric/AutoLayoutNativeComponent.d.ts +19 -0
  109. package/dist/fabric/AutoLayoutNativeComponent.d.ts.map +1 -0
  110. package/dist/fabric/AutoLayoutNativeComponent.js +29 -0
  111. package/dist/fabric/AutoLayoutNativeComponent.js.map +1 -0
  112. package/dist/fabric/CellContainerNativeComponent.d.ts +8 -0
  113. package/dist/fabric/CellContainerNativeComponent.d.ts.map +1 -0
  114. package/dist/fabric/CellContainerNativeComponent.js +29 -0
  115. package/dist/fabric/CellContainerNativeComponent.js.map +1 -0
  116. package/dist/index.d.ts +14 -0
  117. package/dist/index.d.ts.map +1 -0
  118. package/dist/index.js +32 -0
  119. package/dist/index.js.map +1 -0
  120. package/dist/native/auto-layout/AutoLayoutView.d.ts +22 -0
  121. package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -0
  122. package/dist/native/auto-layout/AutoLayoutView.js +48 -0
  123. package/dist/native/auto-layout/AutoLayoutView.js.map +1 -0
  124. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +4 -0
  125. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +1 -0
  126. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +6 -0
  127. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +1 -0
  128. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +5 -0
  129. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -0
  130. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts +4 -0
  131. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts.map +1 -0
  132. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js +29 -0
  133. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js.map +1 -0
  134. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +4 -0
  135. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +1 -0
  136. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +6 -0
  137. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +1 -0
  138. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +6 -0
  139. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +1 -0
  140. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +16 -0
  141. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +1 -0
  142. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +3 -0
  143. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js.map +1 -0
  144. package/dist/native/cell-container/CellContainer.android.d.ts +6 -0
  145. package/dist/native/cell-container/CellContainer.android.d.ts.map +1 -0
  146. package/dist/native/cell-container/CellContainer.android.js +9 -0
  147. package/dist/native/cell-container/CellContainer.android.js.map +1 -0
  148. package/dist/native/cell-container/CellContainer.d.ts +8 -0
  149. package/dist/native/cell-container/CellContainer.d.ts.map +1 -0
  150. package/dist/native/cell-container/CellContainer.harmony.d.ts +6 -0
  151. package/dist/native/cell-container/CellContainer.harmony.d.ts.map +1 -0
  152. package/dist/native/cell-container/CellContainer.harmony.js +32 -0
  153. package/dist/native/cell-container/CellContainer.harmony.js.map +1 -0
  154. package/dist/native/cell-container/CellContainer.ios.d.ts +6 -0
  155. package/dist/native/cell-container/CellContainer.ios.d.ts.map +1 -0
  156. package/dist/native/cell-container/CellContainer.ios.js +9 -0
  157. package/dist/native/cell-container/CellContainer.ios.js.map +1 -0
  158. package/dist/native/cell-container/CellContainer.js +11 -0
  159. package/dist/native/cell-container/CellContainer.js.map +1 -0
  160. package/dist/native/cell-container/CellContainer.web.d.ts +7 -0
  161. package/dist/native/cell-container/CellContainer.web.d.ts.map +1 -0
  162. package/dist/native/cell-container/CellContainer.web.js +13 -0
  163. package/dist/native/cell-container/CellContainer.web.js.map +1 -0
  164. package/dist/native/config/PlatformHelper.android.d.ts +26 -0
  165. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -0
  166. package/dist/native/config/PlatformHelper.android.js +23 -0
  167. package/dist/native/config/PlatformHelper.android.js.map +1 -0
  168. package/dist/native/config/PlatformHelper.d.ts +26 -0
  169. package/dist/native/config/PlatformHelper.d.ts.map +1 -0
  170. package/dist/native/config/PlatformHelper.harmony.d.ts +26 -0
  171. package/dist/native/config/PlatformHelper.harmony.d.ts.map +1 -0
  172. package/dist/native/config/PlatformHelper.harmony.js +22 -0
  173. package/dist/native/config/PlatformHelper.harmony.js.map +1 -0
  174. package/dist/native/config/PlatformHelper.ios.d.ts +26 -0
  175. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -0
  176. package/dist/native/config/PlatformHelper.ios.js +22 -0
  177. package/dist/native/config/PlatformHelper.ios.js.map +1 -0
  178. package/dist/native/config/PlatformHelper.js +23 -0
  179. package/dist/native/config/PlatformHelper.js.map +1 -0
  180. package/dist/native/config/PlatformHelper.web.d.ts +27 -0
  181. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -0
  182. package/dist/native/config/PlatformHelper.web.js +25 -0
  183. package/dist/native/config/PlatformHelper.web.js.map +1 -0
  184. package/dist/tsconfig.tsbuildinfo +1 -0
  185. package/dist/utils/AverageWindow.d.ts +21 -0
  186. package/dist/utils/AverageWindow.d.ts.map +1 -0
  187. package/dist/utils/AverageWindow.js +49 -0
  188. package/dist/utils/AverageWindow.js.map +1 -0
  189. package/dist/utils/ContentContainerUtils.d.ts +27 -0
  190. package/dist/utils/ContentContainerUtils.d.ts.map +1 -0
  191. package/dist/utils/ContentContainerUtils.js +48 -0
  192. package/dist/utils/ContentContainerUtils.js.map +1 -0
  193. package/dist/viewability/ViewToken.d.ts +8 -0
  194. package/dist/viewability/ViewToken.d.ts.map +1 -0
  195. package/dist/viewability/ViewToken.js +3 -0
  196. package/dist/viewability/ViewToken.js.map +1 -0
  197. package/dist/viewability/ViewabilityHelper.d.ts +25 -0
  198. package/dist/viewability/ViewabilityHelper.d.ts.map +1 -0
  199. package/dist/viewability/ViewabilityHelper.js +104 -0
  200. package/dist/viewability/ViewabilityHelper.js.map +1 -0
  201. package/dist/viewability/ViewabilityManager.d.ts +24 -0
  202. package/dist/viewability/ViewabilityManager.d.ts.map +1 -0
  203. package/dist/viewability/ViewabilityManager.js +94 -0
  204. package/dist/viewability/ViewabilityManager.js.map +1 -0
  205. package/harmony/flash_list/BuildProfile.ets +5 -0
  206. package/harmony/flash_list/LICENSE +7 -0
  207. package/harmony/flash_list/build-profile.json5 +8 -0
  208. package/harmony/flash_list/hvigorfile.ts +1 -0
  209. package/harmony/flash_list/index.ets +29 -0
  210. package/harmony/flash_list/obfuscation-rules.txt +18 -0
  211. package/harmony/flash_list/oh-package-lock.json5 +17 -0
  212. package/harmony/flash_list/oh-package.json5 +13 -0
  213. package/harmony/flash_list/src/main/cpp/AutoLayoutNode.cpp +63 -0
  214. package/harmony/flash_list/src/main/cpp/AutoLayoutNode.h +57 -0
  215. package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.cpp +140 -0
  216. package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.h +66 -0
  217. package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.cpp +208 -0
  218. package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.h +78 -0
  219. package/harmony/flash_list/src/main/cpp/AutoLayoutViewEventEmitRequestHandler.h +53 -0
  220. package/harmony/flash_list/src/main/cpp/AutoLayoutViewJSIBinder.h +50 -0
  221. package/harmony/flash_list/src/main/cpp/CMakeLists.txt +7 -0
  222. package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.cpp +80 -0
  223. package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.h +67 -0
  224. package/harmony/flash_list/src/main/cpp/CellContainerJSIBinder.h +39 -0
  225. package/harmony/flash_list/src/main/cpp/ComponentDescriptors.h +40 -0
  226. package/harmony/flash_list/src/main/cpp/EventEmitters.cpp +40 -0
  227. package/harmony/flash_list/src/main/cpp/EventEmitters.h +48 -0
  228. package/harmony/flash_list/src/main/cpp/FlashListPackage.h +78 -0
  229. package/harmony/flash_list/src/main/cpp/FlashListStackNode.cpp +89 -0
  230. package/harmony/flash_list/src/main/cpp/FlashListStackNode.h +59 -0
  231. package/harmony/flash_list/src/main/cpp/Props.cpp +52 -0
  232. package/harmony/flash_list/src/main/cpp/Props.h +64 -0
  233. package/harmony/flash_list/src/main/cpp/ShadowNodes.cpp +34 -0
  234. package/harmony/flash_list/src/main/cpp/ShadowNodes.h +48 -0
  235. package/harmony/flash_list/src/main/ets/Logger.ets +64 -0
  236. package/harmony/flash_list/src/main/ets/RNAutoLayoutShadow.ets +154 -0
  237. package/harmony/flash_list/src/main/ets/RNAutoLayoutView.ets +252 -0
  238. package/harmony/flash_list/src/main/ets/RNCellContainer.ets +113 -0
  239. package/harmony/flash_list/src/main/module.json5 +7 -0
  240. package/harmony/flash_list/src/main/resources/base/element/color.json +8 -0
  241. package/harmony/flash_list/src/main/resources/base/element/string.json +16 -0
  242. package/harmony/flash_list/src/main/resources/base/media/icon.png +0 -0
  243. package/harmony/flash_list/src/main/resources/base/profile/main_pages.json +5 -0
  244. package/harmony/flash_list/src/main/resources/en_US/element/string.json +16 -0
  245. package/harmony/flash_list/src/main/resources/zh_CN/element/string.json +16 -0
  246. package/harmony/flash_list.har +0 -0
  247. package/jestSetup.js +16 -0
  248. package/package.json +88 -0
  249. package/src/AnimatedFlashList.ts +11 -0
  250. package/src/FlashList.tsx +870 -0
  251. package/src/FlashListProps.ts +335 -0
  252. package/src/GridLayoutProviderWithProps.ts +180 -0
  253. package/src/MasonryFlashList.tsx +476 -0
  254. package/src/PureComponentWrapper.tsx +42 -0
  255. package/src/__tests__/AverageWindow.test.ts +80 -0
  256. package/src/__tests__/ContentContainerUtils.test.ts +130 -0
  257. package/src/__tests__/FlashList.test.tsx +886 -0
  258. package/src/__tests__/GridLayoutProviderWithProps.test.ts +179 -0
  259. package/src/__tests__/MasonryFlashList.test.ts +292 -0
  260. package/src/__tests__/PlatformHelper.web.test.ts +45 -0
  261. package/src/__tests__/ViewabilityHelper.test.ts +283 -0
  262. package/src/__tests__/helpers/mountFlashList.tsx +62 -0
  263. package/src/__tests__/helpers/mountMasonryFlashList.tsx +70 -0
  264. package/src/__tests__/useBlankAreaTracker.test.tsx +204 -0
  265. package/src/benchmark/AutoScrollHelper.ts +70 -0
  266. package/src/benchmark/JSFPSMonitor.ts +74 -0
  267. package/src/benchmark/roundToDecimalPlaces.ts +4 -0
  268. package/src/benchmark/useBenchmark.ts +240 -0
  269. package/src/benchmark/useBlankAreaTracker.ts +117 -0
  270. package/src/benchmark/useDataMultiplier.ts +19 -0
  271. package/src/benchmark/useFlatListBenchmark.ts +107 -0
  272. package/src/errors/CustomError.ts +10 -0
  273. package/src/errors/ExceptionList.ts +28 -0
  274. package/src/errors/Warnings.ts +15 -0
  275. package/src/fabric/AutoLayoutNativeComponent.ts +51 -0
  276. package/src/fabric/CellContainerNativeComponent.ts +34 -0
  277. package/src/index.ts +43 -0
  278. package/src/native/auto-layout/AutoLayoutView.tsx +73 -0
  279. package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +7 -0
  280. package/src/native/auto-layout/AutoLayoutViewNativeComponent.harmony.ts +30 -0
  281. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +7 -0
  282. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +7 -0
  283. package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +17 -0
  284. package/src/native/cell-container/CellContainer.android.ts +7 -0
  285. package/src/native/cell-container/CellContainer.harmony.ts +30 -0
  286. package/src/native/cell-container/CellContainer.ios.ts +6 -0
  287. package/src/native/cell-container/CellContainer.tsx +14 -0
  288. package/src/native/cell-container/CellContainer.web.tsx +9 -0
  289. package/src/native/config/PlatformHelper.android.ts +29 -0
  290. package/src/native/config/PlatformHelper.harmony.ts +51 -0
  291. package/src/native/config/PlatformHelper.ios.ts +28 -0
  292. package/src/native/config/PlatformHelper.ts +29 -0
  293. package/src/native/config/PlatformHelper.web.ts +34 -0
  294. package/src/utils/AverageWindow.ts +49 -0
  295. package/src/utils/ContentContainerUtils.ts +92 -0
  296. package/src/viewability/ViewToken.ts +7 -0
  297. package/src/viewability/ViewabilityHelper.ts +162 -0
  298. package/src/viewability/ViewabilityManager.ts +134 -0
@@ -0,0 +1,74 @@
1
+ import { roundToDecimalPlaces } from "./roundToDecimalPlaces";
2
+
3
+ /**
4
+ * Can be used to monitor JS thread performance
5
+ * Use startTracking() and stopAndGetData() to start and stop tracking
6
+ */
7
+ export class JSFPSMonitor {
8
+ private startTime = 0;
9
+ private frameCount = 0;
10
+ private timeWindow = {
11
+ frameCount: 0,
12
+ startTime: 0,
13
+ };
14
+
15
+ private minFPS = Number.MAX_SAFE_INTEGER;
16
+ private maxFPS = 0;
17
+ private averageFPS = 0;
18
+
19
+ private clearAnimationNumber = 0;
20
+
21
+ private measureLoop() {
22
+ // This looks weird but I'm avoiding a new closure
23
+ this.clearAnimationNumber = requestAnimationFrame(this.updateLoopCompute);
24
+ }
25
+
26
+ private updateLoopCompute = () => {
27
+ this.frameCount++;
28
+ const elapsedTime = (Date.now() - this.startTime) / 1000;
29
+ this.averageFPS = elapsedTime > 0 ? this.frameCount / elapsedTime : 0;
30
+
31
+ this.timeWindow.frameCount++;
32
+ const timeWindowElapsedTime =
33
+ (Date.now() - this.timeWindow.startTime) / 1000;
34
+ if (timeWindowElapsedTime >= 1) {
35
+ const timeWindowAverageFPS =
36
+ this.timeWindow.frameCount / timeWindowElapsedTime;
37
+ this.minFPS = Math.min(this.minFPS, timeWindowAverageFPS);
38
+ this.maxFPS = Math.max(this.maxFPS, timeWindowAverageFPS);
39
+ this.timeWindow.frameCount = 0;
40
+ this.timeWindow.startTime = Date.now();
41
+ }
42
+ this.measureLoop();
43
+ };
44
+
45
+ public startTracking() {
46
+ if (this.startTime !== 0) {
47
+ throw new Error(
48
+ "This FPS Monitor has already been run, please create a new instance"
49
+ );
50
+ }
51
+ this.startTime = Date.now();
52
+ this.timeWindow.startTime = Date.now();
53
+ this.measureLoop();
54
+ }
55
+
56
+ public stopAndGetData(): JSFPSResult {
57
+ cancelAnimationFrame(this.clearAnimationNumber);
58
+ if (this.minFPS === Number.MAX_SAFE_INTEGER) {
59
+ this.minFPS = this.averageFPS;
60
+ this.maxFPS = this.averageFPS;
61
+ }
62
+ return {
63
+ minFPS: roundToDecimalPlaces(this.minFPS, 1),
64
+ maxFPS: roundToDecimalPlaces(this.maxFPS, 1),
65
+ averageFPS: roundToDecimalPlaces(this.averageFPS, 1),
66
+ };
67
+ }
68
+ }
69
+
70
+ export interface JSFPSResult {
71
+ minFPS: number;
72
+ maxFPS: number;
73
+ averageFPS: number;
74
+ }
@@ -0,0 +1,4 @@
1
+ export function roundToDecimalPlaces(value: number, decimalPlaces: number) {
2
+ const multiplier = 10 ** decimalPlaces;
3
+ return Math.round(value * multiplier) / multiplier;
4
+ }
@@ -0,0 +1,240 @@
1
+ import React, { useEffect } from "react";
2
+
3
+ import FlashList from "../FlashList";
4
+
5
+ import { autoScroll, Cancellable } from "./AutoScrollHelper";
6
+ import { JSFPSMonitor, JSFPSResult } from "./JSFPSMonitor";
7
+ import { roundToDecimalPlaces } from "./roundToDecimalPlaces";
8
+ import {
9
+ BlankAreaTrackerResult,
10
+ useBlankAreaTracker,
11
+ } from "./useBlankAreaTracker";
12
+
13
+ export interface BenchmarkParams {
14
+ startDelayInMs?: number;
15
+
16
+ /**
17
+ * Can be used to increase or decrease speed of scrolling
18
+ */
19
+ speedMultiplier?: number;
20
+
21
+ /**
22
+ * Specify the number of times benchmark should repeat itself
23
+ */
24
+ repeatCount?: number;
25
+
26
+ /**
27
+ * When set to true, cumulative blank area will include sum of negative blank area values
28
+ * Blank area is negative when list is able to draw faster than the scroll speed.
29
+ */
30
+ sumNegativeBlankAreaValues?: boolean;
31
+ }
32
+
33
+ export interface BenchmarkResult {
34
+ js?: JSFPSResult;
35
+ interrupted: boolean;
36
+ suggestions: string[];
37
+ blankArea?: BlankAreaTrackerResult;
38
+ formattedString?: string;
39
+ }
40
+
41
+ /**
42
+ * Runs the benchmark on FlashList.
43
+ * Response object has a formatted string that can be printed to the console or shown as an alert.
44
+ * Result is posted to the callback method passed to the hook.
45
+ */
46
+
47
+ export function useBenchmark(
48
+ flashListRef: React.RefObject<FlashList<any>>,
49
+ callback: (benchmarkResult: BenchmarkResult) => void,
50
+ params: BenchmarkParams = {}
51
+ ) {
52
+ const [blankAreaResult, blankAreaTracker] = useBlankAreaTracker(
53
+ flashListRef,
54
+ undefined,
55
+ { sumNegativeValues: params.sumNegativeBlankAreaValues, startDelayInMs: 0 }
56
+ );
57
+ useEffect(() => {
58
+ const cancellable = new Cancellable();
59
+ const suggestions: string[] = [];
60
+ if (flashListRef.current) {
61
+ if (!(Number(flashListRef.current.props.data?.length) > 0)) {
62
+ throw new Error("Data is empty, cannot run benchmark");
63
+ }
64
+ }
65
+ const cancelTimeout = setTimeout(async () => {
66
+ const jsFPSMonitor = new JSFPSMonitor();
67
+ jsFPSMonitor.startTracking();
68
+ for (let i = 0; i < (params.repeatCount || 1); i++) {
69
+ await runScrollBenchmark(
70
+ flashListRef,
71
+ cancellable,
72
+ params.speedMultiplier || 1
73
+ );
74
+ }
75
+ const jsProfilerResponse = jsFPSMonitor.stopAndGetData();
76
+ if (jsProfilerResponse.averageFPS < 35) {
77
+ suggestions.push(
78
+ `Your average JS FPS is low. This can indicate that your components are doing too much work. Try to optimize your components and reduce re-renders if any`
79
+ );
80
+ }
81
+ computeSuggestions(flashListRef, suggestions);
82
+ const result: BenchmarkResult = generateResult(
83
+ jsProfilerResponse,
84
+ blankAreaResult,
85
+ suggestions,
86
+ cancellable
87
+ );
88
+ if (!cancellable.isCancelled()) {
89
+ result.formattedString = getFormattedString(result);
90
+ }
91
+ callback(result);
92
+ }, params.startDelayInMs || 3000);
93
+ return () => {
94
+ clearTimeout(cancelTimeout);
95
+ cancellable.cancel();
96
+ };
97
+ // eslint-disable-next-line react-hooks/exhaustive-deps
98
+ }, []);
99
+ return [blankAreaTracker];
100
+ }
101
+
102
+ export function getFormattedString(res: BenchmarkResult) {
103
+ return (
104
+ `Results:\n\n` +
105
+ `JS FPS: Avg: ${res.js?.averageFPS} | Min: ${res.js?.minFPS} | Max: ${res.js?.maxFPS}\n\n` +
106
+ `${
107
+ res.blankArea
108
+ ? `Blank Area: Max: ${res.blankArea?.maxBlankArea} Cumulative: ${res.blankArea?.cumulativeBlankArea}\n\n`
109
+ : ``
110
+ }` +
111
+ `${
112
+ res.suggestions.length > 0
113
+ ? `Suggestions:\n\n${res.suggestions
114
+ .map((value, index) => `${index + 1}. ${value}`)
115
+ .join("\n")}`
116
+ : ``
117
+ }`
118
+ );
119
+ }
120
+
121
+ function generateResult(
122
+ jsProfilerResponse: JSFPSResult,
123
+ blankAreaResult: BlankAreaTrackerResult,
124
+ suggestions: string[],
125
+ cancellable: Cancellable
126
+ ) {
127
+ return {
128
+ js: jsProfilerResponse,
129
+ blankArea:
130
+ blankAreaResult.maxBlankArea >= 0
131
+ ? {
132
+ maxBlankArea: roundToDecimalPlaces(blankAreaResult.maxBlankArea, 0),
133
+ cumulativeBlankArea: roundToDecimalPlaces(
134
+ blankAreaResult.cumulativeBlankArea,
135
+ 0
136
+ ),
137
+ }
138
+ : undefined,
139
+ suggestions,
140
+ interrupted: cancellable.isCancelled(),
141
+ };
142
+ }
143
+
144
+ /**
145
+ * Scrolls to the end of the list and then back to the top
146
+ */
147
+ async function runScrollBenchmark(
148
+ flashListRef: React.RefObject<FlashList<any> | null | undefined>,
149
+ cancellable: Cancellable,
150
+ scrollSpeedMultiplier: number
151
+ ): Promise<void> {
152
+ if (flashListRef.current) {
153
+ const horizontal = flashListRef.current.props.horizontal;
154
+ const rlv = flashListRef.current.recyclerlistview_unsafe;
155
+ if (rlv) {
156
+ const rlvSize = rlv.getRenderedSize();
157
+ const rlvContentSize = rlv.getContentDimension();
158
+
159
+ const fromX = 0;
160
+ const fromY = 0;
161
+ const toX = rlvContentSize.width - rlvSize.width;
162
+ const toY = rlvContentSize.height - rlvSize.height;
163
+
164
+ const scrollNow = (x: number, y: number) => {
165
+ flashListRef.current?.scrollToOffset({
166
+ offset: horizontal ? x : y,
167
+ animated: false,
168
+ });
169
+ };
170
+
171
+ await autoScroll(
172
+ scrollNow,
173
+ fromX,
174
+ fromY,
175
+ toX,
176
+ toY,
177
+ scrollSpeedMultiplier,
178
+ cancellable
179
+ );
180
+ await autoScroll(
181
+ scrollNow,
182
+ toX,
183
+ toY,
184
+ fromX,
185
+ fromY,
186
+ scrollSpeedMultiplier,
187
+ cancellable
188
+ );
189
+ }
190
+ }
191
+ }
192
+ function computeSuggestions(
193
+ flashListRef: React.RefObject<FlashList<any> | null | undefined>,
194
+ suggestions: string[]
195
+ ) {
196
+ if (flashListRef.current) {
197
+ if (flashListRef.current.props.data!!.length < 200) {
198
+ suggestions.push(
199
+ `Data count is low. Try to increase it to a large number (e.g 200) using the 'useDataMultiplier' hook.`
200
+ );
201
+ }
202
+ const distanceFromWindow = roundToDecimalPlaces(
203
+ flashListRef.current.firstItemOffset,
204
+ 0
205
+ );
206
+ if (
207
+ (flashListRef.current.props.estimatedFirstItemOffset || 0) !==
208
+ distanceFromWindow
209
+ ) {
210
+ suggestions.push(
211
+ `estimatedFirstItemOffset can be set to ${distanceFromWindow}`
212
+ );
213
+ }
214
+ const rlv = flashListRef.current.recyclerlistview_unsafe;
215
+ const horizontal = flashListRef.current.props.horizontal;
216
+ if (rlv) {
217
+ const sizeArray = rlv.props.dataProvider
218
+ .getAllData()
219
+ .map((_, index) =>
220
+ horizontal
221
+ ? rlv.getLayout?.(index)?.width || 0
222
+ : rlv.getLayout?.(index)?.height || 0
223
+ );
224
+ const averageSize = Math.round(
225
+ sizeArray.reduce((prev, current) => prev + current, 0) /
226
+ sizeArray.length
227
+ );
228
+ if (
229
+ Math.abs(
230
+ averageSize -
231
+ (flashListRef.current.props.estimatedItemSize ??
232
+ flashListRef.current.state.layoutProvider
233
+ .defaultEstimatedItemSize)
234
+ ) > 5
235
+ ) {
236
+ suggestions.push(`estimatedItemSize can be set to ${averageSize}`);
237
+ }
238
+ }
239
+ }
240
+ }
@@ -0,0 +1,117 @@
1
+ import React, { useCallback, useRef } from "react";
2
+ import { RecyclerListView, RecyclerListViewProps } from "recyclerlistview";
3
+
4
+ import { BlankAreaEvent } from "../native/auto-layout/AutoLayoutView";
5
+ import FlashList from "../FlashList";
6
+
7
+ export interface BlankAreaTrackerResult {
8
+ /**
9
+ * Max blank area displayed
10
+ */
11
+ maxBlankArea: number;
12
+ /**
13
+ * Sum of all blank area values across all frames
14
+ */
15
+ cumulativeBlankArea: number;
16
+ }
17
+ export interface BlankAreaTrackerConfig {
18
+ /**
19
+ * When set to true the hook will also sum all negative blank area values.
20
+ * Blank area is negative when list is able to draw faster than the scroll speed.
21
+ */
22
+ sumNegativeValues?: boolean;
23
+ /**
24
+ * By default, the hook ignores blank events for 1s after the list load. This value can be changed using this parameter.
25
+ * Please note that this duration kicks in after the list has loaded and not after the first scroll.
26
+ */
27
+ startDelayInMs?: number;
28
+ }
29
+
30
+ /**
31
+ * Can be used to track visible blank area in production
32
+ * @param flashListRef Ref to the FlashList component
33
+ * @param onBlankAreaChange This event handler will be called when the blank area changes
34
+ * @param config additional configuration for the blank area tracker
35
+ * @returns blankAreaTrackerResult - maxBlankArea, cumulativeBlankArea this object is mutated and kept up to date. Also returns a callback that needs to be forwarded to FlashList.
36
+ */
37
+ export function useBlankAreaTracker(
38
+ flashListRef: React.RefObject<FlashList<any> | null>,
39
+ onBlankAreaChange?: (value: BlankAreaTrackerResult) => void,
40
+ config?: BlankAreaTrackerConfig
41
+ ): [BlankAreaTrackerResult, (event: BlankAreaEvent) => void] {
42
+ const startDelay = config?.startDelayInMs ?? 1000;
43
+ const blankAreaResult = useRef({
44
+ maxBlankArea: 0,
45
+ cumulativeBlankArea: 0,
46
+ }).current;
47
+ const waitOperations = useRef({ inProgress: false, complete: false }).current;
48
+ const onBlankAreaChangeRef = useRef(onBlankAreaChange);
49
+ onBlankAreaChangeRef.current = onBlankAreaChange;
50
+
51
+ const blankAreaTracker = useCallback(
52
+ (event: BlankAreaEvent) => {
53
+ // we're ignoring some of the events that will be fired on list load
54
+ // initial events are fired on mount and thus, this won't lead to missing events during scroll
55
+ if (!waitOperations.complete && startDelay > 0) {
56
+ if (!waitOperations.inProgress) {
57
+ waitOperations.inProgress = true;
58
+ setTimeout(() => {
59
+ waitOperations.complete = true;
60
+ }, startDelay);
61
+ }
62
+ return;
63
+ }
64
+ const rlv = flashListRef.current?.recyclerlistview_unsafe;
65
+ const horizontal = Boolean(flashListRef.current?.props.horizontal);
66
+ if (rlv) {
67
+ processBlankAreaChange(
68
+ rlv,
69
+ horizontal,
70
+ blankAreaResult,
71
+ event,
72
+ onBlankAreaChangeRef.current,
73
+ config
74
+ );
75
+ }
76
+ },
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ [flashListRef]
79
+ );
80
+ return [blankAreaResult, blankAreaTracker];
81
+ }
82
+
83
+ function processBlankAreaChange(
84
+ rlv: RecyclerListView<RecyclerListViewProps, any>,
85
+ horizontal: boolean,
86
+ blankAreaResult: BlankAreaTrackerResult,
87
+ event: BlankAreaEvent,
88
+ onBlankAreaChange?: (value: BlankAreaTrackerResult) => void,
89
+ config?: BlankAreaTrackerConfig
90
+ ) {
91
+ const listSize = horizontal
92
+ ? rlv.getRenderedSize().width
93
+ : rlv.getRenderedSize().height;
94
+ const contentSize = horizontal
95
+ ? rlv.getContentDimension().width
96
+ : rlv.getContentDimension().height;
97
+
98
+ // ignores blank events when there isn't enough content to fill the list
99
+ if (contentSize > listSize) {
100
+ const lastMaxBlankArea = blankAreaResult.maxBlankArea;
101
+ const lastCumulativeBlankArea = blankAreaResult.cumulativeBlankArea;
102
+ blankAreaResult.maxBlankArea = Math.max(
103
+ blankAreaResult.maxBlankArea,
104
+ event.blankArea,
105
+ 0
106
+ );
107
+ blankAreaResult.cumulativeBlankArea += config?.sumNegativeValues
108
+ ? event.blankArea
109
+ : Math.max(event.blankArea, 0);
110
+ if (
111
+ lastCumulativeBlankArea !== blankAreaResult.cumulativeBlankArea ||
112
+ lastMaxBlankArea !== blankAreaResult.maxBlankArea
113
+ ) {
114
+ onBlankAreaChange?.(blankAreaResult);
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Increases the data size by duplicating it, it's kept in hook format so that in future we can add auto pagination support.
3
+ * If you're using this with FlatList then make sure you remove `keyExtractor` because this method might duplicate ids that might be in the data.
4
+ * @param data The data to duplicate
5
+ * @param count Final count of data to be returned from this hook
6
+ * @returns Multiplied data.
7
+ */
8
+ export function useDataMultiplier<T>(data: T[], count: number): [T[]] {
9
+ const len = data.length;
10
+ const arr = new Array<T>(count);
11
+ let isObject = false;
12
+ if (typeof data[0] === "object") {
13
+ isObject = true;
14
+ }
15
+ for (let i = 0; i < count; i++) {
16
+ arr[i] = isObject ? { ...data[i % len] } : data[i % len];
17
+ }
18
+ return [arr];
19
+ }
@@ -0,0 +1,107 @@
1
+ import { useEffect } from "react";
2
+ import { FlatList } from "react-native";
3
+
4
+ import { autoScroll, Cancellable } from "./AutoScrollHelper";
5
+ import { JSFPSMonitor } from "./JSFPSMonitor";
6
+ import {
7
+ BenchmarkParams,
8
+ BenchmarkResult,
9
+ getFormattedString,
10
+ } from "./useBenchmark";
11
+
12
+ export interface FlatListBenchmarkParams extends BenchmarkParams {
13
+ targetOffset: number;
14
+ }
15
+
16
+ /**
17
+ * Runs the benchmark on FlatList and calls the callback method with the result.
18
+ * Target offset is mandatory in params.
19
+ * It's recommended to remove pagination while running the benchmark. Removing the onEndReached callback is the easiest way to do that.
20
+ */
21
+ export function useFlatListBenchmark(
22
+ flatListRef: React.RefObject<FlatList<any>>,
23
+ callback: (benchmarkResult: BenchmarkResult) => void,
24
+ params: FlatListBenchmarkParams
25
+ ) {
26
+ useEffect(() => {
27
+ const cancellable = new Cancellable();
28
+ if (flatListRef.current) {
29
+ if (!(Number(flatListRef.current.props.data?.length) > 0)) {
30
+ throw new Error("Data is empty, cannot run benchmark");
31
+ }
32
+ }
33
+ const cancelTimeout = setTimeout(async () => {
34
+ const jsFPSMonitor = new JSFPSMonitor();
35
+ jsFPSMonitor.startTracking();
36
+ for (let i = 0; i < (params.repeatCount || 1); i++) {
37
+ await runScrollBenchmark(
38
+ flatListRef,
39
+ params.targetOffset,
40
+ cancellable,
41
+ params.speedMultiplier || 1
42
+ );
43
+ }
44
+ const jsProfilerResponse = jsFPSMonitor.stopAndGetData();
45
+ const result: BenchmarkResult = {
46
+ js: jsProfilerResponse,
47
+ suggestions: [],
48
+ interrupted: cancellable.isCancelled(),
49
+ };
50
+ if (!cancellable.isCancelled()) {
51
+ result.formattedString = getFormattedString(result);
52
+ }
53
+ callback(result);
54
+ }, params.startDelayInMs || 3000);
55
+ return () => {
56
+ clearTimeout(cancelTimeout);
57
+ cancellable.cancel();
58
+ };
59
+ // eslint-disable-next-line react-hooks/exhaustive-deps
60
+ }, []);
61
+ return [];
62
+ }
63
+
64
+ /**
65
+ * Scrolls to the target offset and then back to 0
66
+ */
67
+ async function runScrollBenchmark(
68
+ flatListRef: React.RefObject<FlatList<any> | null | undefined>,
69
+ targetOffset: number,
70
+ cancellable: Cancellable,
71
+ scrollSpeedMultiplier: number
72
+ ): Promise<void> {
73
+ if (flatListRef.current) {
74
+ const horizontal = flatListRef.current.props.horizontal;
75
+
76
+ const fromX = 0;
77
+ const fromY = 0;
78
+ const toX = horizontal ? targetOffset : 0;
79
+ const toY = horizontal ? 0 : targetOffset;
80
+
81
+ const scrollNow = (x: number, y: number) => {
82
+ flatListRef.current?.scrollToOffset({
83
+ offset: horizontal ? x : y,
84
+ animated: false,
85
+ });
86
+ };
87
+
88
+ await autoScroll(
89
+ scrollNow,
90
+ fromX,
91
+ fromY,
92
+ toX,
93
+ toY,
94
+ scrollSpeedMultiplier,
95
+ cancellable
96
+ );
97
+ await autoScroll(
98
+ scrollNow,
99
+ toX,
100
+ toY,
101
+ fromX,
102
+ fromY,
103
+ scrollSpeedMultiplier,
104
+ cancellable
105
+ );
106
+ }
107
+ }
@@ -0,0 +1,10 @@
1
+ export default class CustomError extends Error {
2
+ constructor(exception: Exception) {
3
+ super(`${exception.type}: ${exception.message}`);
4
+ this.name = exception.type;
5
+ }
6
+ }
7
+ export interface Exception {
8
+ type: string;
9
+ message: string;
10
+ }
@@ -0,0 +1,28 @@
1
+ const ExceptionList = {
2
+ refreshBooleanMissing: {
3
+ message:
4
+ "`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `undefined`.",
5
+ type: "InvariantViolation",
6
+ },
7
+ stickyWhileHorizontalNotSupported: {
8
+ message:
9
+ "sticky headers are not supported when list is in horizontal mode. Remove `stickyHeaderIndices` prop.",
10
+ type: "NotSupportedException",
11
+ },
12
+ columnsWhileHorizontalNotSupported: {
13
+ message:
14
+ "numColumns is not supported when list is in horizontal mode. Please remove or set numColumns to 1.",
15
+ type: "NotSupportedException",
16
+ },
17
+ multipleViewabilityThresholdTypesNotSupported: {
18
+ message:
19
+ "You can set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold. Specifying both is not supported.",
20
+ type: "MultipleViewabilityThresholdTypesException",
21
+ },
22
+ overrideItemLayoutRequiredForMasonryOptimization: {
23
+ message:
24
+ "optimizeItemArrangement has been enabled on `MasonryFlashList` but overrideItemLayout is not set.",
25
+ type: "InvariantViolation",
26
+ },
27
+ };
28
+ export default ExceptionList;
@@ -0,0 +1,15 @@
1
+ const WarningList = {
2
+ styleUnsupported:
3
+ "You have passed a style to FlashList. This list doesn't support styling, use contentContainerStyle or wrap the list in a parent and apply style to it instead.",
4
+ styleContentContainerUnsupported:
5
+ "FlashList only supports padding related props and backgroundColor in contentContainerStyle. Please remove other values as they're not used.",
6
+ unusableRenderedSize:
7
+ "FlashList's rendered size is not usable. Either the height or width is too small (<2px). " +
8
+ "Please make sure that the parent view of the list has a valid size. FlashList will match the size of the parent.",
9
+ missingKeyExtractor:
10
+ "FlashList requires a keyExtractor prop to be defined when animating elements. Without it, the animations will not run as expected.",
11
+ estimatedItemSizeMissingWarning:
12
+ "estimatedItemSize FlashList prop is not defined - based on current configuration you can set it to @size to optimize list performance. " +
13
+ "Refer to FlashList documentation for more details.",
14
+ };
15
+ export default WarningList;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2023 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
25
+ import type { ViewProps, HostComponent } from "react-native";
26
+ import type {
27
+ Int32,
28
+ Double,
29
+ DirectEventHandler,
30
+ } from "react-native/Libraries/Types/CodegenTypes";
31
+
32
+ export type BlankAreaEvent = Readonly<{
33
+ offsetStart: Int32;
34
+ offsetEnd: Int32;
35
+ }>;
36
+
37
+ export type onBlankAreaEvent = DirectEventHandler<BlankAreaEvent>;
38
+
39
+ interface NativeProps extends ViewProps {
40
+ horizontal?: boolean;
41
+ scrollOffset?: Double;
42
+ windowSize?: Double;
43
+ renderAheadOffset?: Double;
44
+ enableInstrumentation?: boolean;
45
+ disableAutoLayout?: boolean;
46
+ onBlankAreaEvent?: DirectEventHandler<BlankAreaEvent>;
47
+ }
48
+
49
+ export default codegenNativeComponent<NativeProps>(
50
+ "AutoLayoutView"
51
+ ) as HostComponent<NativeProps>;