From 1c29ef05e97560d4d5e77da71d809ab5cef073a2 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Mon, 25 Mar 2024 14:38:31 +0100 Subject: [PATCH] fix type --- .../BaseInvertedFlatList/index.e2e.tsx | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx b/src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx index e255554e9436..5df39ec02c89 100644 --- a/src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx +++ b/src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx @@ -1,31 +1,23 @@ -import type {ForwardedRef} from 'react'; import React, {forwardRef, useMemo} from 'react'; -import type {FlatListProps, ScrollViewProps} from 'react-native'; -import FlatList from '@components/FlatList'; +import type {FlatListProps, ScrollViewProps, ViewToken} from 'react-native'; +import {FlatList} from 'react-native'; +import type {ReportAction} from '@src/types/onyx'; -type BaseInvertedFlatListProps = FlatListProps & { +type BaseInvertedFlatListProps = FlatListProps & { shouldEnableAutoScrollToTopThreshold?: boolean; }; const AUTOSCROLL_TO_TOP_THRESHOLD = 128; -type ViewableItem = { - item: T; - index: number; - key: string; - isViewable: boolean; -}; - -let localViewableItems: Array> | undefined; - -const getViewableItems = (): Array> | undefined => localViewableItems as Array> | undefined; +let localViewableItems: ViewToken[]; +const getViewableItems = () => localViewableItems; -function BaseInvertedFlatListE2e(props: BaseInvertedFlatListProps, ref: ForwardedRef>) { +function BaseInvertedFlatListE2e(props: BaseInvertedFlatListProps, ref: React.ForwardedRef>) { const {shouldEnableAutoScrollToTopThreshold, ...rest} = props; const handleViewableItemsChanged = useMemo( () => - ({viewableItems}: {viewableItems: Array>}) => { + ({viewableItems}: {viewableItems: ViewToken[]}) => { localViewableItems = viewableItems; }, [], @@ -45,7 +37,7 @@ function BaseInvertedFlatListE2e(props: Base }, [shouldEnableAutoScrollToTopThreshold]); return ( - + // eslint-disable-next-line react/jsx-props-no-spreading {...rest} ref={ref}