import { RefObject } from 'react'; import { ScrollView, FlatList, LayoutChangeEvent } from 'react-native'; export type ScrollToSupportedViews = ScrollView | FlatList; export type ScrollToProps = { /** * A reference to the ScrollView (or FlatList) which the items are in */ scrollViewRef?: RefObject; /** * Is the scroll view horizontal (default is true) */ horizontal?: boolean; }; export type ScrollToResultProps = { /** * A reference to the ScrollView (or FlatList) which the items are in (from the props or a created one) */ scrollViewRef: RefObject; /** * scrollTo callback. * offset - the x or y to scroll to. * animated - should the scroll be animated (default is true) */ scrollTo: (offset: number, animated?: boolean) => void; /** * onContentSizeChange callback (should be set to your onContentSizeChange). * Needed for RTL support on Android. */ onContentSizeChange: (contentWidth: number, contentHeight: number) => void; /** * onLayout callback (should be set to your onLayout). * Needed for RTL support on Android. */ onLayout: (event: LayoutChangeEvent) => void; }; declare const useScrollTo: (props: ScrollToProps) => ScrollToResultProps; export default useScrollTo;