UNPKG

react-native-ui-lib

Version:

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)

25 lines (24 loc) 912 B
import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native'; export type ScrollToHideProps = { /** * The threshold (in pixels) to ignore small scroll movements before updating visibility. * Defaults to 0 (immediate reaction). */ scrollingThreshold?: number; }; export type ScrollToHideResult = { /** * onScroll callback (should be passed to your ScrollView/FlatList onScroll prop). */ onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void; /** * Whether the footer should be visible based on scroll direction. */ visible: boolean; }; /** * @description: A hook that tracks scroll direction to toggle visibility (e.g., for hiding a footer on scroll). * @example: const {onScroll, visible} = useScrollToHide(); */ declare const useScrollToHide: (props?: ScrollToHideProps) => ScrollToHideResult; export default useScrollToHide;