@react-native-ohos/flash-list 1.8.3 → 2.1.1-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.
- package/LICENSE +1 -1
- package/README.OpenSource +1 -1
- package/dist/AnimatedFlashList.d.ts +4 -28
- package/dist/AnimatedFlashList.d.ts.map +1 -1
- package/dist/AnimatedFlashList.js +5 -30
- package/dist/AnimatedFlashList.js.map +1 -1
- package/dist/FlashList.d.ts +1 -179
- package/dist/FlashList.d.ts.map +1 -1
- package/dist/FlashList.js +1 -599
- package/dist/FlashList.js.map +1 -1
- package/dist/FlashListProps.d.ts +285 -278
- package/dist/FlashListProps.d.ts.map +1 -1
- package/dist/FlashListProps.js +5 -31
- package/dist/FlashListProps.js.map +1 -1
- package/dist/FlashListRef.d.ts +305 -0
- package/dist/FlashListRef.d.ts.map +1 -0
- package/dist/FlashListRef.js +2 -0
- package/dist/FlashListRef.js.map +1 -0
- package/dist/benchmark/AutoScrollHelper.d.ts +17 -40
- package/dist/benchmark/AutoScrollHelper.d.ts.map +1 -1
- package/dist/benchmark/AutoScrollHelper.js +59 -90
- package/dist/benchmark/AutoScrollHelper.js.map +1 -1
- package/dist/benchmark/JSFPSMonitor.d.ts +22 -45
- package/dist/benchmark/JSFPSMonitor.d.ts.map +1 -1
- package/dist/benchmark/JSFPSMonitor.js +59 -87
- package/dist/benchmark/JSFPSMonitor.js.map +1 -1
- package/dist/benchmark/roundToDecimalPlaces.d.ts +1 -24
- package/dist/benchmark/roundToDecimalPlaces.d.ts.map +1 -1
- package/dist/benchmark/roundToDecimalPlaces.js +4 -31
- package/dist/benchmark/roundToDecimalPlaces.js.map +1 -1
- package/dist/benchmark/useBenchmark.d.ts +40 -57
- package/dist/benchmark/useBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useBenchmark.js +119 -189
- package/dist/benchmark/useBenchmark.js.map +1 -1
- package/dist/benchmark/useDataMultiplier.d.ts +8 -31
- package/dist/benchmark/useDataMultiplier.d.ts.map +1 -1
- package/dist/benchmark/useDataMultiplier.js +19 -47
- package/dist/benchmark/useDataMultiplier.js.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.d.ts +14 -35
- package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.js +92 -122
- package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
- package/dist/errors/ErrorMessages.d.ts +16 -0
- package/dist/errors/ErrorMessages.d.ts.map +1 -0
- package/dist/errors/ErrorMessages.js +16 -0
- package/dist/errors/ErrorMessages.js.map +1 -0
- package/dist/errors/WarningMessages.d.ts +6 -0
- package/dist/errors/WarningMessages.d.ts.map +1 -0
- package/dist/errors/WarningMessages.js +7 -0
- package/dist/errors/WarningMessages.js.map +1 -0
- package/dist/index.d.ts +15 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -54
- package/dist/index.js.map +1 -1
- package/dist/isNewArch.d.ts +2 -0
- package/dist/isNewArch.d.ts.map +1 -0
- package/dist/isNewArch.js +22 -0
- package/dist/isNewArch.js.map +1 -0
- package/dist/native/config/PlatformHelper.android.d.ts +6 -48
- package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.android.js +6 -45
- package/dist/native/config/PlatformHelper.android.js.map +1 -1
- package/dist/native/config/PlatformHelper.d.ts +6 -48
- package/dist/native/config/PlatformHelper.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.harmony.d.ts +29 -48
- package/dist/native/config/PlatformHelper.harmony.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.harmony.js +29 -44
- package/dist/native/config/PlatformHelper.harmony.js.map +1 -1
- package/dist/native/config/PlatformHelper.ios.d.ts +6 -48
- package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.js +6 -44
- package/dist/native/config/PlatformHelper.ios.js.map +1 -1
- package/dist/native/config/PlatformHelper.js +6 -45
- package/dist/native/config/PlatformHelper.js.map +1 -1
- package/dist/native/config/PlatformHelper.web.d.ts +6 -49
- package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.web.js +6 -47
- package/dist/native/config/PlatformHelper.web.js.map +1 -1
- package/dist/recyclerview/LayoutCommitObserver.d.ts +12 -0
- package/dist/recyclerview/LayoutCommitObserver.d.ts.map +1 -0
- package/dist/recyclerview/LayoutCommitObserver.js +58 -0
- package/dist/recyclerview/LayoutCommitObserver.js.map +1 -0
- package/dist/recyclerview/RecyclerView.d.ts +13 -0
- package/dist/recyclerview/RecyclerView.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerView.js +368 -0
- package/dist/recyclerview/RecyclerView.js.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts +46 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js +10 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts +78 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.js +343 -0
- package/dist/recyclerview/RecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts +2 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.js +2 -0
- package/dist/recyclerview/RecyclerViewProps.js.map +1 -0
- package/dist/recyclerview/RenderStackManager.d.ts +86 -0
- package/dist/recyclerview/RenderStackManager.d.ts.map +1 -0
- package/dist/recyclerview/RenderStackManager.js +252 -0
- package/dist/recyclerview/RenderStackManager.js.map +1 -0
- package/dist/recyclerview/ViewHolder.d.ts +45 -0
- package/dist/recyclerview/ViewHolder.d.ts.map +1 -0
- package/dist/recyclerview/ViewHolder.js +94 -0
- package/dist/recyclerview/ViewHolder.js.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts +63 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.js +87 -0
- package/dist/recyclerview/ViewHolderCollection.js.map +1 -0
- package/dist/recyclerview/components/CompatScroller.d.ts +7 -0
- package/dist/recyclerview/components/CompatScroller.d.ts.map +1 -0
- package/dist/recyclerview/components/CompatScroller.js +7 -0
- package/dist/recyclerview/components/CompatScroller.js.map +1 -0
- package/dist/recyclerview/components/CompatView.d.ts +7 -0
- package/dist/recyclerview/components/CompatView.d.ts.map +1 -0
- package/dist/recyclerview/components/CompatView.js +7 -0
- package/dist/recyclerview/components/CompatView.js.map +1 -0
- package/dist/recyclerview/components/ScrollAnchor.d.ts +29 -0
- package/dist/recyclerview/components/ScrollAnchor.d.ts.map +1 -0
- package/dist/recyclerview/components/ScrollAnchor.js +33 -0
- package/dist/recyclerview/components/ScrollAnchor.js.map +1 -0
- package/dist/recyclerview/components/StickyHeaders.d.ts +38 -0
- package/dist/recyclerview/components/StickyHeaders.d.ts.map +1 -0
- package/dist/recyclerview/components/StickyHeaders.js +112 -0
- package/dist/recyclerview/components/StickyHeaders.js.map +1 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts +51 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts.map +1 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.js +95 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.js.map +1 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts +105 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts.map +1 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.js +202 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.js.map +1 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +14 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.js +44 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.js.map +1 -0
- package/dist/recyclerview/helpers/VelocityTracker.d.ts +29 -0
- package/dist/recyclerview/helpers/VelocityTracker.d.ts.map +1 -0
- package/dist/recyclerview/helpers/VelocityTracker.js +64 -0
- package/dist/recyclerview/helpers/VelocityTracker.js.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts +17 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.js +132 -0
- package/dist/recyclerview/hooks/useBoundDetection.js.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts +14 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.js +38 -0
- package/dist/recyclerview/hooks/useLayoutState.js.map +1 -0
- package/dist/recyclerview/hooks/useMappingHelper.d.ts +9 -0
- package/dist/recyclerview/hooks/useMappingHelper.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useMappingHelper.js +15 -0
- package/dist/recyclerview/hooks/useMappingHelper.js.map +1 -0
- package/dist/recyclerview/hooks/useOnLoad.d.ts +25 -0
- package/dist/recyclerview/hooks/useOnLoad.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useOnLoad.js +67 -0
- package/dist/recyclerview/hooks/useOnLoad.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +28 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.js +507 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts +8 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.js +32 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts +18 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.js +49 -0
- package/dist/recyclerview/hooks/useRecyclingState.js.map +1 -0
- package/dist/recyclerview/hooks/useSecondaryProps.d.ts +27 -0
- package/dist/recyclerview/hooks/useSecondaryProps.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useSecondaryProps.js +90 -0
- package/dist/recyclerview/hooks/useSecondaryProps.js.map +1 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts +15 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js +58 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js.map +1 -0
- package/dist/recyclerview/hooks/useUnmountFlag.d.ts +10 -0
- package/dist/recyclerview/hooks/useUnmountFlag.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useUnmountFlag.js +25 -0
- package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +79 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js +221 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts +296 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.js +279 -0
- package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts +51 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.js +151 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +81 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +269 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js.map +1 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.d.ts +12 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.d.ts.map +1 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.js +14 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.js.map +1 -0
- package/dist/recyclerview/utils/componentUtils.d.ts +19 -0
- package/dist/recyclerview/utils/componentUtils.d.ts.map +1 -0
- package/dist/recyclerview/utils/componentUtils.js +27 -0
- package/dist/recyclerview/utils/componentUtils.js.map +1 -0
- package/dist/recyclerview/utils/findVisibleIndex.d.ts +24 -0
- package/dist/recyclerview/utils/findVisibleIndex.d.ts.map +1 -0
- package/dist/recyclerview/utils/findVisibleIndex.js +76 -0
- package/dist/recyclerview/utils/findVisibleIndex.js.map +1 -0
- package/dist/recyclerview/utils/measureLayout.d.ts +52 -0
- package/dist/recyclerview/utils/measureLayout.d.ts.map +1 -0
- package/dist/recyclerview/utils/measureLayout.js +99 -0
- package/dist/recyclerview/utils/measureLayout.js.map +1 -0
- package/dist/recyclerview/utils/measureLayout.web.d.ts +29 -0
- package/dist/recyclerview/utils/measureLayout.web.d.ts.map +1 -0
- package/dist/recyclerview/utils/measureLayout.web.js +79 -0
- package/dist/recyclerview/utils/measureLayout.web.js.map +1 -0
- package/dist/recyclerview/viewability/ViewToken.d.ts +8 -0
- package/dist/recyclerview/viewability/ViewToken.d.ts.map +1 -0
- package/dist/recyclerview/viewability/ViewToken.js +2 -0
- package/dist/recyclerview/viewability/ViewToken.js.map +1 -0
- package/dist/recyclerview/viewability/ViewabilityHelper.d.ts +26 -0
- package/dist/recyclerview/viewability/ViewabilityHelper.d.ts.map +1 -0
- package/dist/recyclerview/viewability/ViewabilityHelper.js +98 -0
- package/dist/recyclerview/viewability/ViewabilityHelper.js.map +1 -0
- package/dist/recyclerview/viewability/ViewabilityManager.d.ts +25 -0
- package/dist/recyclerview/viewability/ViewabilityManager.d.ts.map +1 -0
- package/dist/recyclerview/viewability/ViewabilityManager.js +94 -0
- package/dist/recyclerview/viewability/ViewabilityManager.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/AverageWindow.d.ts +33 -43
- package/dist/utils/AverageWindow.d.ts.map +1 -1
- package/dist/utils/AverageWindow.js +66 -71
- package/dist/utils/AverageWindow.js.map +1 -1
- package/jestSetup.js +23 -37
- package/package.json +15 -24
- package/src/AnimatedFlashList.ts +2 -25
- package/src/FlashList.ts +1 -0
- package/src/FlashListProps.ts +109 -100
- package/src/FlashListRef.ts +320 -0
- package/src/benchmark/AutoScrollHelper.ts +0 -24
- package/src/benchmark/JSFPSMonitor.ts +2 -26
- package/src/benchmark/roundToDecimalPlaces.ts +0 -24
- package/src/benchmark/useBenchmark.ts +59 -105
- package/src/benchmark/useDataMultiplier.ts +0 -24
- package/src/benchmark/useFlatListBenchmark.ts +43 -32
- package/src/errors/ErrorMessages.ts +26 -0
- package/src/errors/WarningMessages.ts +9 -0
- package/src/index.ts +18 -46
- package/src/isNewArch.ts +25 -0
- package/src/native/config/PlatformHelper.android.ts +3 -49
- package/src/native/config/PlatformHelper.harmony.ts +3 -24
- package/src/native/config/PlatformHelper.ios.ts +3 -48
- package/src/native/config/PlatformHelper.ts +3 -49
- package/src/native/config/PlatformHelper.web.ts +4 -55
- package/src/recyclerview/LayoutCommitObserver.tsx +74 -0
- package/src/recyclerview/RecyclerView.tsx +616 -0
- package/src/recyclerview/RecyclerViewContextProvider.ts +65 -0
- package/src/recyclerview/RecyclerViewManager.ts +461 -0
- package/src/recyclerview/RecyclerViewProps.ts +1 -0
- package/src/recyclerview/RenderStackManager.ts +317 -0
- package/src/recyclerview/ViewHolder.tsx +180 -0
- package/src/recyclerview/ViewHolderCollection.tsx +193 -0
- package/src/recyclerview/components/CompatScroller.ts +9 -0
- package/src/recyclerview/components/CompatView.ts +9 -0
- package/src/recyclerview/components/ScrollAnchor.tsx +66 -0
- package/src/recyclerview/components/StickyHeaders.tsx +222 -0
- package/src/recyclerview/helpers/ConsecutiveNumbers.ts +120 -0
- package/src/recyclerview/helpers/EngagedIndicesTracker.ts +301 -0
- package/src/recyclerview/helpers/RenderTimeTracker.ts +50 -0
- package/src/recyclerview/helpers/VelocityTracker.ts +77 -0
- package/src/recyclerview/hooks/useBoundDetection.ts +176 -0
- package/src/recyclerview/hooks/useLayoutState.ts +55 -0
- package/src/recyclerview/hooks/useMappingHelper.ts +20 -0
- package/src/recyclerview/hooks/useOnLoad.ts +80 -0
- package/src/recyclerview/hooks/useRecyclerViewController.tsx +633 -0
- package/src/recyclerview/hooks/useRecyclerViewManager.ts +42 -0
- package/src/recyclerview/hooks/useRecyclingState.ts +67 -0
- package/src/recyclerview/hooks/useSecondaryProps.tsx +124 -0
- package/src/recyclerview/hooks/useUnmountAwareCallbacks.ts +73 -0
- package/src/recyclerview/hooks/useUnmountFlag.ts +27 -0
- package/src/recyclerview/layout-managers/GridLayoutManager.ts +256 -0
- package/src/recyclerview/layout-managers/LayoutManager.ts +568 -0
- package/src/recyclerview/layout-managers/LinearLayoutManager.ts +171 -0
- package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +323 -0
- package/src/recyclerview/utils/adjustOffsetForRTL.ts +17 -0
- package/src/recyclerview/utils/componentUtils.ts +28 -0
- package/src/recyclerview/utils/findVisibleIndex.ts +93 -0
- package/src/recyclerview/utils/measureLayout.ts +128 -0
- package/src/recyclerview/utils/measureLayout.web.ts +102 -0
- package/src/recyclerview/viewability/ViewToken.ts +7 -0
- package/src/{viewability → recyclerview/viewability}/ViewabilityHelper.ts +8 -33
- package/src/{viewability → recyclerview/viewability}/ViewabilityManager.ts +23 -46
- package/src/utils/AverageWindow.ts +33 -24
- package/dist/GridLayoutProviderWithProps.d.ts +0 -65
- package/dist/GridLayoutProviderWithProps.d.ts.map +0 -1
- package/dist/GridLayoutProviderWithProps.js +0 -138
- package/dist/GridLayoutProviderWithProps.js.map +0 -1
- package/dist/MasonryFlashList.d.ts +0 -74
- package/dist/MasonryFlashList.d.ts.map +0 -1
- package/dist/MasonryFlashList.js +0 -275
- package/dist/MasonryFlashList.js.map +0 -1
- package/dist/PureComponentWrapper.d.ts +0 -45
- package/dist/PureComponentWrapper.d.ts.map +0 -1
- package/dist/PureComponentWrapper.js +0 -60
- package/dist/PureComponentWrapper.js.map +0 -1
- package/dist/benchmark/useBlankAreaTracker.d.ts +0 -57
- package/dist/benchmark/useBlankAreaTracker.d.ts.map +0 -1
- package/dist/benchmark/useBlankAreaTracker.js +0 -90
- package/dist/benchmark/useBlankAreaTracker.js.map +0 -1
- package/dist/errors/CustomError.d.ts +0 -31
- package/dist/errors/CustomError.d.ts.map +0 -1
- package/dist/errors/CustomError.js +0 -37
- package/dist/errors/CustomError.js.map +0 -1
- package/dist/errors/ExceptionList.d.ts +0 -47
- package/dist/errors/ExceptionList.d.ts.map +0 -1
- package/dist/errors/ExceptionList.js +0 -49
- package/dist/errors/ExceptionList.js.map +0 -1
- package/dist/errors/Warnings.d.ts +0 -32
- package/dist/errors/Warnings.d.ts.map +0 -1
- package/dist/errors/Warnings.js +0 -36
- package/dist/errors/Warnings.js.map +0 -1
- package/dist/fabric/AutoLayoutNativeComponent.d.ts +0 -42
- package/dist/fabric/AutoLayoutNativeComponent.d.ts.map +0 -1
- package/dist/fabric/AutoLayoutNativeComponent.js +0 -29
- package/dist/fabric/AutoLayoutNativeComponent.js.map +0 -1
- package/dist/fabric/CellContainerNativeComponent.d.ts +0 -31
- package/dist/fabric/CellContainerNativeComponent.d.ts.map +0 -1
- package/dist/fabric/CellContainerNativeComponent.js +0 -29
- package/dist/fabric/CellContainerNativeComponent.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutView.d.ts +0 -45
- package/dist/native/auto-layout/AutoLayoutView.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutView.js +0 -71
- package/dist/native/auto-layout/AutoLayoutView.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +0 -27
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +0 -29
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +0 -28
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts +0 -27
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js +0 -29
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +0 -27
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +0 -29
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +0 -29
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +0 -39
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +0 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +0 -26
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js.map +0 -1
- package/dist/native/cell-container/CellContainer.android.d.ts +0 -29
- package/dist/native/cell-container/CellContainer.android.d.ts.map +0 -1
- package/dist/native/cell-container/CellContainer.android.js +0 -32
- package/dist/native/cell-container/CellContainer.android.js.map +0 -1
- package/dist/native/cell-container/CellContainer.d.ts +0 -31
- package/dist/native/cell-container/CellContainer.d.ts.map +0 -1
- package/dist/native/cell-container/CellContainer.harmony.d.ts +0 -29
- package/dist/native/cell-container/CellContainer.harmony.d.ts.map +0 -1
- package/dist/native/cell-container/CellContainer.harmony.js +0 -32
- package/dist/native/cell-container/CellContainer.harmony.js.map +0 -1
- package/dist/native/cell-container/CellContainer.ios.d.ts +0 -29
- package/dist/native/cell-container/CellContainer.ios.d.ts.map +0 -1
- package/dist/native/cell-container/CellContainer.ios.js +0 -32
- package/dist/native/cell-container/CellContainer.ios.js.map +0 -1
- package/dist/native/cell-container/CellContainer.js +0 -34
- package/dist/native/cell-container/CellContainer.js.map +0 -1
- package/dist/native/cell-container/CellContainer.web.d.ts +0 -30
- package/dist/native/cell-container/CellContainer.web.d.ts.map +0 -1
- package/dist/native/cell-container/CellContainer.web.js +0 -36
- package/dist/native/cell-container/CellContainer.web.js.map +0 -1
- package/dist/utils/ContentContainerUtils.d.ts +0 -50
- package/dist/utils/ContentContainerUtils.d.ts.map +0 -1
- package/dist/utils/ContentContainerUtils.js +0 -71
- package/dist/utils/ContentContainerUtils.js.map +0 -1
- package/dist/viewability/ViewToken.d.ts +0 -31
- package/dist/viewability/ViewToken.d.ts.map +0 -1
- package/dist/viewability/ViewToken.js +0 -26
- package/dist/viewability/ViewToken.js.map +0 -1
- package/dist/viewability/ViewabilityHelper.d.ts +0 -49
- package/dist/viewability/ViewabilityHelper.d.ts.map +0 -1
- package/dist/viewability/ViewabilityHelper.js +0 -130
- package/dist/viewability/ViewabilityHelper.js.map +0 -1
- package/dist/viewability/ViewabilityManager.d.ts +0 -48
- package/dist/viewability/ViewabilityManager.d.ts.map +0 -1
- package/dist/viewability/ViewabilityManager.js +0 -131
- package/dist/viewability/ViewabilityManager.js.map +0 -1
- package/harmony/flash_list/BuildProfile.ets +0 -17
- package/harmony/flash_list/LICENSE +0 -7
- package/harmony/flash_list/build-profile.json5 +0 -8
- package/harmony/flash_list/hvigorfile.ts +0 -1
- package/harmony/flash_list/index.ets +0 -27
- package/harmony/flash_list/obfuscation-rules.txt +0 -18
- package/harmony/flash_list/oh-package.json5 +0 -24
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.cpp +0 -63
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.h +0 -54
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.cpp +0 -140
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.h +0 -66
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.cpp +0 -208
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.h +0 -78
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewEventEmitRequestHandler.h +0 -53
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewJSIBinder.h +0 -50
- package/harmony/flash_list/src/main/cpp/CMakeLists.txt +0 -12
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.cpp +0 -80
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.h +0 -64
- package/harmony/flash_list/src/main/cpp/CellContainerJSIBinder.h +0 -39
- package/harmony/flash_list/src/main/cpp/ComponentDescriptors.h +0 -40
- package/harmony/flash_list/src/main/cpp/EventEmitters.cpp +0 -40
- package/harmony/flash_list/src/main/cpp/EventEmitters.h +0 -48
- package/harmony/flash_list/src/main/cpp/FlashListPackage.h +0 -85
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.cpp +0 -87
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.h +0 -57
- package/harmony/flash_list/src/main/cpp/Props.cpp +0 -52
- package/harmony/flash_list/src/main/cpp/Props.h +0 -64
- package/harmony/flash_list/src/main/cpp/ShadowNodes.cpp +0 -34
- package/harmony/flash_list/src/main/cpp/ShadowNodes.h +0 -48
- package/harmony/flash_list/src/main/ets/Logger.ets +0 -64
- package/harmony/flash_list/src/main/ets/RNAutoLayoutShadow.ets +0 -154
- package/harmony/flash_list/src/main/ets/RNAutoLayoutView.ets +0 -277
- package/harmony/flash_list/src/main/ets/RNCellContainer.ets +0 -113
- package/harmony/flash_list/src/main/module.json5 +0 -9
- package/harmony/flash_list/src/main/resources/base/element/color.json +0 -8
- package/harmony/flash_list/src/main/resources/base/element/string.json +0 -16
- package/harmony/flash_list/src/main/resources/base/media/icon.png +0 -0
- package/harmony/flash_list/src/main/resources/base/profile/main_pages.json +0 -5
- package/harmony/flash_list/src/main/resources/en_US/element/string.json +0 -16
- package/harmony/flash_list/src/main/resources/zh_CN/element/string.json +0 -16
- package/harmony/flash_list.har +0 -0
- package/src/FlashList.tsx +0 -949
- package/src/GridLayoutProviderWithProps.ts +0 -204
- package/src/MasonryFlashList.tsx +0 -499
- package/src/PureComponentWrapper.tsx +0 -65
- package/src/benchmark/useBlankAreaTracker.ts +0 -141
- package/src/errors/CustomError.ts +0 -34
- package/src/errors/ExceptionList.ts +0 -52
- package/src/errors/Warnings.ts +0 -39
- package/src/fabric/AutoLayoutNativeComponent.ts +0 -52
- package/src/fabric/CellContainerNativeComponent.ts +0 -35
- package/src/native/auto-layout/AutoLayoutView.tsx +0 -97
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +0 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.harmony.ts +0 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +0 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +0 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +0 -41
- package/src/native/cell-container/CellContainer.android.ts +0 -31
- package/src/native/cell-container/CellContainer.harmony.ts +0 -31
- package/src/native/cell-container/CellContainer.ios.ts +0 -31
- package/src/native/cell-container/CellContainer.tsx +0 -38
- package/src/native/cell-container/CellContainer.web.tsx +0 -33
- package/src/utils/ContentContainerUtils.ts +0 -116
- package/src/viewability/ViewToken.ts +0 -31
package/src/FlashListProps.ts
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MIT License
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2024 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
|
-
|
|
25
1
|
import type React from "react";
|
|
26
2
|
import {
|
|
27
3
|
StyleProp,
|
|
28
4
|
ScrollViewProps,
|
|
29
5
|
ViewabilityConfig,
|
|
30
|
-
ViewabilityConfigCallbackPairs,
|
|
31
6
|
ViewStyle,
|
|
32
7
|
} from "react-native";
|
|
33
8
|
|
|
34
|
-
import
|
|
35
|
-
import ViewToken from "./viewability/ViewToken";
|
|
9
|
+
import ViewToken from "./recyclerview/viewability/ViewToken";
|
|
36
10
|
|
|
37
11
|
export interface ListRenderItemInfo<TItem> {
|
|
38
12
|
item: TItem;
|
|
@@ -47,6 +21,12 @@ export interface ListRenderItemInfo<TItem> {
|
|
|
47
21
|
extraData?: any;
|
|
48
22
|
}
|
|
49
23
|
|
|
24
|
+
export interface OverrideProps {
|
|
25
|
+
initialDrawBatchSize?: number;
|
|
26
|
+
// rest can be string to any
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
50
30
|
export type RenderTarget = "Cell" | "StickyHeader" | "Measurement";
|
|
51
31
|
|
|
52
32
|
export const RenderTargetOptions: Record<string, RenderTarget> = {
|
|
@@ -59,19 +39,21 @@ export type ListRenderItem<TItem> = (
|
|
|
59
39
|
info: ListRenderItemInfo<TItem>
|
|
60
40
|
) => React.ReactElement | null;
|
|
61
41
|
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
42
|
+
export interface ViewabilityConfigCallbackPair<TItem> {
|
|
43
|
+
viewabilityConfig: ViewabilityConfig;
|
|
44
|
+
onViewableItemsChanged:
|
|
45
|
+
| ((info: {
|
|
46
|
+
viewableItems: ViewToken<TItem>[];
|
|
47
|
+
changed: ViewToken<TItem>[];
|
|
48
|
+
}) => void)
|
|
49
|
+
| null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type ViewabilityConfigCallbackPairs<TItem> =
|
|
53
|
+
ViewabilityConfigCallbackPair<TItem>[];
|
|
54
|
+
|
|
55
|
+
export interface FlashListProps<TItem>
|
|
56
|
+
extends Omit<ScrollViewProps, "maintainVisibleContentPosition"> {
|
|
75
57
|
/**
|
|
76
58
|
* Takes an item from `data` and renders it into the list. Typical usage:
|
|
77
59
|
* ```ts
|
|
@@ -94,14 +76,6 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
94
76
|
*/
|
|
95
77
|
data: ReadonlyArray<TItem> | null | undefined;
|
|
96
78
|
|
|
97
|
-
/**
|
|
98
|
-
* Average or median size for elements in the list. Doesn't have to be very accurate but a good estimate can improve performance.
|
|
99
|
-
* 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.
|
|
100
|
-
* For vertical lists provide average height and for horizontal average width.
|
|
101
|
-
* Read more about it here: https://shopify.github.io/flash-list/docs/estimated-item-size
|
|
102
|
-
*/
|
|
103
|
-
estimatedItemSize?: number;
|
|
104
|
-
|
|
105
79
|
/**
|
|
106
80
|
* Each cell is rendered using this element.
|
|
107
81
|
* Can be a React Component Class, or a render function.
|
|
@@ -170,30 +144,11 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
170
144
|
| React.ComponentType<ScrollViewProps>
|
|
171
145
|
| React.FC<ScrollViewProps>;
|
|
172
146
|
|
|
173
|
-
/**
|
|
174
|
-
* You can use `contentContainerStyle` to apply padding that will be applied to the whole content itself.
|
|
175
|
-
* For example, you can apply this padding, so that all of your items have leading and trailing space.
|
|
176
|
-
*/
|
|
177
|
-
contentContainerStyle?: ContentStyle;
|
|
178
|
-
|
|
179
147
|
/**
|
|
180
148
|
* Draw distance for advanced rendering (in dp/px)
|
|
181
149
|
*/
|
|
182
150
|
drawDistance?: number;
|
|
183
151
|
|
|
184
|
-
/**
|
|
185
|
-
* 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).
|
|
186
|
-
* 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
|
|
187
|
-
* using header styles etc.
|
|
188
|
-
* If this isn't provided initialScrollIndex might not scroll to the provided index.
|
|
189
|
-
*/
|
|
190
|
-
estimatedFirstItemOffset?: number;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Visible height and width of the list. This is not the scroll content size.
|
|
194
|
-
*/
|
|
195
|
-
estimatedListSize?: { height: number; width: number };
|
|
196
|
-
|
|
197
152
|
/**
|
|
198
153
|
* A marker property for telling the list to re-render (since it implements PureComponent).
|
|
199
154
|
* If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
|
|
@@ -212,9 +167,11 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
212
167
|
initialScrollIndex?: number | null | undefined;
|
|
213
168
|
|
|
214
169
|
/**
|
|
215
|
-
*
|
|
170
|
+
* Additional configuration for initialScrollIndex.
|
|
171
|
+
* Use viewOffset to apply an offset to the initial scroll position as defined by initialScrollIndex.
|
|
172
|
+
* Ignored if initialScrollIndex is not set.
|
|
216
173
|
*/
|
|
217
|
-
|
|
174
|
+
initialScrollIndexParams?: { viewOffset?: number } | null | undefined;
|
|
218
175
|
|
|
219
176
|
/**
|
|
220
177
|
* Used to extract a unique key for a given item at the specified index.
|
|
@@ -230,18 +187,6 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
230
187
|
*/
|
|
231
188
|
numColumns?: number | undefined;
|
|
232
189
|
|
|
233
|
-
/**
|
|
234
|
-
* 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.
|
|
235
|
-
* Values reported: {
|
|
236
|
-
* offsetStart -> visible blank space on top of the screen (while going up). If value is greater than 0 then it's visible to user.
|
|
237
|
-
* 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.
|
|
238
|
-
* blankArea -> max(offsetStart, offsetEnd) use this directly and look for values > 0
|
|
239
|
-
* }
|
|
240
|
-
* Please note that this event isn't synced with onScroll event but works with native onDraw/layoutSubviews. Events with values > 0 are blanks.
|
|
241
|
-
* 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.
|
|
242
|
-
*/
|
|
243
|
-
onBlankArea?: BlankAreaEventHandler;
|
|
244
|
-
|
|
245
190
|
/**
|
|
246
191
|
* Called once when the scroll position gets within onEndReachedThreshold of the rendered content.
|
|
247
192
|
*/
|
|
@@ -251,7 +196,7 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
251
196
|
* How far from the end (in units of visible length of the list) the bottom edge of the
|
|
252
197
|
* list must be from the end of the content to trigger the `onEndReached` callback.
|
|
253
198
|
* Thus a value of 0.5 will trigger `onEndReached` when the end of the content is
|
|
254
|
-
* within half the visible length of the list.
|
|
199
|
+
* within half the visible length of the list. Default value is 0.5.
|
|
255
200
|
*/
|
|
256
201
|
onEndReachedThreshold?: number | null | undefined;
|
|
257
202
|
|
|
@@ -271,7 +216,10 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
271
216
|
* they might be deferred until JS thread is less busy.
|
|
272
217
|
*/
|
|
273
218
|
onViewableItemsChanged?:
|
|
274
|
-
| ((info: {
|
|
219
|
+
| ((info: {
|
|
220
|
+
viewableItems: ViewToken<TItem>[];
|
|
221
|
+
changed: ViewToken<TItem>[];
|
|
222
|
+
}) => void)
|
|
275
223
|
| null
|
|
276
224
|
| undefined;
|
|
277
225
|
|
|
@@ -294,11 +242,7 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
294
242
|
) => string | number | undefined;
|
|
295
243
|
|
|
296
244
|
/**
|
|
297
|
-
* This method can be used to
|
|
298
|
-
*
|
|
299
|
-
* Providing specific estimates is a good idea when you can calculate sizes reliably. FlashList will prefer this value over `estimatedItemSize` for that specific item.
|
|
300
|
-
* 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.
|
|
301
|
-
*
|
|
245
|
+
* This method can be used to change column span of an item.
|
|
302
246
|
* Changing item span is useful when you have grid layouts (numColumns > 1) and you want few items to be bigger than the rest.
|
|
303
247
|
*
|
|
304
248
|
* Modify the given layout. Do not return. FlashList will fallback to default values if this is ignored.
|
|
@@ -306,7 +250,7 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
306
250
|
* Performance: This method is called very frequently. Keep it fast.
|
|
307
251
|
*/
|
|
308
252
|
overrideItemLayout?: (
|
|
309
|
-
layout: { span?: number
|
|
253
|
+
layout: { span?: number },
|
|
310
254
|
item: TItem,
|
|
311
255
|
index: number,
|
|
312
256
|
maxColumns: number,
|
|
@@ -316,7 +260,7 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
316
260
|
/**
|
|
317
261
|
* For debugging and exception use cases, internal props will be overriden with these values if used
|
|
318
262
|
*/
|
|
319
|
-
overrideProps?:
|
|
263
|
+
overrideProps?: OverrideProps;
|
|
320
264
|
|
|
321
265
|
/**
|
|
322
266
|
* Set this when offset is needed for the loading indicator to show correctly.
|
|
@@ -340,20 +284,85 @@ export interface FlashListProps<TItem> extends ScrollViewProps {
|
|
|
340
284
|
* List of `ViewabilityConfig`/`onViewableItemsChanged` pairs.
|
|
341
285
|
* A specific `onViewableItemsChanged` will be called when its corresponding `ViewabilityConfig`'s conditions are met.
|
|
342
286
|
*/
|
|
343
|
-
viewabilityConfigCallbackPairs?:
|
|
287
|
+
viewabilityConfigCallbackPairs?:
|
|
288
|
+
| ViewabilityConfigCallbackPairs<TItem>
|
|
289
|
+
| undefined;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* New arch only
|
|
293
|
+
* 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.
|
|
294
|
+
* Unless you have a huge number of item types, you shouldn't need to set this.
|
|
295
|
+
* Setting this to 0, will disable the recycle pool and items will unmount once they are scrolled off the screen.
|
|
296
|
+
* There's no limit by default.
|
|
297
|
+
*/
|
|
298
|
+
maxItemsInRecyclePool?: number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* New arch only
|
|
302
|
+
* Enable masonry layout.
|
|
303
|
+
*/
|
|
304
|
+
masonry?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* New arch only
|
|
307
|
+
* If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order.
|
|
308
|
+
*/
|
|
309
|
+
optimizeItemArrangement?: boolean; // TODO: Check if this breaks on item resize or is glitchy
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* New arch only
|
|
313
|
+
* Called once when the scroll position gets within onStartReachedThreshold of the start of the content.
|
|
314
|
+
*/
|
|
315
|
+
onStartReached?: FlashListProps<TItem>["onEndReached"];
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* New arch only
|
|
319
|
+
* How far from the start (in units of visible length of the list) the top edge of the
|
|
320
|
+
* list must be from the start of the content to trigger the `onStartReached` callback.
|
|
321
|
+
* Thus a value of 0.5 will trigger `onStartReached` when the start of the content is
|
|
322
|
+
* within half the visible length of the list. Default value is 0.2.
|
|
323
|
+
*/
|
|
324
|
+
onStartReachedThreshold?: FlashListProps<TItem>["onEndReachedThreshold"];
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* New arch only
|
|
328
|
+
* Style for the RecyclerView's parent container.
|
|
329
|
+
* Please avoid anything which can mess size of children in this view. For example, margin is okay but padding is not.
|
|
330
|
+
*/
|
|
331
|
+
style?: StyleProp<ViewStyle>;
|
|
344
332
|
|
|
345
333
|
/**
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
334
|
+
* New arch only
|
|
335
|
+
* Configuration for maintaining scroll position when content changes.
|
|
336
|
+
* Useful for chat-like interfaces where new messages can be added at the top or bottom.
|
|
349
337
|
*/
|
|
350
|
-
|
|
338
|
+
maintainVisibleContentPosition?: {
|
|
339
|
+
/**
|
|
340
|
+
* maintainVisibleContentPosition is enabled by default.
|
|
341
|
+
*/
|
|
342
|
+
disabled?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* When content is added at the top, automatically scroll to maintain position if the user is within this threshold of the top
|
|
345
|
+
*/
|
|
346
|
+
autoscrollToTopThreshold?: number;
|
|
347
|
+
/**
|
|
348
|
+
* When content is added at the bottom, automatically scroll to maintain position if the user is within this threshold of the bottom
|
|
349
|
+
*/
|
|
350
|
+
autoscrollToBottomThreshold?: number;
|
|
351
|
+
/**
|
|
352
|
+
* Scroll with animation whenever `autoscrollToBottom` is triggered. Default is `true`.
|
|
353
|
+
* Default is true.
|
|
354
|
+
*/
|
|
355
|
+
animateAutoScrollToBottom?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* If true, initial render will start from the bottom of the list, useful for chat-like interfaces when there are only few messages
|
|
358
|
+
*/
|
|
359
|
+
startRenderingFromBottom?: boolean;
|
|
360
|
+
};
|
|
351
361
|
|
|
352
362
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* `false` again.
|
|
363
|
+
* New arch only
|
|
364
|
+
* Called when the layout is committed. Can be used to measure list.
|
|
365
|
+
* Doing set state inside the callback can lead to infinite loops. Make sure FlashList's props are memoized.
|
|
357
366
|
*/
|
|
358
|
-
|
|
367
|
+
onCommitLayoutEffect?: () => void;
|
|
359
368
|
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import type { RVLayout } from "./recyclerview/layout-managers/LayoutManager";
|
|
2
|
+
import { RecyclerViewProps } from "./recyclerview/RecyclerViewProps";
|
|
3
|
+
import { CompatScroller } from "./recyclerview/components/CompatScroller";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base parameters for scrolling to the edges of the list.
|
|
7
|
+
*/
|
|
8
|
+
export interface ScrollToEdgeParams {
|
|
9
|
+
/** Whether the scroll should be animated */
|
|
10
|
+
animated?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Parameters for scrolling to a specific position in the list.
|
|
15
|
+
* Extends ScrollToEdgeParams to include view positioning options.
|
|
16
|
+
*/
|
|
17
|
+
export interface ScrollToParams extends ScrollToEdgeParams {
|
|
18
|
+
/** Position of the target item relative to the viewport (0 = top, 0.5 = center, 1 = bottom) */
|
|
19
|
+
viewPosition?: number;
|
|
20
|
+
/** Additional offset to apply after viewPosition calculation */
|
|
21
|
+
viewOffset?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Parameters for scrolling to a specific offset in the list.
|
|
26
|
+
* Used when you want to scroll to an exact pixel position.
|
|
27
|
+
*/
|
|
28
|
+
export interface ScrollToOffsetParams extends ScrollToParams {
|
|
29
|
+
/** The pixel offset to scroll to */
|
|
30
|
+
offset: number;
|
|
31
|
+
/**
|
|
32
|
+
* If true, the first item offset will not be added to the offset calculation.
|
|
33
|
+
* First offset represents header size or top padding.
|
|
34
|
+
*/
|
|
35
|
+
skipFirstItemOffset?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for scrolling to a specific index in the list.
|
|
40
|
+
* Used when you want to scroll to a specific item by its position in the data array.
|
|
41
|
+
*/
|
|
42
|
+
export interface ScrollToIndexParams extends ScrollToParams {
|
|
43
|
+
/** The index of the item to scroll to */
|
|
44
|
+
index: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for scrolling to a specific item in the list.
|
|
49
|
+
* Used when you want to scroll to a specific item by its data value.
|
|
50
|
+
*/
|
|
51
|
+
export interface ScrollToItemParams<T> extends ScrollToParams {
|
|
52
|
+
/** The item to scroll to */
|
|
53
|
+
item: T;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Interface for FlashList's ref object that provides imperative methods
|
|
58
|
+
* for controlling list behavior.
|
|
59
|
+
*
|
|
60
|
+
* Usage example:
|
|
61
|
+
* ```tsx
|
|
62
|
+
* const listRef = useRef<FlashListRef<ItemType>>(null);
|
|
63
|
+
*
|
|
64
|
+
* // Later in your component
|
|
65
|
+
* <FlashList
|
|
66
|
+
* ref={listRef}
|
|
67
|
+
* data={data}
|
|
68
|
+
* renderItem={renderItem}
|
|
69
|
+
* />
|
|
70
|
+
*
|
|
71
|
+
* // Somewhere else in your component
|
|
72
|
+
* listRef.current?.scrollToIndex({ index: 5, animated: true });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export interface FlashListRef<T> {
|
|
76
|
+
/**
|
|
77
|
+
* Get access to current props
|
|
78
|
+
*/
|
|
79
|
+
props: RecyclerViewProps<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Scrolls the list to a specific offset position.
|
|
82
|
+
*
|
|
83
|
+
* Use this method when you want precise control over the scroll position in pixels
|
|
84
|
+
* rather than by item index.
|
|
85
|
+
*
|
|
86
|
+
* @param params - Parameters for scrolling to offset
|
|
87
|
+
* @param params.offset - The pixel offset to scroll to
|
|
88
|
+
* @param params.animated - Whether the scroll should be animated (default: false)
|
|
89
|
+
* @param params.skipFirstItemOffset - If true, the first item offset (headers/padding)
|
|
90
|
+
* will not be included in calculation (default: true)
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Scroll to 200px from the top/left
|
|
94
|
+
* listRef.current?.scrollToOffset({ offset: 200, animated: true });
|
|
95
|
+
*/
|
|
96
|
+
scrollToOffset: (params: ScrollToOffsetParams) => void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Makes the scroll indicators flash momentarily.
|
|
100
|
+
*
|
|
101
|
+
* Useful to indicate to users that there is more content to scroll.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* listRef.current?.flashScrollIndicators();
|
|
105
|
+
*/
|
|
106
|
+
flashScrollIndicators: () => void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns the underlying native scroll view reference.
|
|
110
|
+
*
|
|
111
|
+
* Use this when you need direct access to the native scroll component.
|
|
112
|
+
* This is generally not recommended for regular use.
|
|
113
|
+
*
|
|
114
|
+
* @returns The native scroll view reference
|
|
115
|
+
*/
|
|
116
|
+
getNativeScrollRef: () => CompatScroller | null;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns a reference to the scroll responder.
|
|
120
|
+
*
|
|
121
|
+
* Useful for more advanced scroll handling and integrations.
|
|
122
|
+
*
|
|
123
|
+
* @returns The scroll responder
|
|
124
|
+
*/
|
|
125
|
+
getScrollResponder: CompatScroller["getScrollResponder"];
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns the underlying scrollable node.
|
|
129
|
+
*
|
|
130
|
+
* Primarily used for platform-specific integrations.
|
|
131
|
+
*
|
|
132
|
+
* @returns The scrollable node
|
|
133
|
+
*/
|
|
134
|
+
getScrollableNode: () => any;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Scrolls to the end of the list.
|
|
138
|
+
*
|
|
139
|
+
* @param params - Optional parameters for scrolling
|
|
140
|
+
* @param params.animated - Whether the scroll should be animated (default: false)
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // Animate scroll to the end of the list
|
|
144
|
+
* listRef.current?.scrollToEnd({ animated: true });
|
|
145
|
+
*/
|
|
146
|
+
scrollToEnd: (params?: ScrollToEdgeParams) => void;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Scrolls to the top (or start) of the list.
|
|
150
|
+
*
|
|
151
|
+
* @param params - Optional parameters for scrolling
|
|
152
|
+
* @param params.animated - Whether the scroll should be animated (default: false)
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Smoothly scroll to the top
|
|
156
|
+
* listRef.current?.scrollToTop({ animated: true });
|
|
157
|
+
*/
|
|
158
|
+
scrollToTop: (params?: ScrollToEdgeParams) => void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Scrolls to a specific index in the list.
|
|
162
|
+
*
|
|
163
|
+
* This is the most common method to scroll to a particular item.
|
|
164
|
+
*
|
|
165
|
+
* @param params - Parameters for scrolling to index
|
|
166
|
+
* @param params.index - The index of the item to scroll to
|
|
167
|
+
* @param params.animated - Whether the scroll should be animated (default: false)
|
|
168
|
+
* @param params.viewPosition - Position of the item within the visible area:
|
|
169
|
+
* 0 = top/left, 0.5 = center, 1 = bottom/right (default: 0)
|
|
170
|
+
* @param params.viewOffset - Additional offset to apply after viewPosition calculation
|
|
171
|
+
*
|
|
172
|
+
* @returns A Promise that resolves when the scroll operation is complete
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* // Scroll to the 5th item (index 4) and center it
|
|
176
|
+
* listRef.current?.scrollToIndex({
|
|
177
|
+
* index: 4,
|
|
178
|
+
* animated: true,
|
|
179
|
+
* viewPosition: 0.5
|
|
180
|
+
* });
|
|
181
|
+
*/
|
|
182
|
+
scrollToIndex: (params: ScrollToIndexParams) => Promise<void>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Scrolls to a specific item in the list.
|
|
186
|
+
*
|
|
187
|
+
* Similar to scrollToIndex, but works with the item reference instead of its index.
|
|
188
|
+
* Useful when you have a reference to an item but don't know its index.
|
|
189
|
+
*
|
|
190
|
+
* @param params - Parameters for scrolling to item
|
|
191
|
+
* @param params.item - The item object to scroll to
|
|
192
|
+
* @param params.animated - Whether the scroll should be animated (default: false)
|
|
193
|
+
* @param params.viewPosition - Position of the item within the visible area:
|
|
194
|
+
* 0 = top/left, 0.5 = center, 1 = bottom/right (default: 0)
|
|
195
|
+
* @param params.viewOffset - Additional offset to apply after viewPosition calculation
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* // Scroll to a specific item
|
|
199
|
+
* const targetItem = data[10];
|
|
200
|
+
* listRef.current?.scrollToItem({
|
|
201
|
+
* item: targetItem,
|
|
202
|
+
* animated: true
|
|
203
|
+
* });
|
|
204
|
+
*/
|
|
205
|
+
scrollToItem: (params: ScrollToItemParams<T>) => void;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns the offset of the first item (accounts for header/padding).
|
|
209
|
+
*
|
|
210
|
+
* Useful when implementing custom scroll behavior or calculating positions.
|
|
211
|
+
*
|
|
212
|
+
* @returns The pixel offset of the first item
|
|
213
|
+
*/
|
|
214
|
+
getFirstItemOffset: () => number;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Returns the current viewport dimensions.
|
|
218
|
+
*
|
|
219
|
+
* @returns An object with width and height properties representing viewport size
|
|
220
|
+
*/
|
|
221
|
+
getWindowSize: () => { width: number; height: number };
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Returns the layout information for a specific item.
|
|
225
|
+
*
|
|
226
|
+
* Use this to get position and size information for an item at a given index.
|
|
227
|
+
*
|
|
228
|
+
* @param index - The index of the item to get layout information for
|
|
229
|
+
* @returns Layout information including x, y, width, and height
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* const itemLayout = listRef.current?.getLayout(5);
|
|
233
|
+
* console.log(`Item 5 position: (${itemLayout.x}, ${itemLayout.y})`);
|
|
234
|
+
*/
|
|
235
|
+
getLayout: (index: number) => RVLayout | undefined;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Returns the absolute last scroll offset.
|
|
239
|
+
*
|
|
240
|
+
* Useful for implementing custom scroll tracking functionality.
|
|
241
|
+
*
|
|
242
|
+
* @returns The last scroll offset in pixels
|
|
243
|
+
*/
|
|
244
|
+
getAbsoluteLastScrollOffset: () => number;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Returns the dimensions of the child container.
|
|
248
|
+
*
|
|
249
|
+
* @returns An object with width and height properties
|
|
250
|
+
*/
|
|
251
|
+
getChildContainerDimensions: () => { width: number; height: number };
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Marks the list as having been interacted with.
|
|
255
|
+
*
|
|
256
|
+
* Call this method when you want to manually trigger the onViewableItemsChanged
|
|
257
|
+
* callback without an actual scroll event.
|
|
258
|
+
*/
|
|
259
|
+
recordInteraction: () => void;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Returns the currently visible item indices.
|
|
263
|
+
*
|
|
264
|
+
* Use this to determine which items are currently visible to the user.
|
|
265
|
+
*
|
|
266
|
+
* @returns An object with startIndex and endIndex properties
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* const { startIndex, endIndex } = listRef.current?.getVisibleIndices();
|
|
270
|
+
* console.log(`Visible items: ${startIndex} to ${endIndex}`);
|
|
271
|
+
*/
|
|
272
|
+
computeVisibleIndices: () => { startIndex: number; endIndex: number };
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Returns the index of the first visible item.
|
|
276
|
+
*
|
|
277
|
+
* Convenience method when you only need the first visible item.
|
|
278
|
+
*
|
|
279
|
+
* @returns The index of the first visible item
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* const firstVisibleIndex = listRef.current?.getFirstVisibleIndex();
|
|
283
|
+
*/
|
|
284
|
+
getFirstVisibleIndex: () => number;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Forces recalculation of viewable items (vieability callbacks).
|
|
288
|
+
*
|
|
289
|
+
* Call this after any operation that might affect item visibility but
|
|
290
|
+
* doesn't trigger a scroll event.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* // After manually changing item sizes
|
|
294
|
+
* listRef.current?.recomputeViewableItems();
|
|
295
|
+
*/
|
|
296
|
+
recomputeViewableItems: () => void;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Disables item recycling in preparation for layout animations.
|
|
300
|
+
*
|
|
301
|
+
* Call this before performing layout animations to prevent visual glitches.
|
|
302
|
+
* Remember to reset disableRecycling after animations complete.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* // Before starting layout animations
|
|
306
|
+
* listRef.current?.prepareForLayoutAnimationRender();
|
|
307
|
+
*/
|
|
308
|
+
prepareForLayoutAnimationRender: () => void;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Clears the layout cache on update.
|
|
312
|
+
* Call this when you want to clear the layout cache on update.
|
|
313
|
+
* Can be useful for carousals when orientation changes.
|
|
314
|
+
* This should be called before the render and not in an effect.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* listRef.current?.clearLayoutCacheOnUpdate();
|
|
318
|
+
*/
|
|
319
|
+
clearLayoutCacheOnUpdate: () => void;
|
|
320
|
+
}
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MIT License
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2024 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
|
-
|
|
25
1
|
/**
|
|
26
2
|
* This method can be used to trigger scroll events that can be forwarded to an element. Anything that implements scrollable can leverage this.
|
|
27
3
|
* @param scroll The scrollable element
|