Basic usage
Import ActionSheet
.
import ActionSheet from "react-native-actions-sheet";
Then create your ActionSheet inside any component and attach a ref
to it.
function App() {
const actionSheetRef = useRef<ActionSheetRef>(null);
return (
<ActionSheet ref={actionSheetRef}>
<Text>Hi, I am here.</Text>
</ActionSheet>
);
}
Present the ActionSheet by calling show
method on the ref.
actionSheetRef.current?.show();
And hide it by calling hide
method on the ref.
actionSheetRef.current?.hide();
💡
While the above is fully functional it's not scalable when you have many ActionSheets in the app, it is recommended that you implement ActionSheets in your app using Sheet Manager for more scalability.