@shopify/flash-list 1.8.0 → 2.0.0-alpha.10
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/README.md +179 -27
- package/dist/AnimatedFlashList.d.ts +0 -1
- package/dist/AnimatedFlashList.d.ts.map +1 -1
- package/dist/FlashList.js +2 -3
- package/dist/FlashList.js.map +1 -1
- package/dist/FlashListProps.d.ts +68 -5
- package/dist/FlashListProps.d.ts.map +1 -1
- package/dist/GridLayoutProviderWithProps.js +1 -2
- package/dist/GridLayoutProviderWithProps.js.map +1 -1
- package/dist/MasonryFlashList.d.ts +2 -2
- package/dist/MasonryFlashList.d.ts.map +1 -1
- package/dist/MasonryFlashList.js.map +1 -1
- package/dist/PureComponentWrapper.js +1 -1
- package/dist/PureComponentWrapper.js.map +1 -1
- package/dist/__tests__/AverageWindow.test.js +35 -0
- package/dist/__tests__/AverageWindow.test.js.map +1 -1
- package/dist/__tests__/ConsecutiveNumbers.test.d.ts +2 -0
- package/dist/__tests__/ConsecutiveNumbers.test.d.ts.map +1 -0
- package/dist/__tests__/ConsecutiveNumbers.test.js +224 -0
- package/dist/__tests__/ConsecutiveNumbers.test.js.map +1 -0
- package/dist/__tests__/FlashList.test.js.map +1 -1
- package/dist/__tests__/GridLayoutManager.test.d.ts +2 -0
- package/dist/__tests__/GridLayoutManager.test.d.ts.map +1 -0
- package/dist/__tests__/GridLayoutManager.test.js +69 -0
- package/dist/__tests__/GridLayoutManager.test.js.map +1 -0
- package/dist/__tests__/GridLayoutProviderWithProps.test.js.map +1 -1
- package/dist/__tests__/LinearLayoutManager.test.d.ts +2 -0
- package/dist/__tests__/LinearLayoutManager.test.d.ts.map +1 -0
- package/dist/__tests__/LinearLayoutManager.test.js +140 -0
- package/dist/__tests__/LinearLayoutManager.test.js.map +1 -0
- package/dist/__tests__/MasonryFlashList.test.js.map +1 -1
- package/dist/__tests__/MasonryLayoutManager.test.d.ts +2 -0
- package/dist/__tests__/MasonryLayoutManager.test.d.ts.map +1 -0
- package/dist/__tests__/MasonryLayoutManager.test.js +148 -0
- package/dist/__tests__/MasonryLayoutManager.test.js.map +1 -0
- package/dist/__tests__/RecycleKeyManager.test.d.ts +2 -0
- package/dist/__tests__/RecycleKeyManager.test.d.ts.map +1 -0
- package/dist/__tests__/RecycleKeyManager.test.js +210 -0
- package/dist/__tests__/RecycleKeyManager.test.js.map +1 -0
- package/dist/__tests__/RecyclerView.test.d.ts +2 -0
- package/dist/__tests__/RecyclerView.test.d.ts.map +1 -0
- package/dist/__tests__/RecyclerView.test.js +59 -0
- package/dist/__tests__/RecyclerView.test.js.map +1 -0
- package/dist/__tests__/ViewabilityHelper.test.js.map +1 -1
- package/dist/__tests__/findVisibleIndex.test.d.ts +2 -0
- package/dist/__tests__/findVisibleIndex.test.d.ts.map +1 -0
- package/dist/__tests__/findVisibleIndex.test.js +259 -0
- package/dist/__tests__/findVisibleIndex.test.js.map +1 -0
- package/dist/__tests__/helpers/createLayoutManager.d.ts +34 -0
- package/dist/__tests__/helpers/createLayoutManager.d.ts.map +1 -0
- package/dist/__tests__/helpers/createLayoutManager.js +111 -0
- package/dist/__tests__/helpers/createLayoutManager.js.map +1 -0
- package/dist/__tests__/helpers/mountFlashList.d.ts +2 -2
- package/dist/__tests__/helpers/mountFlashList.d.ts.map +1 -1
- package/dist/__tests__/helpers/mountFlashList.js +2 -2
- package/dist/__tests__/helpers/mountFlashList.js.map +1 -1
- package/dist/__tests__/helpers/mountMasonryFlashList.d.ts +2 -2
- package/dist/__tests__/helpers/mountMasonryFlashList.d.ts.map +1 -1
- package/dist/__tests__/helpers/mountMasonryFlashList.js +2 -2
- package/dist/__tests__/helpers/mountMasonryFlashList.js.map +1 -1
- package/dist/__tests__/useBlankAreaTracker.test.js.map +1 -1
- package/dist/__tests__/useUnmountAwareCallbacks.test.d.ts +2 -0
- package/dist/__tests__/useUnmountAwareCallbacks.test.d.ts.map +1 -0
- package/dist/__tests__/useUnmountAwareCallbacks.test.js +185 -0
- package/dist/__tests__/useUnmountAwareCallbacks.test.js.map +1 -0
- package/dist/benchmark/AutoScrollHelper.js +2 -2
- package/dist/benchmark/AutoScrollHelper.js.map +1 -1
- package/dist/benchmark/JSFPSMonitor.js.map +1 -1
- package/dist/benchmark/roundToDecimalPlaces.js +1 -2
- package/dist/benchmark/roundToDecimalPlaces.js.map +1 -1
- package/dist/benchmark/useBenchmark.js +2 -3
- package/dist/benchmark/useBenchmark.js.map +1 -1
- package/dist/benchmark/useBlankAreaTracker.js +1 -2
- package/dist/benchmark/useBlankAreaTracker.js.map +1 -1
- package/dist/benchmark/useDataMultiplier.js +1 -2
- package/dist/benchmark/useDataMultiplier.js.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.d.ts +0 -1
- package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.js +1 -2
- package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
- package/dist/enableNewCore.d.ts +3 -0
- package/dist/enableNewCore.d.ts.map +1 -0
- package/dist/enableNewCore.js +25 -0
- package/dist/enableNewCore.js.map +1 -0
- package/dist/errors/CustomError.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -8
- package/dist/index.js.map +1 -1
- package/dist/native/auto-layout/AutoLayoutView.d.ts +1 -1
- package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutView.js +1 -1
- package/dist/native/auto-layout/AutoLayoutView.js.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.android.d.ts +2 -0
- package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.android.js +2 -0
- package/dist/native/config/PlatformHelper.android.js.map +1 -1
- package/dist/native/config/PlatformHelper.d.ts +2 -0
- package/dist/native/config/PlatformHelper.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.d.ts +2 -0
- package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.js +2 -0
- package/dist/native/config/PlatformHelper.ios.js.map +1 -1
- package/dist/native/config/PlatformHelper.js +2 -0
- package/dist/native/config/PlatformHelper.js.map +1 -1
- package/dist/native/config/PlatformHelper.web.d.ts +2 -0
- package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.web.js +3 -1
- package/dist/native/config/PlatformHelper.web.js.map +1 -1
- package/dist/recyclerview/RecycleKeyManager.d.ts +82 -0
- package/dist/recyclerview/RecycleKeyManager.d.ts.map +1 -0
- package/dist/recyclerview/RecycleKeyManager.js +135 -0
- package/dist/recyclerview/RecycleKeyManager.js.map +1 -0
- package/dist/recyclerview/RecyclerView.d.ts +12 -0
- package/dist/recyclerview/RecyclerView.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerView.js +300 -0
- package/dist/recyclerview/RecyclerView.js.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts +11 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js +11 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts +62 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.js +371 -0
- package/dist/recyclerview/RecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts +9 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.js +3 -0
- package/dist/recyclerview/RecyclerViewProps.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 +96 -0
- package/dist/recyclerview/ViewHolder.js.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts +57 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.js +74 -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 +8 -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 +8 -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 +34 -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 +111 -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 +122 -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 +209 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.js.map +1 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +10 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.js +39 -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 +70 -0
- package/dist/recyclerview/helpers/VelocityTracker.js.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts +18 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.js +101 -0
- package/dist/recyclerview/hooks/useBoundDetection.js.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts +12 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.js +42 -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 +19 -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 +74 -0
- package/dist/recyclerview/hooks/useOnLoad.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +72 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.js +424 -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 +30 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts +16 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.js +53 -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 +96 -0
- package/dist/recyclerview/hooks/useSecondaryProps.js.map +1 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts +8 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js +34 -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 +28 -0
- package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +65 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js +201 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts +282 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.js +254 -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 +191 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +73 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +272 -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 +17 -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 +32 -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 +80 -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 +107 -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 +89 -0
- package/dist/recyclerview/utils/measureLayout.web.js.map +1 -0
- package/dist/specs/AutoLayoutNativeComponent.d.ts +1 -2
- package/dist/specs/AutoLayoutNativeComponent.d.ts.map +1 -1
- package/dist/specs/CellContainerNativeComponent.d.ts +0 -1
- package/dist/specs/CellContainerNativeComponent.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/AverageWindow.d.ts +13 -0
- package/dist/utils/AverageWindow.d.ts.map +1 -1
- package/dist/utils/AverageWindow.js +30 -1
- package/dist/utils/AverageWindow.js.map +1 -1
- package/dist/utils/ContentContainerUtils.d.ts.map +1 -1
- package/dist/utils/ContentContainerUtils.js.map +1 -1
- package/dist/viewability/ViewabilityHelper.js.map +1 -1
- package/dist/viewability/ViewabilityManager.d.ts.map +1 -1
- package/dist/viewability/ViewabilityManager.js.map +1 -1
- package/package.json +4 -3
- package/src/FlashList.tsx +1 -1
- package/src/FlashListProps.ts +73 -2
- package/src/__tests__/AverageWindow.test.ts +49 -1
- package/src/__tests__/ConsecutiveNumbers.test.ts +232 -0
- package/src/__tests__/GridLayoutManager.test.ts +113 -0
- package/src/__tests__/LinearLayoutManager.test.ts +227 -0
- package/src/__tests__/MasonryLayoutManager.test.ts +202 -0
- package/src/__tests__/RecycleKeyManager.test.ts +254 -0
- package/src/__tests__/RecyclerView.test.tsx +69 -0
- package/src/__tests__/findVisibleIndex.test.ts +369 -0
- package/src/__tests__/helpers/createLayoutManager.ts +142 -0
- package/src/__tests__/useUnmountAwareCallbacks.test.tsx +285 -0
- package/src/enableNewCore.ts +24 -0
- package/src/index.ts +27 -0
- package/src/native/config/PlatformHelper.android.ts +2 -0
- package/src/native/config/PlatformHelper.ios.ts +2 -0
- package/src/native/config/PlatformHelper.ts +2 -0
- package/src/native/config/PlatformHelper.web.ts +3 -1
- package/src/recyclerview/RecycleKeyManager.ts +185 -0
- package/src/recyclerview/RecyclerView.tsx +535 -0
- package/src/recyclerview/RecyclerViewContextProvider.ts +20 -0
- package/src/recyclerview/RecyclerViewManager.ts +434 -0
- package/src/recyclerview/RecyclerViewProps.ts +11 -0
- package/src/recyclerview/ViewHolder.tsx +178 -0
- package/src/recyclerview/ViewHolderCollection.tsx +165 -0
- package/src/recyclerview/components/CompatScroller.ts +9 -0
- package/src/recyclerview/components/CompatView.ts +9 -0
- package/src/recyclerview/components/ScrollAnchor.tsx +54 -0
- package/src/recyclerview/components/StickyHeaders.tsx +204 -0
- package/src/recyclerview/helpers/ConsecutiveNumbers.ts +120 -0
- package/src/recyclerview/helpers/EngagedIndicesTracker.ts +302 -0
- package/src/recyclerview/helpers/RenderTimeTracker.ts +38 -0
- package/src/recyclerview/helpers/VelocityTracker.ts +77 -0
- package/src/recyclerview/hooks/useBoundDetection.ts +127 -0
- package/src/recyclerview/hooks/useLayoutState.ts +46 -0
- package/src/recyclerview/hooks/useMappingHelper.ts +20 -0
- package/src/recyclerview/hooks/useOnLoad.ts +81 -0
- package/src/recyclerview/hooks/useRecyclerViewController.tsx +546 -0
- package/src/recyclerview/hooks/useRecyclerViewManager.ts +34 -0
- package/src/recyclerview/hooks/useRecyclingState.ts +63 -0
- package/src/recyclerview/hooks/useSecondaryProps.tsx +124 -0
- package/src/recyclerview/hooks/useUnmountAwareCallbacks.ts +37 -0
- package/src/recyclerview/hooks/useUnmountFlag.ts +26 -0
- package/src/recyclerview/layout-managers/GridLayoutManager.ts +212 -0
- package/src/recyclerview/layout-managers/LayoutManager.ts +498 -0
- package/src/recyclerview/layout-managers/LinearLayoutManager.ts +171 -0
- package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +301 -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 +104 -0
- package/src/utils/AverageWindow.ts +33 -0
- package/src/viewability/ViewToken.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentUtils.js","sourceRoot":"","sources":["../../../src/recyclerview/utils/componentUtils.ts"],"names":[],"mappings":";;;;AAAA,wDAA0B;AAE1B;;;;;;;;;;;;;;;GAeG;AACI,IAAM,iBAAiB,GAAG,UAC/B,SAAsE;IAEtE,IAAI,eAAK,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,eAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AATW,QAAA,iBAAiB,qBAS5B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RVLayout } from "../layout-managers/LayoutManager";
|
|
2
|
+
/**
|
|
3
|
+
* Finds the first visible index in a sorted array of RVLayout objects.
|
|
4
|
+
* This is a wrapper around binarySearchVisibleIndex that specifically finds
|
|
5
|
+
* the first item that becomes visible in the viewport.
|
|
6
|
+
*
|
|
7
|
+
* @param layouts - The sorted array of RVLayout objects
|
|
8
|
+
* @param threshold - The threshold value to determine visibility
|
|
9
|
+
* @param isSortedByX - A boolean indicating if the array is sorted by x (true) or y (false)
|
|
10
|
+
* @returns The index of the first visible layout or -1 if none are visible
|
|
11
|
+
*/
|
|
12
|
+
export declare function findFirstVisibleIndex(layouts: RVLayout[], threshold: number, isSortedByX: boolean): number;
|
|
13
|
+
/**
|
|
14
|
+
* Finds the last visible index in a sorted array of RVLayout objects.
|
|
15
|
+
* This is a wrapper around binarySearchVisibleIndex that specifically finds
|
|
16
|
+
* the last item that remains visible in the viewport.
|
|
17
|
+
*
|
|
18
|
+
* @param layouts - The sorted array of RVLayout objects
|
|
19
|
+
* @param threshold - The threshold value to determine visibility
|
|
20
|
+
* @param isSortedByX - A boolean indicating if the array is sorted by x (true) or y (false)
|
|
21
|
+
* @returns The index of the last visible layout or -1 if none are visible
|
|
22
|
+
*/
|
|
23
|
+
export declare function findLastVisibleIndex(layouts: RVLayout[], threshold: number, isSortedByX: boolean): number;
|
|
24
|
+
//# sourceMappingURL=findVisibleIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findVisibleIndex.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/utils/findVisibleIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AA0D5D;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,QAAQ,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,GACnB,MAAM,CAER;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,QAAQ,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,GACnB,MAAM,CAER"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findFirstVisibleIndex = findFirstVisibleIndex;
|
|
4
|
+
exports.findLastVisibleIndex = findLastVisibleIndex;
|
|
5
|
+
/**
|
|
6
|
+
* A helper function to perform binary search for the first or last visible index.
|
|
7
|
+
* This function efficiently finds items that are visible within a viewport by using
|
|
8
|
+
* a binary search algorithm on sorted layouts.
|
|
9
|
+
*
|
|
10
|
+
* @param layouts - The sorted array of RVLayout objects, sorted by either x or y position
|
|
11
|
+
* @param threshold - The threshold value to determine visibility (viewport boundary)
|
|
12
|
+
* @param isSortedByX - A boolean indicating if the array is sorted by x (true) or y (false)
|
|
13
|
+
* @param findFirst - A boolean indicating whether to find the first (true) or last (false) visible index
|
|
14
|
+
* @returns The index of the visible layout or -1 if none are visible
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The binary search implementation ensures O(log n) time complexity for finding visible items.
|
|
18
|
+
* The function assumes the layouts array is pre-sorted by the relevant dimension (x or y).
|
|
19
|
+
*/
|
|
20
|
+
function binarySearchVisibleIndex(layouts, threshold, isSortedByX, findFirst) {
|
|
21
|
+
var left = 0;
|
|
22
|
+
var right = layouts.length - 1;
|
|
23
|
+
var visibleIndex = -1;
|
|
24
|
+
while (left <= right) {
|
|
25
|
+
var mid = Math.floor((left + right) / 2);
|
|
26
|
+
var layout = layouts[mid];
|
|
27
|
+
// Check visibility based on the sorting criteria
|
|
28
|
+
var position = isSortedByX ? layout.x : layout.y;
|
|
29
|
+
var size = isSortedByX ? layout.width : layout.height;
|
|
30
|
+
if (findFirst) {
|
|
31
|
+
// Logic for finding the first visible index
|
|
32
|
+
if (position >= threshold || position + size > threshold) {
|
|
33
|
+
// Potential visible index found, continue searching left for earlier visible items
|
|
34
|
+
visibleIndex = mid;
|
|
35
|
+
right = mid - 1;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Search in the right half for visible items
|
|
39
|
+
left = mid + 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (position <= threshold) {
|
|
43
|
+
// Potential visible index found, continue searching right for later visible items
|
|
44
|
+
visibleIndex = mid;
|
|
45
|
+
left = mid + 1;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Search in the left half for visible items
|
|
49
|
+
right = mid - 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return visibleIndex;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Finds the first visible index in a sorted array of RVLayout objects.
|
|
56
|
+
* This is a wrapper around binarySearchVisibleIndex that specifically finds
|
|
57
|
+
* the first item that becomes visible in the viewport.
|
|
58
|
+
*
|
|
59
|
+
* @param layouts - The sorted array of RVLayout objects
|
|
60
|
+
* @param threshold - The threshold value to determine visibility
|
|
61
|
+
* @param isSortedByX - A boolean indicating if the array is sorted by x (true) or y (false)
|
|
62
|
+
* @returns The index of the first visible layout or -1 if none are visible
|
|
63
|
+
*/
|
|
64
|
+
function findFirstVisibleIndex(layouts, threshold, isSortedByX) {
|
|
65
|
+
return binarySearchVisibleIndex(layouts, threshold, isSortedByX, true);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Finds the last visible index in a sorted array of RVLayout objects.
|
|
69
|
+
* This is a wrapper around binarySearchVisibleIndex that specifically finds
|
|
70
|
+
* the last item that remains visible in the viewport.
|
|
71
|
+
*
|
|
72
|
+
* @param layouts - The sorted array of RVLayout objects
|
|
73
|
+
* @param threshold - The threshold value to determine visibility
|
|
74
|
+
* @param isSortedByX - A boolean indicating if the array is sorted by x (true) or y (false)
|
|
75
|
+
* @returns The index of the last visible layout or -1 if none are visible
|
|
76
|
+
*/
|
|
77
|
+
function findLastVisibleIndex(layouts, threshold, isSortedByX) {
|
|
78
|
+
return binarySearchVisibleIndex(layouts, threshold, isSortedByX, false);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=findVisibleIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findVisibleIndex.js","sourceRoot":"","sources":["../../../src/recyclerview/utils/findVisibleIndex.ts"],"names":[],"mappings":";;AAoEA,sDAMC;AAYD,oDAMC;AA1FD;;;;;;;;;;;;;;GAcG;AACH,SAAS,wBAAwB,CAC/B,OAAmB,EACnB,SAAiB,EACjB,WAAoB,EACpB,SAAkB;IAElB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC;IAEtB,OAAO,IAAI,IAAI,KAAK,EAAE,CAAC;QACrB,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAE5B,iDAAiD;QACjD,IAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,IAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;QAExD,IAAI,SAAS,EAAE,CAAC;YACd,4CAA4C;YAC5C,IAAI,QAAQ,IAAI,SAAS,IAAI,QAAQ,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC;gBACzD,mFAAmF;gBACnF,YAAY,GAAG,GAAG,CAAC;gBACnB,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,6CAA6C;gBAC7C,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,kFAAkF;YAClF,YAAY,GAAG,GAAG,CAAC;YACnB,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,4CAA4C;YAC5C,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,OAAmB,EACnB,SAAiB,EACjB,WAAoB;IAEpB,OAAO,wBAAwB,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,OAAmB,EACnB,SAAiB,EACjB,WAAoB;IAEpB,OAAO,wBAAwB,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
interface Layout {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Checks if two dimension values are not equal, with a small tolerance.
|
|
10
|
+
* Used to handle floating-point precision issues in layout measurements.
|
|
11
|
+
*
|
|
12
|
+
* @param value1 - First dimension value to compare
|
|
13
|
+
* @param value2 - Second dimension value to compare
|
|
14
|
+
* @returns true if the values are significantly different, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
export declare function areDimensionsNotEqual(value1: number, value2: number): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if two dimension values are equal, with a small tolerance.
|
|
19
|
+
* Used to handle floating-point precision issues in layout measurements.
|
|
20
|
+
*
|
|
21
|
+
* @param value1 - First dimension value to compare
|
|
22
|
+
* @param value2 - Second dimension value to compare
|
|
23
|
+
* @returns true if the values are approximately equal, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
export declare function areDimensionsEqual(value1: number, value2: number): boolean;
|
|
26
|
+
export declare function roundOffPixel(value: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Specific method for easier mocking
|
|
29
|
+
* Measures the layout of parent of RecyclerView
|
|
30
|
+
* Returns the x, y coordinates and dimensions of the view.
|
|
31
|
+
* @param view - The React Native View component to measure
|
|
32
|
+
* @returns An object containing x, y, width, and height measurements
|
|
33
|
+
*/
|
|
34
|
+
export declare function measureParentSize(view: View): Layout;
|
|
35
|
+
/**
|
|
36
|
+
* Specific method for easier mocking
|
|
37
|
+
* Measures the layout of child container of RecyclerView
|
|
38
|
+
* @param childContainerView
|
|
39
|
+
* @param parentView
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare function measureFirstChildLayout(childContainerView: View, parentView: View): Layout;
|
|
43
|
+
/**
|
|
44
|
+
* Specific method for easier mocking
|
|
45
|
+
* Measures the layout of items of RecyclerView
|
|
46
|
+
* @param item
|
|
47
|
+
* @param oldLayout
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare function measureItemLayout(item: View, oldLayout: Layout | undefined): Layout;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=measureLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureLayout.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/utils/measureLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,UAAU,MAAM;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAkDD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAO1E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,IAAI,EACxB,UAAU,EAAE,IAAI,GACf,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,CAER"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areDimensionsNotEqual = areDimensionsNotEqual;
|
|
4
|
+
exports.areDimensionsEqual = areDimensionsEqual;
|
|
5
|
+
exports.roundOffPixel = roundOffPixel;
|
|
6
|
+
exports.measureParentSize = measureParentSize;
|
|
7
|
+
exports.measureFirstChildLayout = measureFirstChildLayout;
|
|
8
|
+
exports.measureItemLayout = measureItemLayout;
|
|
9
|
+
var react_native_1 = require("react-native");
|
|
10
|
+
/**
|
|
11
|
+
* Measures the layout of a view relative to itselft.
|
|
12
|
+
* Using measure wasn't returing accurate values but this workaround does.
|
|
13
|
+
* Returns the x, y coordinates and dimensions of the view.
|
|
14
|
+
*
|
|
15
|
+
* @param view - The React Native View component to measure
|
|
16
|
+
* @returns An object containing x, y, width, and height measurements
|
|
17
|
+
*/
|
|
18
|
+
function measureLayout(view, oldLayout) {
|
|
19
|
+
// const layout = view.unstable_getBoundingClientRect();
|
|
20
|
+
// layout.width = roundOffPixel(layout.width);
|
|
21
|
+
// layout.height = roundOffPixel(layout.height);
|
|
22
|
+
// return layout;
|
|
23
|
+
return measureLayoutRelative(view, view, oldLayout);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Measures the layout of a view relative to another view.
|
|
27
|
+
* Useful for measuring positions relative to a specific reference view.
|
|
28
|
+
*
|
|
29
|
+
* @param view - The React Native View component to measure
|
|
30
|
+
* @param relativeTo - The reference view to measure against
|
|
31
|
+
* @returns An object containing x, y, width, and height measurements
|
|
32
|
+
*/
|
|
33
|
+
function measureLayoutRelative(view, relativeTo, oldLayout) {
|
|
34
|
+
var layout = { x: 0, y: 0, width: 0, height: 0 };
|
|
35
|
+
view.measureLayout(relativeTo, function (x, y, width, height) {
|
|
36
|
+
layout.x = x;
|
|
37
|
+
layout.y = y;
|
|
38
|
+
layout.width = roundOffPixel(width);
|
|
39
|
+
layout.height = roundOffPixel(height);
|
|
40
|
+
});
|
|
41
|
+
if (oldLayout) {
|
|
42
|
+
if (areDimensionsEqual(layout.width, oldLayout.width)) {
|
|
43
|
+
layout.width = oldLayout.width;
|
|
44
|
+
}
|
|
45
|
+
if (areDimensionsEqual(layout.height, oldLayout.height)) {
|
|
46
|
+
layout.height = oldLayout.height;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return layout;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checks if two dimension values are not equal, with a small tolerance.
|
|
53
|
+
* Used to handle floating-point precision issues in layout measurements.
|
|
54
|
+
*
|
|
55
|
+
* @param value1 - First dimension value to compare
|
|
56
|
+
* @param value2 - Second dimension value to compare
|
|
57
|
+
* @returns true if the values are significantly different, false otherwise
|
|
58
|
+
*/
|
|
59
|
+
function areDimensionsNotEqual(value1, value2) {
|
|
60
|
+
return !areDimensionsEqual(value1, value2);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Checks if two dimension values are equal, with a small tolerance.
|
|
64
|
+
* Used to handle floating-point precision issues in layout measurements.
|
|
65
|
+
*
|
|
66
|
+
* @param value1 - First dimension value to compare
|
|
67
|
+
* @param value2 - Second dimension value to compare
|
|
68
|
+
* @returns true if the values are approximately equal, false otherwise
|
|
69
|
+
*/
|
|
70
|
+
function areDimensionsEqual(value1, value2) {
|
|
71
|
+
return (Math.abs(react_native_1.PixelRatio.getPixelSizeForLayoutSize(value1) -
|
|
72
|
+
react_native_1.PixelRatio.getPixelSizeForLayoutSize(value2)) <= 1);
|
|
73
|
+
}
|
|
74
|
+
function roundOffPixel(value) {
|
|
75
|
+
return react_native_1.PixelRatio.roundToNearestPixel(value);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Specific method for easier mocking
|
|
79
|
+
* Measures the layout of parent of RecyclerView
|
|
80
|
+
* Returns the x, y coordinates and dimensions of the view.
|
|
81
|
+
* @param view - The React Native View component to measure
|
|
82
|
+
* @returns An object containing x, y, width, and height measurements
|
|
83
|
+
*/
|
|
84
|
+
function measureParentSize(view) {
|
|
85
|
+
return measureLayout(view, undefined);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Specific method for easier mocking
|
|
89
|
+
* Measures the layout of child container of RecyclerView
|
|
90
|
+
* @param childContainerView
|
|
91
|
+
* @param parentView
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
function measureFirstChildLayout(childContainerView, parentView) {
|
|
95
|
+
return measureLayoutRelative(childContainerView, parentView, undefined);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Specific method for easier mocking
|
|
99
|
+
* Measures the layout of items of RecyclerView
|
|
100
|
+
* @param item
|
|
101
|
+
* @param oldLayout
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
function measureItemLayout(item, oldLayout) {
|
|
105
|
+
return measureLayout(item, oldLayout);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=measureLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureLayout.js","sourceRoot":"","sources":["../../../src/recyclerview/utils/measureLayout.ts"],"names":[],"mappings":";;AAiEA,sDAEC;AAUD,gDAOC;AAED,sCAEC;AASD,8CAEC;AASD,0DAKC;AASD,8CAKC;AA/HD,6CAAgD;AAShD;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,IAAU,EAAE,SAA6B;IAC9D,wDAAwD;IACxD,8CAA8C;IAC9C,gDAAgD;IAChD,iBAAiB;IACjB,OAAO,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAC5B,IAAU,EACV,UAAgB,EAChB,SAA6B;IAE7B,IAAM,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACnD,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM;QACjD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QACjC,CAAC;QACD,IAAI,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACxD,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,MAAc,EAAE,MAAc;IAClE,OAAO,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,MAAc,EAAE,MAAc;IAC/D,OAAO,CACL,IAAI,CAAC,GAAG,CACN,yBAAU,CAAC,yBAAyB,CAAC,MAAM,CAAC;QAC1C,yBAAU,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAC/C,IAAI,CAAC,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,yBAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,IAAU;IAC1C,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,kBAAwB,EACxB,UAAgB;IAEhB,OAAO,qBAAqB,CAAC,kBAAkB,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,IAAU,EACV,SAA6B;IAE7B,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Layout {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Checks if two dimension values are not equal, with a small tolerance.
|
|
9
|
+
*/
|
|
10
|
+
export declare function areDimensionsNotEqual(value1: number, value2: number): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if two dimension values are equal, with a small tolerance.
|
|
13
|
+
*/
|
|
14
|
+
export declare function areDimensionsEqual(value1: number, value2: number): boolean;
|
|
15
|
+
export declare function roundOffPixel(value: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Measures the layout of parent of RecyclerView
|
|
18
|
+
*/
|
|
19
|
+
export declare function measureParentSize(view: Element): Layout;
|
|
20
|
+
/**
|
|
21
|
+
* Measures the layout of child container of RecyclerView
|
|
22
|
+
*/
|
|
23
|
+
export declare function measureFirstChildLayout(childContainerView: Element, parentView: Element): Layout;
|
|
24
|
+
/**
|
|
25
|
+
* Measures the layout of items of RecyclerView
|
|
26
|
+
*/
|
|
27
|
+
export declare function measureItemLayout(item: Element, oldLayout: Layout | undefined): Layout;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=measureLayout.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureLayout.web.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/utils/measureLayout.web.ts"],"names":[],"mappings":"AAAA,UAAU,MAAM;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAuBD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOvD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,OAAO,EAC3B,UAAU,EAAE,OAAO,GAClB,MAAM,CAaR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,CAkBR"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areDimensionsNotEqual = areDimensionsNotEqual;
|
|
4
|
+
exports.areDimensionsEqual = areDimensionsEqual;
|
|
5
|
+
exports.roundOffPixel = roundOffPixel;
|
|
6
|
+
exports.measureParentSize = measureParentSize;
|
|
7
|
+
exports.measureFirstChildLayout = measureFirstChildLayout;
|
|
8
|
+
exports.measureItemLayout = measureItemLayout;
|
|
9
|
+
/**
|
|
10
|
+
* Gets scroll offsets from up to 3 parent elements
|
|
11
|
+
*/
|
|
12
|
+
function getScrollOffsets(element, stopAt) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var scrollX = 0;
|
|
15
|
+
var scrollY = 0;
|
|
16
|
+
var currentElement = element;
|
|
17
|
+
var depth = 0;
|
|
18
|
+
// Only check up to 3 parent elements
|
|
19
|
+
while (currentElement && currentElement !== stopAt && depth < 3) {
|
|
20
|
+
var htmlElement = currentElement;
|
|
21
|
+
scrollX += (_a = htmlElement.scrollLeft) !== null && _a !== void 0 ? _a : 0;
|
|
22
|
+
scrollY += (_b = htmlElement.scrollTop) !== null && _b !== void 0 ? _b : 0;
|
|
23
|
+
currentElement = currentElement.parentElement;
|
|
24
|
+
depth++;
|
|
25
|
+
}
|
|
26
|
+
return { scrollX: scrollX, scrollY: scrollY };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Checks if two dimension values are not equal, with a small tolerance.
|
|
30
|
+
*/
|
|
31
|
+
function areDimensionsNotEqual(value1, value2) {
|
|
32
|
+
return !areDimensionsEqual(value1, value2);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Checks if two dimension values are equal, with a small tolerance.
|
|
36
|
+
*/
|
|
37
|
+
function areDimensionsEqual(value1, value2) {
|
|
38
|
+
return Math.abs(value1 - value2) <= 1;
|
|
39
|
+
}
|
|
40
|
+
function roundOffPixel(value) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Measures the layout of parent of RecyclerView
|
|
45
|
+
*/
|
|
46
|
+
function measureParentSize(view) {
|
|
47
|
+
return {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0,
|
|
50
|
+
width: view.clientWidth,
|
|
51
|
+
height: view.clientHeight,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Measures the layout of child container of RecyclerView
|
|
56
|
+
*/
|
|
57
|
+
function measureFirstChildLayout(childContainerView, parentView) {
|
|
58
|
+
var childRect = childContainerView.getBoundingClientRect();
|
|
59
|
+
var parentRect = parentView.getBoundingClientRect();
|
|
60
|
+
// Get scroll offsets for child container (max 3 parents)
|
|
61
|
+
var scrollOffsets = getScrollOffsets(childContainerView, parentView);
|
|
62
|
+
return {
|
|
63
|
+
x: childRect.left - parentRect.left + scrollOffsets.scrollX,
|
|
64
|
+
y: childRect.top - parentRect.top + scrollOffsets.scrollY,
|
|
65
|
+
width: roundOffPixel(childRect.width),
|
|
66
|
+
height: roundOffPixel(childRect.height),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Measures the layout of items of RecyclerView
|
|
71
|
+
*/
|
|
72
|
+
function measureItemLayout(item, oldLayout) {
|
|
73
|
+
var layout = {
|
|
74
|
+
x: 0,
|
|
75
|
+
y: 0,
|
|
76
|
+
width: item.clientWidth,
|
|
77
|
+
height: item.clientHeight,
|
|
78
|
+
};
|
|
79
|
+
if (oldLayout) {
|
|
80
|
+
if (areDimensionsEqual(layout.width, oldLayout.width)) {
|
|
81
|
+
layout.width = oldLayout.width;
|
|
82
|
+
}
|
|
83
|
+
if (areDimensionsEqual(layout.height, oldLayout.height)) {
|
|
84
|
+
layout.height = oldLayout.height;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return layout;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=measureLayout.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureLayout.web.js","sourceRoot":"","sources":["../../../src/recyclerview/utils/measureLayout.web.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react-native/types/modules/Codegen" />
|
|
2
1
|
import type { ViewProps } from "react-native";
|
|
3
2
|
import type { Int32, Double, DirectEventHandler } from "react-native/Libraries/Types/CodegenTypes";
|
|
4
|
-
|
|
3
|
+
type BlankAreaEvent = Readonly<{
|
|
5
4
|
offsetStart: Int32;
|
|
6
5
|
offsetEnd: Int32;
|
|
7
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoLayoutNativeComponent.d.ts","sourceRoot":"","sources":["../../src/specs/AutoLayoutNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutoLayoutNativeComponent.d.ts","sourceRoot":"","sources":["../../src/specs/AutoLayoutNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACN,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,cAAc,GAAG,QAAQ,CAAC;IAC7B,WAAW,EAAE,KAAK,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC;CAClB,CAAC,CAAC;AAEH,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CACvD;;AAED,wBAAqE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellContainerNativeComponent.d.ts","sourceRoot":"","sources":["../../src/specs/CellContainerNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CellContainerNativeComponent.d.ts","sourceRoot":"","sources":["../../src/specs/CellContainerNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,WAAY,SAAQ,SAAS;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;;AAED,wBAAoE"}
|