Skip to main content

API Reference

useHideOnScroll Hook​

Hook Configuration

The useHideOnScroll hook provides a simple interface for creating scroll-based hide/show animations. It returns an object containing animation styles and control methods.

Configuration Options​

OptionTypeDefaultDescription
heightnumber-Required. Height of the component to animate
durationnumber300Animation duration in milliseconds
thresholdnumber10Minimum scroll distance to trigger hide/show
scrollDirectionScrollDirectionDOWNWhether to hide when scrolling down
hideDirectionHideDirectionHideDirection.DOWNDirection to hide the component

Return Value​

The hook returns an object with the following properties:

PropertyTypeDescription
animatedStyleobjectAnimated style object to be applied to your component
scrollYAnimated.ValueThe scroll position value
isVisiblebooleanCurrent visibility state of the component
show() => voidMethod to show the component
hide() => voidMethod to hide the component
toggle() => voidMethod to toggle component visibility
onScroll(event: NativeSyntheticEvent<NativeScrollEvent>) => voidScroll event handler

ScrollDirection Enum​

Direction Configuration

Use the ScrollDirection enum to specify which direction your component should hide in.

enum ScrollDirection {
UP = 'UP',
DOWN = 'DOWN'
}

HideDirection Enum​

Direction Configuration

Use the HideDirection enum to specify which direction your component should hide in.

enum HideDirection {
UP = 'UP',
DOWN = 'DOWN'
}