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

initialSnap -34px bug #146

Open
0oooooooo0 opened this issue Nov 16, 2023 · 3 comments
Open

initialSnap -34px bug #146

0oooooooo0 opened this issue Nov 16, 2023 · 3 comments

Comments

@0oooooooo0
Copy link

<Sheet snapPoints={[1, 0.7, 0]} initialSnap={1}>

will not open by 0.7, but will open with a value of -34px.

@laem
Copy link

laem commented Dec 11, 2023

I'm having a similar problem : when the sheet is rendered with open=true, it starts from the top, then slides back to the initialSnap.

Looks like a bug to me : it should slide from the bottom.

Note that this works with a default open=false and then a dynamic setOpen(true).

Here is a sandbox to demonstrate this behaviour : https://codesandbox.io/p/devbox/test-react-modal-sheet-x56rff?file=%2Fapp%2FSnapPoints.tsx%3A15%2C48

Note that it is easily fixed with these three lines :

	useEffect(() => {
		setTimeout(() => setOpen(true), 1)
	}, [setOpen])

@0oooooooo0 Is it related to your bug ? If not, I'll raise a new issue :)

@0oooooooo0
Copy link
Author

This looks like the same issue. Check out my PR

#148

@Temzasse
Copy link
Owner

Hi @0oooooooo0 and @laem 👋🏻

I commented on the #148 PR that I'm not able to reproduce the -34px issue locally. Does @0oooooooo0 your issue also happen when the sheet is rendered with isOpen={true} instead of being opened by user action? I can reproduce the initial open bug that @laem commented about but I don't see how the related PR would fix that 🤔

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

3 participants