Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sheet disappears after few closings on iOS #165

Open
andrewLapshov opened this issue Jun 11, 2024 · 3 comments
Open

Sheet disappears after few closings on iOS #165

andrewLapshov opened this issue Jun 11, 2024 · 3 comments

Comments

@andrewLapshov
Copy link

Hello! After toggling the isOpen state several times, Sheet stops displaying. I've tried with both rootId and without, but the result is the same. I've checked on earlier versions of iOS using Browserstack, but I couldn't reproduce the issue.

iOS 17.5.1
react-modal-sheet 3.1.0

export const FiltersSheet = () => {
    const [isOpen, setIsOpen] = useState(false);

    return (
        <>
            <div className={styles.filterContainer}>
                <button className={styles.filterButton} onClick={() => setIsOpen((isOpen) => !isOpen)}>
                    <FilterIcon />
                </button>
            </div>

            <Sheet detent="content-height" isOpen={isOpen} rootId="root" onClose={() => setIsOpen(false)}>
                <Sheet.Container>
                    <Sheet.Header />
                    <Sheet.Content>
                        <Sheet.Scroller>
                            <h2 className={styles.title}>Filters</h2>
                        </Sheet.Scroller>
                    </Sheet.Content>
                </Sheet.Container>
            </Sheet>
        </>
    );
};
IMG_4453.MP4
@Pouria-Rezaeii
Copy link

I faced this issue also on Firefox.
I temporarily solved the issue by displaying the modal only when the show state is true:

{show && <ReactSheetModal ... />

The only problem with this approach is that the modal will be unmounted when the modal gets closed,
but the user won't notice any difference.

Waiting for a fix...

@Temzasse
Copy link
Owner

Hi @andrewLapshov and @Pouria-Rezaeii 👋🏻

I'm not able to reproduce this issue locally. Could you try the latest version of react-modal-sheet and check if the problem still occurs?

If the issue is still happening it would be super helpful to get a reproduction in CodeSandbox or StackBlitz 🙏🏻

@khashashin
Copy link

I think it's related to the motion, and I was able to fix this with the following zIndex and visibility setting:

<Sheet
  ref={ref}
  disableDrag={disableDrag}
  snapPoints={[0.9, 0.5]}
  initialSnap={1}
  isOpen={isOpen}
  onClose={() => toggle('hide')}
  onSnap={handleSnap}
  style={{
     zIndex: isOpen ? '9999999' : '-1',
     visibility: isOpen ? 'visible' : 'hidden'
  }}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants