@shopify/flash-list 2.0.2-rc.1 → 2.0.3

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 (291) hide show
  1. package/README.md +27 -97
  2. package/dist/AnimatedFlashList.js +2 -2
  3. package/dist/AnimatedFlashList.js.map +1 -1
  4. package/dist/FlashList.d.ts +1 -167
  5. package/dist/FlashList.d.ts.map +1 -1
  6. package/dist/FlashList.js +3 -595
  7. package/dist/FlashList.js.map +1 -1
  8. package/dist/FlashListProps.d.ts +2 -63
  9. package/dist/FlashListProps.d.ts.map +1 -1
  10. package/dist/FlashListProps.js.map +1 -1
  11. package/dist/__tests__/LayoutCommitObserver.test.js +6 -4
  12. package/dist/__tests__/LayoutCommitObserver.test.js.map +1 -1
  13. package/dist/__tests__/RecyclerView.test.js +2 -2
  14. package/dist/__tests__/RecyclerView.test.js.map +1 -1
  15. package/dist/__tests__/ViewabilityHelper.test.js +3 -4
  16. package/dist/__tests__/ViewabilityHelper.test.js.map +1 -1
  17. package/dist/benchmark/JSFPSMonitor.d.ts.map +1 -1
  18. package/dist/benchmark/JSFPSMonitor.js +2 -1
  19. package/dist/benchmark/JSFPSMonitor.js.map +1 -1
  20. package/dist/benchmark/useBenchmark.d.ts +2 -4
  21. package/dist/benchmark/useBenchmark.d.ts.map +1 -1
  22. package/dist/benchmark/useBenchmark.js +12 -24
  23. package/dist/benchmark/useBenchmark.js.map +1 -1
  24. package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
  25. package/dist/benchmark/useFlatListBenchmark.js +2 -1
  26. package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
  27. package/dist/errors/ErrorMessages.d.ts +16 -0
  28. package/dist/errors/ErrorMessages.d.ts.map +1 -0
  29. package/dist/errors/ErrorMessages.js +19 -0
  30. package/dist/errors/ErrorMessages.js.map +1 -0
  31. package/dist/errors/WarningMessages.d.ts +5 -0
  32. package/dist/errors/WarningMessages.d.ts.map +1 -0
  33. package/dist/errors/WarningMessages.js +9 -0
  34. package/dist/errors/WarningMessages.js.map +1 -0
  35. package/dist/index.d.ts +3 -9
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +7 -29
  38. package/dist/index.js.map +1 -1
  39. package/dist/isNewArch.d.ts +2 -0
  40. package/dist/isNewArch.d.ts.map +1 -0
  41. package/dist/isNewArch.js +25 -0
  42. package/dist/isNewArch.js.map +1 -0
  43. package/dist/native/config/PlatformHelper.android.d.ts +1 -22
  44. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
  45. package/dist/native/config/PlatformHelper.android.js +1 -16
  46. package/dist/native/config/PlatformHelper.android.js.map +1 -1
  47. package/dist/native/config/PlatformHelper.d.ts +1 -22
  48. package/dist/native/config/PlatformHelper.d.ts.map +1 -1
  49. package/dist/native/config/PlatformHelper.ios.d.ts +1 -22
  50. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
  51. package/dist/native/config/PlatformHelper.ios.js +1 -15
  52. package/dist/native/config/PlatformHelper.ios.js.map +1 -1
  53. package/dist/native/config/PlatformHelper.js +1 -16
  54. package/dist/native/config/PlatformHelper.js.map +1 -1
  55. package/dist/native/config/PlatformHelper.web.d.ts +1 -23
  56. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
  57. package/dist/native/config/PlatformHelper.web.js +1 -18
  58. package/dist/native/config/PlatformHelper.web.js.map +1 -1
  59. package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
  60. package/dist/recyclerview/RecyclerView.js +7 -1
  61. package/dist/recyclerview/RecyclerView.js.map +1 -1
  62. package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
  63. package/dist/recyclerview/RecyclerViewManager.js +9 -8
  64. package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
  65. package/dist/recyclerview/RecyclerViewProps.d.ts +1 -8
  66. package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -1
  67. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
  68. package/dist/recyclerview/hooks/useRecyclerViewController.js +4 -0
  69. package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
  70. package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -1
  71. package/dist/recyclerview/layout-managers/LayoutManager.js +2 -1
  72. package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -1
  73. package/dist/recyclerview/viewability/ViewToken.d.ts.map +1 -0
  74. package/dist/recyclerview/viewability/ViewToken.js.map +1 -0
  75. package/dist/{viewability → recyclerview/viewability}/ViewabilityHelper.d.ts +2 -2
  76. package/dist/recyclerview/viewability/ViewabilityHelper.d.ts.map +1 -0
  77. package/dist/{viewability → recyclerview/viewability}/ViewabilityHelper.js +2 -4
  78. package/dist/{viewability → recyclerview/viewability}/ViewabilityHelper.js.map +1 -1
  79. package/dist/{viewability → recyclerview/viewability}/ViewabilityManager.d.ts +3 -3
  80. package/dist/recyclerview/viewability/ViewabilityManager.d.ts.map +1 -0
  81. package/dist/{viewability → recyclerview/viewability}/ViewabilityManager.js +16 -16
  82. package/dist/recyclerview/viewability/ViewabilityManager.js.map +1 -0
  83. package/dist/tsconfig.tsbuildinfo +1 -1
  84. package/jestSetup.js +0 -9
  85. package/package.json +2 -11
  86. package/src/AnimatedFlashList.ts +2 -2
  87. package/src/FlashList.ts +1 -0
  88. package/src/FlashListProps.ts +3 -79
  89. package/src/__tests__/LayoutCommitObserver.test.tsx +7 -4
  90. package/src/__tests__/RecyclerView.test.tsx +2 -2
  91. package/src/__tests__/ViewabilityHelper.test.ts +13 -14
  92. package/src/benchmark/JSFPSMonitor.ts +3 -3
  93. package/src/benchmark/useBenchmark.ts +12 -40
  94. package/src/benchmark/useFlatListBenchmark.ts +3 -1
  95. package/src/errors/ErrorMessages.ts +26 -0
  96. package/src/errors/WarningMessages.ts +7 -0
  97. package/src/index.ts +7 -43
  98. package/src/isNewArch.ts +25 -0
  99. package/src/native/config/PlatformHelper.android.ts +1 -25
  100. package/src/native/config/PlatformHelper.ios.ts +1 -24
  101. package/src/native/config/PlatformHelper.ts +1 -25
  102. package/src/native/config/PlatformHelper.web.ts +1 -30
  103. package/src/recyclerview/RecyclerView.tsx +7 -3
  104. package/src/recyclerview/RecyclerViewManager.ts +9 -18
  105. package/src/recyclerview/RecyclerViewProps.ts +1 -11
  106. package/src/recyclerview/hooks/useRecyclerViewController.tsx +4 -0
  107. package/src/recyclerview/layout-managers/LayoutManager.ts +2 -1
  108. package/src/{viewability → recyclerview/viewability}/ViewabilityHelper.ts +8 -9
  109. package/src/{viewability → recyclerview/viewability}/ViewabilityManager.ts +18 -20
  110. package/RNFlashList.podspec +0 -37
  111. package/android/build.gradle +0 -89
  112. package/android/src/main/AndroidManifest.xml +0 -3
  113. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutShadow.kt +0 -105
  114. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt +0 -158
  115. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutViewManager.kt +0 -70
  116. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/BlankAreaEvent.kt +0 -29
  117. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainer.java +0 -16
  118. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainerImpl.kt +0 -16
  119. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainerManager.kt +0 -34
  120. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/FlashListPackage.kt +0 -19
  121. package/android/src/paper/java/com/facebook/react/viewmanagers/AutoLayoutViewManagerDelegate.java +0 -47
  122. package/android/src/paper/java/com/facebook/react/viewmanagers/AutoLayoutViewManagerInterface.java +0 -21
  123. package/android/src/paper/java/com/facebook/react/viewmanagers/CellContainerManagerDelegate.java +0 -32
  124. package/android/src/paper/java/com/facebook/react/viewmanagers/CellContainerManagerInterface.java +0 -16
  125. package/android/src/test/java/com/shopify/reactnative/flash_list/AutoLayoutShadowTest.kt +0 -147
  126. package/android/src/test/java/com/shopify/reactnative/flash_list/models/Rect.kt +0 -61
  127. package/android/src/test/java/com/shopify/reactnative/flash_list/models/TestCollection.kt +0 -6
  128. package/android/src/test/java/com/shopify/reactnative/flash_list/models/TestDataModel.kt +0 -8
  129. package/android/src/test/resources/LayoutTestData.json +0 -788
  130. package/dist/GridLayoutProviderWithProps.d.ts +0 -42
  131. package/dist/GridLayoutProviderWithProps.d.ts.map +0 -1
  132. package/dist/GridLayoutProviderWithProps.js +0 -114
  133. package/dist/GridLayoutProviderWithProps.js.map +0 -1
  134. package/dist/MasonryFlashList.d.ts +0 -51
  135. package/dist/MasonryFlashList.d.ts.map +0 -1
  136. package/dist/MasonryFlashList.js +0 -252
  137. package/dist/MasonryFlashList.js.map +0 -1
  138. package/dist/PureComponentWrapper.d.ts +0 -22
  139. package/dist/PureComponentWrapper.d.ts.map +0 -1
  140. package/dist/PureComponentWrapper.js +0 -37
  141. package/dist/PureComponentWrapper.js.map +0 -1
  142. package/dist/__tests__/ContentContainerUtils.test.d.ts +0 -2
  143. package/dist/__tests__/ContentContainerUtils.test.d.ts.map +0 -1
  144. package/dist/__tests__/ContentContainerUtils.test.js +0 -85
  145. package/dist/__tests__/ContentContainerUtils.test.js.map +0 -1
  146. package/dist/__tests__/FlashList.test.d.ts +0 -2
  147. package/dist/__tests__/FlashList.test.d.ts.map +0 -1
  148. package/dist/__tests__/FlashList.test.js +0 -902
  149. package/dist/__tests__/FlashList.test.js.map +0 -1
  150. package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts +0 -2
  151. package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts.map +0 -1
  152. package/dist/__tests__/GridLayoutProviderWithProps.test.js +0 -143
  153. package/dist/__tests__/GridLayoutProviderWithProps.test.js.map +0 -1
  154. package/dist/__tests__/MasonryFlashList.test.d.ts +0 -2
  155. package/dist/__tests__/MasonryFlashList.test.d.ts.map +0 -1
  156. package/dist/__tests__/MasonryFlashList.test.js +0 -254
  157. package/dist/__tests__/MasonryFlashList.test.js.map +0 -1
  158. package/dist/__tests__/PlatformHelper.web.test.d.ts +0 -2
  159. package/dist/__tests__/PlatformHelper.web.test.d.ts.map +0 -1
  160. package/dist/__tests__/PlatformHelper.web.test.js +0 -33
  161. package/dist/__tests__/PlatformHelper.web.test.js.map +0 -1
  162. package/dist/__tests__/helpers/mountFlashList.d.ts +0 -19
  163. package/dist/__tests__/helpers/mountFlashList.d.ts.map +0 -1
  164. package/dist/__tests__/helpers/mountFlashList.js +0 -44
  165. package/dist/__tests__/helpers/mountFlashList.js.map +0 -1
  166. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts +0 -18
  167. package/dist/__tests__/helpers/mountMasonryFlashList.d.ts.map +0 -1
  168. package/dist/__tests__/helpers/mountMasonryFlashList.js +0 -49
  169. package/dist/__tests__/helpers/mountMasonryFlashList.js.map +0 -1
  170. package/dist/__tests__/useBlankAreaTracker.test.d.ts +0 -2
  171. package/dist/__tests__/useBlankAreaTracker.test.d.ts.map +0 -1
  172. package/dist/__tests__/useBlankAreaTracker.test.js +0 -179
  173. package/dist/__tests__/useBlankAreaTracker.test.js.map +0 -1
  174. package/dist/benchmark/useBlankAreaTracker.d.ts +0 -34
  175. package/dist/benchmark/useBlankAreaTracker.d.ts.map +0 -1
  176. package/dist/benchmark/useBlankAreaTracker.js +0 -66
  177. package/dist/benchmark/useBlankAreaTracker.js.map +0 -1
  178. package/dist/enableNewCore.d.ts +0 -3
  179. package/dist/enableNewCore.d.ts.map +0 -1
  180. package/dist/enableNewCore.js +0 -25
  181. package/dist/enableNewCore.js.map +0 -1
  182. package/dist/errors/CustomError.d.ts +0 -8
  183. package/dist/errors/CustomError.d.ts.map +0 -1
  184. package/dist/errors/CustomError.js +0 -14
  185. package/dist/errors/CustomError.js.map +0 -1
  186. package/dist/errors/ExceptionList.d.ts +0 -24
  187. package/dist/errors/ExceptionList.d.ts.map +0 -1
  188. package/dist/errors/ExceptionList.js +0 -26
  189. package/dist/errors/ExceptionList.js.map +0 -1
  190. package/dist/errors/Warnings.d.ts +0 -9
  191. package/dist/errors/Warnings.d.ts.map +0 -1
  192. package/dist/errors/Warnings.js +0 -13
  193. package/dist/errors/Warnings.js.map +0 -1
  194. package/dist/native/auto-layout/AutoLayoutView.d.ts +0 -22
  195. package/dist/native/auto-layout/AutoLayoutView.d.ts.map +0 -1
  196. package/dist/native/auto-layout/AutoLayoutView.js +0 -48
  197. package/dist/native/auto-layout/AutoLayoutView.js.map +0 -1
  198. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +0 -4
  199. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +0 -1
  200. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +0 -6
  201. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +0 -1
  202. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +0 -5
  203. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +0 -1
  204. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +0 -4
  205. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +0 -1
  206. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +0 -6
  207. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +0 -1
  208. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +0 -6
  209. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +0 -1
  210. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +0 -16
  211. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +0 -1
  212. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +0 -3
  213. package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js.map +0 -1
  214. package/dist/native/cell-container/CellContainer.android.d.ts +0 -6
  215. package/dist/native/cell-container/CellContainer.android.d.ts.map +0 -1
  216. package/dist/native/cell-container/CellContainer.android.js +0 -9
  217. package/dist/native/cell-container/CellContainer.android.js.map +0 -1
  218. package/dist/native/cell-container/CellContainer.d.ts +0 -8
  219. package/dist/native/cell-container/CellContainer.d.ts.map +0 -1
  220. package/dist/native/cell-container/CellContainer.ios.d.ts +0 -6
  221. package/dist/native/cell-container/CellContainer.ios.d.ts.map +0 -1
  222. package/dist/native/cell-container/CellContainer.ios.js +0 -9
  223. package/dist/native/cell-container/CellContainer.ios.js.map +0 -1
  224. package/dist/native/cell-container/CellContainer.js +0 -11
  225. package/dist/native/cell-container/CellContainer.js.map +0 -1
  226. package/dist/native/cell-container/CellContainer.web.d.ts +0 -7
  227. package/dist/native/cell-container/CellContainer.web.d.ts.map +0 -1
  228. package/dist/native/cell-container/CellContainer.web.js +0 -13
  229. package/dist/native/cell-container/CellContainer.web.js.map +0 -1
  230. package/dist/specs/AutoLayoutNativeComponent.d.ts +0 -18
  231. package/dist/specs/AutoLayoutNativeComponent.d.ts.map +0 -1
  232. package/dist/specs/AutoLayoutNativeComponent.js +0 -6
  233. package/dist/specs/AutoLayoutNativeComponent.js.map +0 -1
  234. package/dist/specs/CellContainerNativeComponent.d.ts +0 -8
  235. package/dist/specs/CellContainerNativeComponent.d.ts.map +0 -1
  236. package/dist/specs/CellContainerNativeComponent.js +0 -6
  237. package/dist/specs/CellContainerNativeComponent.js.map +0 -1
  238. package/dist/utils/ContentContainerUtils.d.ts +0 -27
  239. package/dist/utils/ContentContainerUtils.d.ts.map +0 -1
  240. package/dist/utils/ContentContainerUtils.js +0 -48
  241. package/dist/utils/ContentContainerUtils.js.map +0 -1
  242. package/dist/viewability/ViewToken.d.ts.map +0 -1
  243. package/dist/viewability/ViewToken.js.map +0 -1
  244. package/dist/viewability/ViewabilityHelper.d.ts.map +0 -1
  245. package/dist/viewability/ViewabilityManager.d.ts.map +0 -1
  246. package/dist/viewability/ViewabilityManager.js.map +0 -1
  247. package/ios/RNFlashList.xcodeproj/project.pbxproj +0 -3
  248. package/ios/RNFlashList.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  249. package/ios/Sources/AutoLayoutView.swift +0 -294
  250. package/ios/Sources/AutoLayoutViewComponentView.h +0 -16
  251. package/ios/Sources/AutoLayoutViewComponentView.mm +0 -90
  252. package/ios/Sources/AutoLayoutViewManager.mm +0 -14
  253. package/ios/Sources/AutoLayoutViewManager.swift +0 -12
  254. package/ios/Sources/CellContainerComponentView.h +0 -18
  255. package/ios/Sources/CellContainerComponentView.mm +0 -62
  256. package/ios/Sources/CellContainerManager.mm +0 -8
  257. package/ios/Sources/CellContainerManager.swift +0 -12
  258. package/ios/Sources/FlatListPro-Bridging-Header.h +0 -11
  259. package/ios/Tests/AutoLayoutViewTests.swift +0 -113
  260. package/src/FlashList.tsx +0 -953
  261. package/src/GridLayoutProviderWithProps.ts +0 -180
  262. package/src/MasonryFlashList.tsx +0 -476
  263. package/src/PureComponentWrapper.tsx +0 -42
  264. package/src/__tests__/ContentContainerUtils.test.ts +0 -130
  265. package/src/__tests__/FlashList.test.tsx +0 -1001
  266. package/src/__tests__/GridLayoutProviderWithProps.test.ts +0 -179
  267. package/src/__tests__/MasonryFlashList.test.ts +0 -292
  268. package/src/__tests__/PlatformHelper.web.test.ts +0 -45
  269. package/src/__tests__/helpers/mountFlashList.tsx +0 -62
  270. package/src/__tests__/helpers/mountMasonryFlashList.tsx +0 -70
  271. package/src/__tests__/useBlankAreaTracker.test.tsx +0 -206
  272. package/src/benchmark/useBlankAreaTracker.ts +0 -117
  273. package/src/enableNewCore.ts +0 -24
  274. package/src/errors/CustomError.ts +0 -10
  275. package/src/errors/ExceptionList.ts +0 -28
  276. package/src/errors/Warnings.ts +0 -15
  277. package/src/native/auto-layout/AutoLayoutView.tsx +0 -73
  278. package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +0 -7
  279. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +0 -7
  280. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +0 -7
  281. package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +0 -17
  282. package/src/native/cell-container/CellContainer.android.ts +0 -7
  283. package/src/native/cell-container/CellContainer.ios.ts +0 -7
  284. package/src/native/cell-container/CellContainer.tsx +0 -14
  285. package/src/native/cell-container/CellContainer.web.tsx +0 -9
  286. package/src/specs/AutoLayoutNativeComponent.ts +0 -24
  287. package/src/specs/CellContainerNativeComponent.ts +0 -9
  288. package/src/utils/ContentContainerUtils.ts +0 -92
  289. /package/dist/{viewability → recyclerview/viewability}/ViewToken.d.ts +0 -0
  290. /package/dist/{viewability → recyclerview/viewability}/ViewToken.js +0 -0
  291. /package/src/{viewability → recyclerview/viewability}/ViewToken.ts +0 -0
@@ -6,8 +6,7 @@ import {
6
6
  ViewStyle,
7
7
  } from "react-native";
8
8
 
9
- import { BlankAreaEventHandler } from "./native/auto-layout/AutoLayoutView";
10
- import ViewToken from "./viewability/ViewToken";
9
+ import ViewToken from "./recyclerview/viewability/ViewToken";
11
10
 
12
11
  export interface ListRenderItemInfo<TItem> {
13
12
  item: TItem;
@@ -40,18 +39,6 @@ export type ListRenderItem<TItem> = (
40
39
  info: ListRenderItemInfo<TItem>
41
40
  ) => React.ReactElement | null;
42
41
 
43
- export type ContentStyle = Pick<
44
- ViewStyle,
45
- | "backgroundColor"
46
- | "paddingTop"
47
- | "paddingLeft"
48
- | "paddingRight"
49
- | "paddingBottom"
50
- | "padding"
51
- | "paddingVertical"
52
- | "paddingHorizontal"
53
- >;
54
-
55
42
  export interface ViewabilityConfigCallbackPair<TItem> {
56
43
  viewabilityConfig: ViewabilityConfig;
57
44
  onViewableItemsChanged:
@@ -89,14 +76,6 @@ export interface FlashListProps<TItem>
89
76
  */
90
77
  data: ReadonlyArray<TItem> | null | undefined;
91
78
 
92
- /**
93
- * Average or median size for elements in the list. Doesn't have to be very accurate but a good estimate can improve performance.
94
- * A quick look at `Element Inspector` can help you determine this. If you're confused between two values, the smaller value is a better choice.
95
- * For vertical lists provide average height and for horizontal average width.
96
- * Read more about it here: https://shopify.github.io/flash-list/docs/estimated-item-size
97
- */
98
- estimatedItemSize?: number;
99
-
100
79
  /**
101
80
  * Each cell is rendered using this element.
102
81
  * Can be a React Component Class, or a render function.
@@ -165,30 +144,11 @@ export interface FlashListProps<TItem>
165
144
  | React.ComponentType<ScrollViewProps>
166
145
  | React.FC<ScrollViewProps>;
167
146
 
168
- /**
169
- * You can use `contentContainerStyle` to apply padding that will be applied to the whole content itself.
170
- * For example, you can apply this padding, so that all of your items have leading and trailing space.
171
- */
172
- contentContainerStyle?: ContentStyle;
173
-
174
147
  /**
175
148
  * Draw distance for advanced rendering (in dp/px)
176
149
  */
177
150
  drawDistance?: number;
178
151
 
179
- /**
180
- * Specifies how far the first item is drawn from start of the list window or, offset of the first item of the list (not the header).
181
- * Needed if you're using initialScrollIndex prop. Before the initial draw the list cannot figure out the size of header or, any special margin/padding that might have been applied
182
- * using header styles etc.
183
- * If this isn't provided initialScrollIndex might not scroll to the provided index.
184
- */
185
- estimatedFirstItemOffset?: number;
186
-
187
- /**
188
- * Visible height and width of the list. This is not the scroll content size.
189
- */
190
- estimatedListSize?: { height: number; width: number };
191
-
192
152
  /**
193
153
  * A marker property for telling the list to re-render (since it implements PureComponent).
194
154
  * If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
@@ -206,11 +166,6 @@ export interface FlashListProps<TItem>
206
166
  */
207
167
  initialScrollIndex?: number | null | undefined;
208
168
 
209
- /**
210
- * Reverses the direction of scroll. Uses scale transforms of -1.
211
- */
212
- inverted?: boolean | null | undefined;
213
-
214
169
  /**
215
170
  * Used to extract a unique key for a given item at the specified index.
216
171
  * Key is used for optimizing performance. Defining `keyExtractor` is also necessary
@@ -225,18 +180,6 @@ export interface FlashListProps<TItem>
225
180
  */
226
181
  numColumns?: number | undefined;
227
182
 
228
- /**
229
- * Computes blank space that is visible to the user during scroll or list load. If list doesn't have enough items to fill the screen even then this will be raised.
230
- * Values reported: {
231
- * offsetStart -> visible blank space on top of the screen (while going up). If value is greater than 0 then it's visible to user.
232
- * offsetEnd -> visible blank space at the end of the screen (while going down). If value is greater than 0 then it's visible to user.
233
- * blankArea -> max(offsetStart, offsetEnd) use this directly and look for values > 0
234
- * }
235
- * Please note that this event isn't synced with onScroll event but works with native onDraw/layoutSubviews. Events with values > 0 are blanks.
236
- * This event is raised even when there is no visible blank with negative values for extensibility however, for most use cases check blankArea > 0 and use the value.
237
- */
238
- onBlankArea?: BlankAreaEventHandler;
239
-
240
183
  /**
241
184
  * Called once when the scroll position gets within onEndReachedThreshold of the rendered content.
242
185
  */
@@ -292,11 +235,7 @@ export interface FlashListProps<TItem>
292
235
  ) => string | number | undefined;
293
236
 
294
237
  /**
295
- * This method can be used to provide explicit size estimates or change column span of an item.
296
- *
297
- * Providing specific estimates is a good idea when you can calculate sizes reliably. FlashList will prefer this value over `estimatedItemSize` for that specific item.
298
- * Precise estimates will also improve precision of `scrollToIndex` method and `initialScrollIndex` prop. If you have a `separator` below your items you can include its size in the estimate.
299
- *
238
+ * This method can be used to change column span of an item.
300
239
  * Changing item span is useful when you have grid layouts (numColumns > 1) and you want few items to be bigger than the rest.
301
240
  *
302
241
  * Modify the given layout. Do not return. FlashList will fallback to default values if this is ignored.
@@ -304,7 +243,7 @@ export interface FlashListProps<TItem>
304
243
  * Performance: This method is called very frequently. Keep it fast.
305
244
  */
306
245
  overrideItemLayout?: (
307
- layout: { span?: number; size?: number },
246
+ layout: { span?: number },
308
247
  item: TItem,
309
248
  index: number,
310
249
  maxColumns: number,
@@ -342,21 +281,6 @@ export interface FlashListProps<TItem>
342
281
  | ViewabilityConfigCallbackPairs<TItem>
343
282
  | undefined;
344
283
 
345
- /**
346
- * FlashList attempts to measure size of horizontal lists by drawing an extra list item in advance. This can sometimes cause issues when used with `initialScrollIndex` in lists
347
- * with very little content. You might see some amount of over scroll. When set to true the list's rendered size needs to be deterministic (i.e., height and width greater than 0)
348
- * as FlashList will skip rendering the extra item for measurement. Default value is `false`.
349
- */
350
- disableHorizontalListHeightMeasurement?: boolean;
351
-
352
- /**
353
- * FlashList applies some fixes to layouts of its children which can conflict with custom `CellRendererComponent`
354
- * implementations. You can disable this behavior by setting this to `true`.
355
- * Recommendation: Set this to `true` while you apply special behavior to the `CellRendererComponent`. Once done set this to
356
- * `false` again.
357
- */
358
- disableAutoLayout?: boolean;
359
-
360
284
  /**
361
285
  * New arch only
362
286
  * Maximum number of items in the recycle pool. These are the items that are cached in the recycle pool when they are scrolled off the screen.
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { render } from "@quilted/react-testing";
3
3
 
4
- import { RecyclerView } from "../recyclerview/RecyclerView";
5
4
  import { useFlashListContext } from "../recyclerview/RecyclerViewContextProvider";
6
5
  import { LayoutCommitObserver } from "../recyclerview/LayoutCommitObserver";
6
+ import { FlashList } from "..";
7
7
 
8
8
  describe("LayoutCommitObserver", () => {
9
9
  it("should not alter ref captured by child", () => {
@@ -20,7 +20,7 @@ describe("LayoutCommitObserver", () => {
20
20
  let commitLayoutEffectCount = 0;
21
21
 
22
22
  const content = (
23
- <RecyclerView
23
+ <FlashList
24
24
  testID="parent"
25
25
  data={[1]}
26
26
  renderItem={() => (
@@ -29,7 +29,7 @@ describe("LayoutCommitObserver", () => {
29
29
  commitLayoutEffectCount++;
30
30
  }}
31
31
  >
32
- <RecyclerView
32
+ <FlashList
33
33
  testID="child"
34
34
  data={[1]}
35
35
  renderItem={() => (
@@ -53,8 +53,11 @@ describe("LayoutCommitObserver", () => {
53
53
  />
54
54
  );
55
55
 
56
- render(content);
56
+ const renderResult = render(content);
57
57
 
58
58
  expect(commitLayoutEffectCount).toBe(3);
59
+
60
+ // Force unmount to trigger cleanup of async operations
61
+ renderResult.unmount();
59
62
  });
60
63
  });
@@ -4,7 +4,7 @@ import "@quilted/react-testing/matchers";
4
4
  import { render } from "@quilted/react-testing";
5
5
 
6
6
  import { FlashListRef } from "../FlashListRef";
7
- import { RecyclerView } from "../recyclerview/RecyclerView";
7
+ import { FlashList } from "..";
8
8
 
9
9
  // Mock measureLayout to return fixed dimensions
10
10
  jest.mock("../recyclerview/utils/measureLayout", () => {
@@ -49,7 +49,7 @@ const renderRecyclerView = (args: {
49
49
  data,
50
50
  } = args;
51
51
  return render(
52
- <RecyclerView
52
+ <FlashList
53
53
  ref={ref}
54
54
  data={
55
55
  data ?? [
@@ -1,8 +1,9 @@
1
- import { Dimension, Layout } from "recyclerlistview";
2
-
3
- import CustomError from "../errors/CustomError";
4
- import ExceptionList from "../errors/ExceptionList";
5
- import ViewabilityHelper from "../viewability/ViewabilityHelper";
1
+ import ViewabilityHelper from "../recyclerview/viewability/ViewabilityHelper";
2
+ import { ErrorMessages } from "../errors/ErrorMessages";
3
+ import {
4
+ RVDimension,
5
+ RVLayout,
6
+ } from "../recyclerview/layout-managers/LayoutManager";
6
7
 
7
8
  describe("ViewabilityHelper", () => {
8
9
  const viewableIndicesChanged = jest.fn();
@@ -61,7 +62,7 @@ describe("ViewabilityHelper", () => {
61
62
  );
62
63
  viewabilityHelper.possiblyViewableIndices = [0, 1, 2, 3];
63
64
  const getLayout = (index: number) => {
64
- return { x: index * 100, y: 0, height: 300, width: 100 } as Layout;
65
+ return { x: index * 100, y: 0, height: 300, width: 100 } as RVLayout;
65
66
  };
66
67
  updateViewableItems({ viewabilityHelper, horizontal: true, getLayout });
67
68
  expect(viewableIndicesChanged).toHaveBeenCalledWith(
@@ -160,9 +161,9 @@ describe("ViewabilityHelper", () => {
160
161
  it("reports items that only satisfy viewAreaCoveragePercentThreshold", () => {
161
162
  const getLayout = (index: number) => {
162
163
  if (index === 4) {
163
- return { x: 0, y: index * 100, width: 100, height: 25 } as Layout;
164
+ return { x: 0, y: index * 100, width: 100, height: 25 } as RVLayout;
164
165
  }
165
- return { x: 0, y: index * 100, height: 100, width: 300 } as Layout;
166
+ return { x: 0, y: index * 100, height: 100, width: 300 } as RVLayout;
166
167
  };
167
168
  const viewabilityHelper = new ViewabilityHelper(
168
169
  { viewAreaCoveragePercentThreshold: 25 },
@@ -246,9 +247,7 @@ describe("ViewabilityHelper", () => {
246
247
  viewableIndicesChanged
247
248
  );
248
249
  expect(() => updateViewableItems({ viewabilityHelper })).toThrow(
249
- new CustomError(
250
- ExceptionList.multipleViewabilityThresholdTypesNotSupported
251
- )
250
+ ErrorMessages.multipleViewabilityThresholdTypesNotSupported
252
251
  );
253
252
  });
254
253
 
@@ -263,8 +262,8 @@ describe("ViewabilityHelper", () => {
263
262
  viewabilityHelper: ViewabilityHelper;
264
263
  horizontal?: boolean;
265
264
  scrollOffset?: number;
266
- listSize?: Dimension;
267
- getLayout?: (index: number) => Layout | undefined;
265
+ listSize?: RVDimension;
266
+ getLayout?: (index: number) => RVLayout | undefined;
268
267
  runAllTimers?: boolean;
269
268
  }) => {
270
269
  viewabilityHelper.updateViewableItems(
@@ -273,7 +272,7 @@ describe("ViewabilityHelper", () => {
273
272
  listSize ?? { height: 300, width: 300 },
274
273
  getLayout ??
275
274
  ((index) => {
276
- return { x: 0, y: index * 100, height: 100, width: 300 } as Layout;
275
+ return { x: 0, y: index * 100, height: 100, width: 300 } as RVLayout;
277
276
  })
278
277
  );
279
278
  if (runAllTimers ?? true) {
@@ -1,3 +1,5 @@
1
+ import { ErrorMessages } from "../errors/ErrorMessages";
2
+
1
3
  import { roundToDecimalPlaces } from "./roundToDecimalPlaces";
2
4
 
3
5
  /**
@@ -44,9 +46,7 @@ export class JSFPSMonitor {
44
46
 
45
47
  public startTracking() {
46
48
  if (this.startTime !== 0) {
47
- throw new Error(
48
- "This FPS Monitor has already been run, please create a new instance"
49
- );
49
+ throw new Error(ErrorMessages.fpsMonitorAlreadyRunning);
50
50
  }
51
51
  this.startTime = Date.now();
52
52
  this.timeWindow.startTime = Date.now();
@@ -1,14 +1,10 @@
1
1
  import React, { useEffect } from "react";
2
2
 
3
- import FlashList from "../FlashList";
3
+ import { FlashListRef } from "../FlashListRef";
4
+ import { ErrorMessages } from "../errors/ErrorMessages";
4
5
 
5
6
  import { autoScroll, Cancellable } from "./AutoScrollHelper";
6
7
  import { JSFPSMonitor, JSFPSResult } from "./JSFPSMonitor";
7
- import { roundToDecimalPlaces } from "./roundToDecimalPlaces";
8
- import {
9
- BlankAreaTrackerResult,
10
- useBlankAreaTracker,
11
- } from "./useBlankAreaTracker";
12
8
 
13
9
  export interface BenchmarkParams {
14
10
  startDelayInMs?: number;
@@ -34,7 +30,6 @@ export interface BenchmarkResult {
34
30
  js?: JSFPSResult;
35
31
  interrupted: boolean;
36
32
  suggestions: string[];
37
- blankArea?: BlankAreaTrackerResult;
38
33
  formattedString?: string;
39
34
  }
40
35
 
@@ -45,21 +40,16 @@ export interface BenchmarkResult {
45
40
  */
46
41
 
47
42
  export function useBenchmark(
48
- flashListRef: React.RefObject<FlashList<any>>,
43
+ flashListRef: React.RefObject<FlashListRef<any>>,
49
44
  callback: (benchmarkResult: BenchmarkResult) => void,
50
45
  params: BenchmarkParams = {}
51
46
  ) {
52
- const [blankAreaResult, blankAreaTracker] = useBlankAreaTracker(
53
- flashListRef,
54
- undefined,
55
- { sumNegativeValues: params.sumNegativeBlankAreaValues, startDelayInMs: 0 }
56
- );
57
47
  useEffect(() => {
58
48
  const cancellable = new Cancellable();
59
49
  const suggestions: string[] = [];
60
50
  if (flashListRef.current) {
61
51
  if (!(Number(flashListRef.current.props.data?.length) > 0)) {
62
- throw new Error("Data is empty, cannot run benchmark");
52
+ throw new Error(ErrorMessages.dataEmptyCannotRunBenchmark);
63
53
  }
64
54
  }
65
55
  const cancelTimeout = setTimeout(async () => {
@@ -81,7 +71,6 @@ export function useBenchmark(
81
71
  computeSuggestions(flashListRef, suggestions);
82
72
  const result: BenchmarkResult = generateResult(
83
73
  jsProfilerResponse,
84
- blankAreaResult,
85
74
  suggestions,
86
75
  cancellable
87
76
  );
@@ -96,18 +85,12 @@ export function useBenchmark(
96
85
  };
97
86
  // eslint-disable-next-line react-hooks/exhaustive-deps
98
87
  }, []);
99
- return [blankAreaTracker];
100
88
  }
101
89
 
102
90
  export function getFormattedString(res: BenchmarkResult) {
103
91
  return (
104
92
  `Results:\n\n` +
105
93
  `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
94
  `${
112
95
  res.suggestions.length > 0
113
96
  ? `Suggestions:\n\n${res.suggestions
@@ -120,22 +103,11 @@ export function getFormattedString(res: BenchmarkResult) {
120
103
 
121
104
  function generateResult(
122
105
  jsProfilerResponse: JSFPSResult,
123
- blankAreaResult: BlankAreaTrackerResult,
124
106
  suggestions: string[],
125
107
  cancellable: Cancellable
126
108
  ) {
127
109
  return {
128
110
  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
111
  suggestions,
140
112
  interrupted: cancellable.isCancelled(),
141
113
  };
@@ -145,21 +117,21 @@ function generateResult(
145
117
  * Scrolls to the end of the list and then back to the top
146
118
  */
147
119
  async function runScrollBenchmark(
148
- flashListRef: React.RefObject<FlashList<any> | null | undefined>,
120
+ flashListRef: React.RefObject<FlashListRef<any> | null | undefined>,
149
121
  cancellable: Cancellable,
150
122
  scrollSpeedMultiplier: number
151
123
  ): Promise<void> {
152
124
  if (flashListRef.current) {
153
125
  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();
126
+ const rv = flashListRef.current;
127
+ if (rv) {
128
+ const rvSize = rv.getWindowSize();
129
+ const rvContentSize = rv.getChildContainerDimensions();
158
130
 
159
131
  const fromX = 0;
160
132
  const fromY = 0;
161
- const toX = rlvContentSize.width - rlvSize.width;
162
- const toY = rlvContentSize.height - rlvSize.height;
133
+ const toX = rvContentSize.width - rvSize.width;
134
+ const toY = rvContentSize.height - rvSize.height;
163
135
 
164
136
  const scrollNow = (x: number, y: number) => {
165
137
  flashListRef.current?.scrollToOffset({
@@ -190,7 +162,7 @@ async function runScrollBenchmark(
190
162
  }
191
163
  }
192
164
  function computeSuggestions(
193
- flashListRef: React.RefObject<FlashList<any> | null | undefined>,
165
+ flashListRef: React.RefObject<FlashListRef<any> | null | undefined>,
194
166
  suggestions: string[]
195
167
  ) {
196
168
  if (flashListRef.current) {
@@ -1,6 +1,8 @@
1
1
  import { useEffect } from "react";
2
2
  import { FlatList } from "react-native";
3
3
 
4
+ import { ErrorMessages } from "../errors/ErrorMessages";
5
+
4
6
  import { autoScroll, Cancellable } from "./AutoScrollHelper";
5
7
  import { JSFPSMonitor } from "./JSFPSMonitor";
6
8
  import {
@@ -27,7 +29,7 @@ export function useFlatListBenchmark(
27
29
  const cancellable = new Cancellable();
28
30
  if (flatListRef.current && flatListRef.current.props) {
29
31
  if (!(Number(flatListRef.current.props.data?.length) > 0)) {
30
- throw new Error("Data is empty, cannot run benchmark");
32
+ throw new Error(ErrorMessages.dataEmptyCannotRunBenchmark);
31
33
  }
32
34
  }
33
35
  const cancelTimeout = setTimeout(async () => {
@@ -0,0 +1,26 @@
1
+ export const ErrorMessages = {
2
+ multipleViewabilityThresholdTypesNotSupported:
3
+ "You can set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold. Specifying both is not supported.",
4
+ flashListV2OnlySupportsNewArchitecture:
5
+ "FlashList v2 is only supported on new architecture",
6
+ layoutManagerNotInitializedLayoutInfo:
7
+ "LayoutManager is not initialized, layout info is unavailable",
8
+ layoutManagerNotInitializedChildContainer:
9
+ "LayoutManager is not initialized, child container layout is unavailable",
10
+ layoutManagerNotInitializedWindowSize:
11
+ "LayoutManager is not initialized, window size is unavailable",
12
+ horizontalPropCannotBeToggled:
13
+ "Horizontal prop cannot be toggled, you can use a key on FlashList to recreate it.",
14
+ layoutManagerNotInitializedVisibleIndices:
15
+ "LayoutManager is not initialized, visible indices are not unavailable",
16
+ masonryAndHorizontalIncompatible:
17
+ "Masonry and horizontal props are incompatible",
18
+ numColumnsAndHorizontalIncompatible:
19
+ "numColumns and horizontal props are incompatible",
20
+ indexOutOfBounds: "index out of bounds, not enough layouts",
21
+ fpsMonitorAlreadyRunning:
22
+ "This FPS Monitor has already been run, please create a new instance",
23
+ dataEmptyCannotRunBenchmark: "Data is empty, cannot run benchmark",
24
+ stickyHeadersNotSupportedForHorizontal:
25
+ "Sticky headers are not supported when list is horizontal",
26
+ };
@@ -0,0 +1,7 @@
1
+ export const WarningMessages = {
2
+ keyExtractorNotDefinedForAnimation:
3
+ "keyExtractor is not defined. This might cause the animations to not work as expected.",
4
+ exceededMaxRendersWithoutCommit:
5
+ "Exceeded max renders without commit. This might mean that you have duplicate keys in your keyExtractor output or your list is nested in a ScrollView causing a lot of items to render at once. " +
6
+ "If it's none of those and is causing a real issue or error, consider reporing this on FlashList Github",
7
+ };
package/src/index.ts CHANGED
@@ -1,25 +1,17 @@
1
- // eslint-disable-next-line import/no-named-default
2
- import { default as OriginalFlashList } from "./FlashList";
3
- import { isNewCoreEnabled } from "./enableNewCore";
4
- import { RecyclerView } from "./recyclerview/RecyclerView";
5
-
6
1
  // Keep this unmodified for TS type checking
7
- export { default as FlashList } from "./FlashList";
2
+ import { isNewArch } from "./isNewArch";
3
+ import { ErrorMessages } from "./errors/ErrorMessages";
4
+
5
+ export { FlashList } from "./FlashList";
8
6
  export { FlashListRef } from "./FlashListRef";
9
7
  export {
10
8
  FlashListProps,
11
- ContentStyle,
12
9
  ListRenderItem,
13
10
  ListRenderItemInfo,
14
11
  RenderTarget,
15
12
  RenderTargetOptions,
16
13
  } from "./FlashListProps";
17
14
  export { default as AnimatedFlashList } from "./AnimatedFlashList";
18
- export {
19
- useOnNativeBlankAreaEvents,
20
- BlankAreaEventHandler,
21
- BlankAreaEvent,
22
- } from "./native/auto-layout/AutoLayoutView";
23
15
  export {
24
16
  useBenchmark,
25
17
  BenchmarkParams,
@@ -30,46 +22,18 @@ export {
30
22
  useFlatListBenchmark,
31
23
  FlatListBenchmarkParams,
32
24
  } from "./benchmark/useFlatListBenchmark";
33
- export {
34
- useBlankAreaTracker,
35
- BlankAreaTrackerResult,
36
- BlankAreaTrackerConfig,
37
- } from "./benchmark/useBlankAreaTracker";
38
- export {
39
- MasonryFlashList,
40
- MasonryFlashListProps,
41
- MasonryFlashListScrollEvent,
42
- MasonryFlashListRef,
43
- MasonryListItem,
44
- MasonryListRenderItem,
45
- MasonryListRenderItemInfo,
46
- } from "./MasonryFlashList";
47
25
  export { useLayoutState } from "./recyclerview/hooks/useLayoutState";
48
26
  export { useRecyclingState } from "./recyclerview/hooks/useRecyclingState";
49
27
  export { useMappingHelper } from "./recyclerview/hooks/useMappingHelper";
50
28
  export { JSFPSMonitor, JSFPSResult } from "./benchmark/JSFPSMonitor";
51
29
  export { autoScroll, Cancellable } from "./benchmark/AutoScrollHelper";
52
- export { default as ViewToken } from "./viewability/ViewToken";
53
- export { default as CellContainer } from "./native/cell-container/CellContainer";
54
- export { RecyclerView } from "./recyclerview/RecyclerView";
55
- export { RecyclerViewProps } from "./recyclerview/RecyclerViewProps";
30
+ export { default as ViewToken } from "./recyclerview/viewability/ViewToken";
56
31
  export { useFlashListContext } from "./recyclerview/RecyclerViewContextProvider";
57
32
  export {
58
33
  LayoutCommitObserver,
59
34
  LayoutCommitObserverProps,
60
35
  } from "./recyclerview/LayoutCommitObserver";
61
36
 
62
- // @ts-ignore - This is ignored by TypeScript but will be present in the compiled JS
63
- // In the compiled JS, this will override the previous FlashList export with a conditional one
64
- if (
65
- typeof module !== "undefined" &&
66
- module.exports &&
67
- process?.env?.NODE_ENV !== "test"
68
- ) {
69
- Object.defineProperty(module.exports, "FlashList", {
70
- get() {
71
- return isNewCoreEnabled() ? RecyclerView : OriginalFlashList;
72
- },
73
- configurable: true,
74
- });
37
+ if (!isNewArch()) {
38
+ throw new Error(ErrorMessages.flashListV2OnlySupportsNewArchitecture);
75
39
  }
@@ -0,0 +1,25 @@
1
+ import { Platform } from "react-native";
2
+
3
+ let _isNewArch: boolean | undefined;
4
+
5
+ export function isNewArch(): boolean {
6
+ if (_isNewArch !== undefined) {
7
+ return _isNewArch;
8
+ } else {
9
+ try {
10
+ // Check for Fabric UI Manager
11
+ const hasFabricUIManager = Boolean(
12
+ (global as any)?.nativeFabricUIManager
13
+ );
14
+
15
+ // Check for TurboModule system
16
+ const hasTurboModule = Boolean((global as any)?.__turboModuleProxy);
17
+
18
+ _isNewArch =
19
+ hasFabricUIManager || hasTurboModule || Platform.OS === "web";
20
+ } catch {
21
+ _isNewArch = true;
22
+ }
23
+ }
24
+ return _isNewArch;
25
+ }
@@ -1,31 +1,7 @@
1
- import { BaseItemAnimator } from "recyclerlistview";
2
-
3
1
  const PlatformConfig = {
4
2
  defaultDrawDistance: 250,
5
3
  supportsOffsetCorrection: true,
6
4
  trackAverageRenderTimeForOffsetProjection: true,
7
- // Using rotate instead of scaleY on Android to avoid performance issues. Issue: https://github.com/Shopify/flash-list/issues/751
8
- invertedTransformStyle: { transform: [{ rotate: "180deg" }] },
9
- invertedTransformStyleHorizontal: { transform: [{ rotate: "180deg" }] },
10
- };
11
- const getCellContainerPlatformStyles = (
12
- inverted: boolean,
13
- parentProps: { x: number; y: number; isHorizontal?: boolean }
14
- ): { transform: string; WebkitTransform: string } | undefined => {
15
- return undefined;
16
- };
17
-
18
- const getItemAnimator = (): BaseItemAnimator | undefined => {
19
- return undefined;
20
5
  };
21
6
 
22
- const getFooterContainer = (): React.ComponentClass | undefined => {
23
- return undefined;
24
- };
25
-
26
- export {
27
- PlatformConfig,
28
- getCellContainerPlatformStyles,
29
- getItemAnimator,
30
- getFooterContainer,
31
- };
7
+ export { PlatformConfig };
@@ -1,30 +1,7 @@
1
- import { BaseItemAnimator } from "recyclerlistview";
2
-
3
1
  const PlatformConfig = {
4
2
  defaultDrawDistance: 250,
5
3
  supportsOffsetCorrection: true,
6
4
  trackAverageRenderTimeForOffsetProjection: false,
7
- invertedTransformStyle: { transform: [{ scaleY: -1 }] },
8
- invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
9
- };
10
- const getCellContainerPlatformStyles = (
11
- inverted: boolean,
12
- parentProps: { x: number; y: number; isHorizontal?: boolean }
13
- ): { transform: string; WebkitTransform: string } | undefined => {
14
- return undefined;
15
- };
16
-
17
- const getItemAnimator = (): BaseItemAnimator | undefined => {
18
- return undefined;
19
5
  };
20
6
 
21
- const getFooterContainer = (): React.ComponentClass | undefined => {
22
- return undefined;
23
- };
24
-
25
- export {
26
- PlatformConfig,
27
- getCellContainerPlatformStyles,
28
- getItemAnimator,
29
- getFooterContainer,
30
- };
7
+ export { PlatformConfig };