Skip to content

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

@iamvinny

Description

@iamvinny

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
 }, []);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions