react-native-actions-sheet icon indicating copy to clipboard operation
react-native-actions-sheet copied to clipboard

Any example on how to automatically open the sheet when the component mounts?

Open iamvinny opened this issue 10 months ago • 1 comments

I basically need to have the sheet popup automatically as soon as the component mount.

I've managed to achieve that by adding a delay (see example below), but this is definitely not very reliable and recommended for production. It won't work without the delay.

 useEffect(() => {
     console.log('Ref on mount:', actionSheetRef.current); // returns null
     setTimeout(() => {
         actionSheetRef.current ? .show();
     }, 500); // add a short delay to wait for component mount
 }, []);

iamvinny avatar Dec 28 '24 04:12 iamvinny