@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
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { ErrorMessages } from "../errors/ErrorMessages";
|
|
2
|
+
import { WarningMessages } from "../errors/WarningMessages";
|
|
3
|
+
|
|
4
|
+
import ViewabilityManager from "./viewability/ViewabilityManager";
|
|
5
|
+
import { ConsecutiveNumbers } from "./helpers/ConsecutiveNumbers";
|
|
6
|
+
import { RVGridLayoutManagerImpl } from "./layout-managers/GridLayoutManager";
|
|
7
|
+
import {
|
|
8
|
+
LayoutParams,
|
|
9
|
+
RVDimension,
|
|
10
|
+
RVLayoutInfo,
|
|
11
|
+
RVLayoutManager,
|
|
12
|
+
SpanSizeInfo,
|
|
13
|
+
} from "./layout-managers/LayoutManager";
|
|
14
|
+
import { RVLinearLayoutManagerImpl } from "./layout-managers/LinearLayoutManager";
|
|
15
|
+
import { RVMasonryLayoutManagerImpl } from "./layout-managers/MasonryLayoutManager";
|
|
16
|
+
import { RecyclerViewProps } from "./RecyclerViewProps";
|
|
17
|
+
import {
|
|
18
|
+
RVEngagedIndicesTracker,
|
|
19
|
+
RVEngagedIndicesTrackerImpl,
|
|
20
|
+
Velocity,
|
|
21
|
+
} from "./helpers/EngagedIndicesTracker";
|
|
22
|
+
import { RenderStackManager } from "./RenderStackManager";
|
|
23
|
+
// Abstracts layout manager, render stack manager and viewability manager and generates render stack (progressively on load)
|
|
24
|
+
export class RecyclerViewManager<T> {
|
|
25
|
+
private initialDrawBatchSize = 2;
|
|
26
|
+
private engagedIndicesTracker: RVEngagedIndicesTracker;
|
|
27
|
+
private renderStackManager: RenderStackManager;
|
|
28
|
+
private layoutManager?: RVLayoutManager;
|
|
29
|
+
// Map of index to key
|
|
30
|
+
private isFirstLayoutComplete = false;
|
|
31
|
+
private hasRenderedProgressively = false;
|
|
32
|
+
private progressiveRenderCount = 0;
|
|
33
|
+
private propsRef: RecyclerViewProps<T>;
|
|
34
|
+
private itemViewabilityManager: ViewabilityManager<T>;
|
|
35
|
+
private _isDisposed = false;
|
|
36
|
+
private _isLayoutManagerDirty = false;
|
|
37
|
+
private _animationOptimizationsEnabled = false;
|
|
38
|
+
|
|
39
|
+
public firstItemOffset = 0;
|
|
40
|
+
public ignoreScrollEvents = false;
|
|
41
|
+
public isFirstPaintOnUiComplete = false;
|
|
42
|
+
|
|
43
|
+
public get animationOptimizationsEnabled() {
|
|
44
|
+
return this._animationOptimizationsEnabled;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public set animationOptimizationsEnabled(value: boolean) {
|
|
48
|
+
this._animationOptimizationsEnabled = value;
|
|
49
|
+
this.renderStackManager.disableRecycling = value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public get isOffsetProjectionEnabled() {
|
|
53
|
+
return this.engagedIndicesTracker.enableOffsetProjection;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public get isDisposed() {
|
|
57
|
+
return this._isDisposed;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public get numColumns() {
|
|
61
|
+
return this.propsRef.numColumns ?? 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
constructor(props: RecyclerViewProps<T>) {
|
|
65
|
+
this.getDataKey = this.getDataKey.bind(this);
|
|
66
|
+
this.getItemType = this.getItemType.bind(this);
|
|
67
|
+
this.overrideItemLayout = this.overrideItemLayout.bind(this);
|
|
68
|
+
this.propsRef = props;
|
|
69
|
+
this.engagedIndicesTracker = new RVEngagedIndicesTrackerImpl();
|
|
70
|
+
this.renderStackManager = new RenderStackManager(
|
|
71
|
+
props.maxItemsInRecyclePool
|
|
72
|
+
);
|
|
73
|
+
this.itemViewabilityManager = new ViewabilityManager<T>(this as any);
|
|
74
|
+
this.checkPropsAndWarn();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// updates render stack based on the engaged indices which are sorted. Recycles unused keys.
|
|
78
|
+
private updateRenderStack = (engagedIndices: ConsecutiveNumbers): void => {
|
|
79
|
+
this.renderStackManager.sync(
|
|
80
|
+
this.getDataKey,
|
|
81
|
+
this.getItemType,
|
|
82
|
+
engagedIndices,
|
|
83
|
+
this.getDataLength()
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
get props() {
|
|
88
|
+
return this.propsRef;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setOffsetProjectionEnabled(value: boolean) {
|
|
92
|
+
this.engagedIndicesTracker.enableOffsetProjection = value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
updateProps(props: RecyclerViewProps<T>) {
|
|
96
|
+
this.propsRef = props;
|
|
97
|
+
this.engagedIndicesTracker.drawDistance =
|
|
98
|
+
props.drawDistance ?? this.engagedIndicesTracker.drawDistance;
|
|
99
|
+
this.initialDrawBatchSize =
|
|
100
|
+
this.propsRef.overrideProps?.initialDrawBatchSize ??
|
|
101
|
+
this.initialDrawBatchSize;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Updates the scroll offset and returns the engaged indices if any
|
|
106
|
+
* @param offset
|
|
107
|
+
* @param velocity
|
|
108
|
+
*/
|
|
109
|
+
updateScrollOffset(
|
|
110
|
+
offset: number,
|
|
111
|
+
velocity?: Velocity
|
|
112
|
+
): ConsecutiveNumbers | undefined {
|
|
113
|
+
if (this.layoutManager && !this._isDisposed) {
|
|
114
|
+
const engagedIndices = this.engagedIndicesTracker.updateScrollOffset(
|
|
115
|
+
offset - this.firstItemOffset,
|
|
116
|
+
velocity,
|
|
117
|
+
this.layoutManager
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
if (engagedIndices) {
|
|
121
|
+
this.updateRenderStack(engagedIndices);
|
|
122
|
+
return engagedIndices;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
updateAverageRenderTime(time: number) {
|
|
129
|
+
this.engagedIndicesTracker.averageRenderTime = time;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
getIsFirstLayoutComplete() {
|
|
133
|
+
return this.isFirstLayoutComplete;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getLayout(index: number) {
|
|
137
|
+
if (!this.layoutManager) {
|
|
138
|
+
throw new Error(ErrorMessages.layoutManagerNotInitializedLayoutInfo);
|
|
139
|
+
}
|
|
140
|
+
return this.layoutManager.getLayout(index);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
tryGetLayout(index: number) {
|
|
144
|
+
if (
|
|
145
|
+
this.layoutManager &&
|
|
146
|
+
index >= 0 &&
|
|
147
|
+
index < this.layoutManager.getLayoutCount()
|
|
148
|
+
) {
|
|
149
|
+
return this.layoutManager.getLayout(index);
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Doesn't include header / foot etc
|
|
155
|
+
getChildContainerDimensions() {
|
|
156
|
+
if (!this.layoutManager) {
|
|
157
|
+
throw new Error(ErrorMessages.layoutManagerNotInitializedChildContainer);
|
|
158
|
+
}
|
|
159
|
+
return this.layoutManager.getLayoutSize();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
getRenderStack() {
|
|
163
|
+
return this.renderStackManager.getRenderStack();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
getWindowSize() {
|
|
167
|
+
if (!this.layoutManager) {
|
|
168
|
+
throw new Error(ErrorMessages.layoutManagerNotInitializedWindowSize);
|
|
169
|
+
}
|
|
170
|
+
return this.layoutManager.getWindowsSize();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Includes first item offset correction
|
|
174
|
+
getLastScrollOffset() {
|
|
175
|
+
return this.engagedIndicesTracker.scrollOffset;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
getMaxScrollOffset() {
|
|
179
|
+
return Math.max(
|
|
180
|
+
0,
|
|
181
|
+
(this.propsRef.horizontal
|
|
182
|
+
? this.getChildContainerDimensions().width
|
|
183
|
+
: this.getChildContainerDimensions().height) -
|
|
184
|
+
(this.propsRef.horizontal
|
|
185
|
+
? this.getWindowSize().width
|
|
186
|
+
: this.getWindowSize().height) +
|
|
187
|
+
this.firstItemOffset
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Doesn't include first item offset correction
|
|
192
|
+
getAbsoluteLastScrollOffset() {
|
|
193
|
+
return this.engagedIndicesTracker.scrollOffset + this.firstItemOffset;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
setScrollDirection(scrollDirection: "forward" | "backward") {
|
|
197
|
+
this.engagedIndicesTracker.setScrollDirection(scrollDirection);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
resetVelocityCompute() {
|
|
201
|
+
this.engagedIndicesTracker.resetVelocityHistory();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
updateLayoutParams(windowSize: RVDimension, firstItemOffset: number) {
|
|
205
|
+
this.firstItemOffset = firstItemOffset;
|
|
206
|
+
const LayoutManagerClass = this.getLayoutManagerClass();
|
|
207
|
+
if (
|
|
208
|
+
this.layoutManager &&
|
|
209
|
+
Boolean(this.layoutManager?.isHorizontal()) !==
|
|
210
|
+
Boolean(this.propsRef.horizontal)
|
|
211
|
+
) {
|
|
212
|
+
throw new Error(ErrorMessages.horizontalPropCannotBeToggled);
|
|
213
|
+
}
|
|
214
|
+
if (this._isLayoutManagerDirty) {
|
|
215
|
+
this.layoutManager = undefined;
|
|
216
|
+
this._isLayoutManagerDirty = false;
|
|
217
|
+
}
|
|
218
|
+
const layoutManagerParams: LayoutParams = {
|
|
219
|
+
windowSize,
|
|
220
|
+
maxColumns: this.numColumns,
|
|
221
|
+
horizontal: Boolean(this.propsRef.horizontal),
|
|
222
|
+
optimizeItemArrangement: this.propsRef.optimizeItemArrangement ?? true,
|
|
223
|
+
overrideItemLayout: this.overrideItemLayout,
|
|
224
|
+
getItemType: this.getItemType,
|
|
225
|
+
};
|
|
226
|
+
if (!(this.layoutManager instanceof LayoutManagerClass)) {
|
|
227
|
+
// console.log("-----> new LayoutManagerClass");
|
|
228
|
+
|
|
229
|
+
this.layoutManager = new LayoutManagerClass(
|
|
230
|
+
layoutManagerParams,
|
|
231
|
+
this.layoutManager
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
this.layoutManager.updateLayoutParams(layoutManagerParams);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
hasLayout() {
|
|
239
|
+
return this.layoutManager !== undefined;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
computeVisibleIndices() {
|
|
243
|
+
if (!this.layoutManager) {
|
|
244
|
+
throw new Error(ErrorMessages.layoutManagerNotInitializedVisibleIndices);
|
|
245
|
+
}
|
|
246
|
+
return this.engagedIndicesTracker.computeVisibleIndices(this.layoutManager);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getEngagedIndices() {
|
|
250
|
+
return this.engagedIndicesTracker.getEngagedIndices();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
modifyChildrenLayout(
|
|
254
|
+
layoutInfo: RVLayoutInfo[],
|
|
255
|
+
dataLength: number
|
|
256
|
+
): boolean {
|
|
257
|
+
this.layoutManager?.modifyLayout(layoutInfo, dataLength);
|
|
258
|
+
if (dataLength === 0) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
if (this.layoutManager?.requiresRepaint) {
|
|
262
|
+
// console.log("requiresRepaint triggered");
|
|
263
|
+
this.layoutManager.requiresRepaint = false;
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
if (this.hasRenderedProgressively) {
|
|
267
|
+
if (!this.isFirstPaintOnUiComplete) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
return this.recomputeEngagedIndices() !== undefined;
|
|
271
|
+
} else {
|
|
272
|
+
this.renderProgressively();
|
|
273
|
+
}
|
|
274
|
+
return !this.hasRenderedProgressively;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
computeItemViewability() {
|
|
278
|
+
// Using higher buffer for masonry to avoid missing items
|
|
279
|
+
this.itemViewabilityManager.shouldListenToVisibleIndices &&
|
|
280
|
+
this.itemViewabilityManager.updateViewableItems(
|
|
281
|
+
this.propsRef.masonry
|
|
282
|
+
? this.engagedIndicesTracker.getEngagedIndices().toArray()
|
|
283
|
+
: this.computeVisibleIndices().toArray()
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
recordInteraction() {
|
|
288
|
+
this.itemViewabilityManager.recordInteraction();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
recomputeViewableItems() {
|
|
292
|
+
this.itemViewabilityManager.recomputeViewableItems();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
processDataUpdate() {
|
|
296
|
+
if (this.hasLayout()) {
|
|
297
|
+
this.modifyChildrenLayout([], this.propsRef.data?.length ?? 0);
|
|
298
|
+
if (this.hasRenderedProgressively && !this.recomputeEngagedIndices()) {
|
|
299
|
+
// recomputeEngagedIndices will update the render stack if there are any changes in the engaged indices.
|
|
300
|
+
// It's important to update render stack so that elements are assgined right keys incase items were deleted.
|
|
301
|
+
this.updateRenderStack(this.engagedIndicesTracker.getEngagedIndices());
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
recomputeEngagedIndices(): ConsecutiveNumbers | undefined {
|
|
307
|
+
return this.updateScrollOffset(this.getAbsoluteLastScrollOffset());
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
restoreIfNeeded() {
|
|
311
|
+
if (this._isDisposed) {
|
|
312
|
+
this._isDisposed = false;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
dispose() {
|
|
317
|
+
this._isDisposed = true;
|
|
318
|
+
this.itemViewabilityManager.dispose();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
markLayoutManagerDirty() {
|
|
322
|
+
this._isLayoutManagerDirty = true;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
getInitialScrollIndex() {
|
|
326
|
+
return (
|
|
327
|
+
this.propsRef.initialScrollIndex ??
|
|
328
|
+
(this.propsRef.maintainVisibleContentPosition?.startRenderingFromBottom
|
|
329
|
+
? this.getDataLength() - 1
|
|
330
|
+
: undefined)
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
shouldMaintainVisibleContentPosition() {
|
|
335
|
+
// Return true if maintainVisibleContentPosition is enabled and not horizontal
|
|
336
|
+
return (
|
|
337
|
+
!this.propsRef.maintainVisibleContentPosition?.disabled &&
|
|
338
|
+
!this.propsRef.horizontal
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
getDataLength() {
|
|
343
|
+
return this.propsRef.data?.length ?? 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
hasStableDataKeys() {
|
|
347
|
+
return Boolean(this.propsRef.keyExtractor);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
getDataKey(index: number): string {
|
|
351
|
+
return (
|
|
352
|
+
this.propsRef.keyExtractor?.(this.propsRef.data![index], index) ??
|
|
353
|
+
index.toString()
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
private getLayoutManagerClass() {
|
|
358
|
+
// throw errors for incompatible props
|
|
359
|
+
if (this.propsRef.masonry && this.propsRef.horizontal) {
|
|
360
|
+
throw new Error(ErrorMessages.masonryAndHorizontalIncompatible);
|
|
361
|
+
}
|
|
362
|
+
if (this.numColumns > 1 && this.propsRef.horizontal) {
|
|
363
|
+
throw new Error(ErrorMessages.numColumnsAndHorizontalIncompatible);
|
|
364
|
+
}
|
|
365
|
+
return this.propsRef.masonry
|
|
366
|
+
? RVMasonryLayoutManagerImpl
|
|
367
|
+
: this.numColumns > 1 && !this.propsRef.horizontal
|
|
368
|
+
? RVGridLayoutManagerImpl
|
|
369
|
+
: RVLinearLayoutManagerImpl;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
private applyInitialScrollAdjustment() {
|
|
373
|
+
if (!this.layoutManager || this.getDataLength() === 0) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const initialScrollIndex = this.getInitialScrollIndex();
|
|
378
|
+
const initialItemLayout = this.layoutManager?.getLayout(
|
|
379
|
+
initialScrollIndex ?? 0
|
|
380
|
+
);
|
|
381
|
+
const initialItemOffset = this.propsRef.horizontal
|
|
382
|
+
? initialItemLayout?.x
|
|
383
|
+
: initialItemLayout?.y;
|
|
384
|
+
|
|
385
|
+
if (initialScrollIndex !== undefined) {
|
|
386
|
+
// console.log(
|
|
387
|
+
// "initialItemOffset",
|
|
388
|
+
// initialScrollIndex,
|
|
389
|
+
// initialItemOffset,
|
|
390
|
+
// this.firstItemOffset
|
|
391
|
+
// );
|
|
392
|
+
this.layoutManager.recomputeLayouts(0, initialScrollIndex);
|
|
393
|
+
this.engagedIndicesTracker.scrollOffset =
|
|
394
|
+
initialItemOffset ?? 0 + this.firstItemOffset;
|
|
395
|
+
} else {
|
|
396
|
+
// console.log("initialItemOffset", initialItemOffset, this.firstItemOffset);
|
|
397
|
+
this.engagedIndicesTracker.scrollOffset =
|
|
398
|
+
(initialItemOffset ?? 0) - this.firstItemOffset;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private renderProgressively() {
|
|
403
|
+
this.progressiveRenderCount++;
|
|
404
|
+
const layoutManager = this.layoutManager;
|
|
405
|
+
if (layoutManager) {
|
|
406
|
+
this.applyInitialScrollAdjustment();
|
|
407
|
+
const visibleIndices = this.computeVisibleIndices();
|
|
408
|
+
// console.log("---------> visibleIndices", visibleIndices);
|
|
409
|
+
this.hasRenderedProgressively = visibleIndices.every(
|
|
410
|
+
(index) =>
|
|
411
|
+
layoutManager.getLayout(index).isHeightMeasured &&
|
|
412
|
+
layoutManager.getLayout(index).isWidthMeasured
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
if (this.hasRenderedProgressively) {
|
|
416
|
+
this.isFirstLayoutComplete = true;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const batchSize =
|
|
420
|
+
this.numColumns *
|
|
421
|
+
this.initialDrawBatchSize ** Math.ceil(this.progressiveRenderCount / 5);
|
|
422
|
+
|
|
423
|
+
// If everything is measured then render stack will be in sync. The buffer items will get rendered in the next update
|
|
424
|
+
// triggered by the useOnLoad hook.
|
|
425
|
+
!this.hasRenderedProgressively &&
|
|
426
|
+
this.updateRenderStack(
|
|
427
|
+
// pick first n indices from visible ones based on batch size
|
|
428
|
+
visibleIndices.slice(
|
|
429
|
+
0,
|
|
430
|
+
Math.min(
|
|
431
|
+
visibleIndices.length,
|
|
432
|
+
this.getRenderStack().size + batchSize
|
|
433
|
+
)
|
|
434
|
+
)
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
private getItemType(index: number): string {
|
|
440
|
+
return (
|
|
441
|
+
this.propsRef.getItemType?.(this.propsRef.data![index], index) ??
|
|
442
|
+
"default"
|
|
443
|
+
).toString();
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
private overrideItemLayout(index: number, layout: SpanSizeInfo) {
|
|
447
|
+
this.propsRef?.overrideItemLayout?.(
|
|
448
|
+
layout,
|
|
449
|
+
this.propsRef.data![index],
|
|
450
|
+
index,
|
|
451
|
+
this.numColumns,
|
|
452
|
+
this.propsRef.extraData
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
private checkPropsAndWarn() {
|
|
457
|
+
if (this.propsRef.onStartReached && !this.propsRef.keyExtractor) {
|
|
458
|
+
console.warn(WarningMessages.keyExtractorNotDefinedForMVCP);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FlashListProps as RecyclerViewProps } from "../FlashListProps";
|