Reference
useScrollHandlers

useScrollHandlers

A hook that helps the action sheet behave correctly when a scrollable view is rendered inside it. It takes two parameters, an id for the ScrollView or FlatList and the action sheet ref.

Parameters:

id

A unique id for the ScrollView or FlatList. This id has to be unique per action sheet component.

TypeRequired
stringtrue

ref

A ref of the action sheet that wraps the ScrollView component.

import ActionSheet, {
  useScrollHandlers,
  ActionSheetRef,
  SheetProps,
} from "react-native-actions-sheet";
 
const ExampleSheet = (props: SheetProps) => {
  const actionSheetRef = useRef<ActionSheetRef>(null);
  const scrollHandlers = useScrollHandlers<ScrollView>(
    "scrollview-1",
    actionSheetRef
  );
 
  return (
    <ActionSheet ref={actionSheetRef}>
      <ScrollView {...scrollHandlers}></ScrollView>
    </ActionSheet>
  );
};
💡

Internally the hook simply provides information about the ScrollView layout & it's current position based on which the action sheet decides whether scrolling should be enabled or not.