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

fix: allow initial snapPoint index greater than 0 #1694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BethThomas141
Copy link

Motivation

This is to fix bug #1689.
Since version 4.5.0 there has been logic that if the container layout is not ready, the returned snapPoints are an array with just a single item [-999]. As a result, on initial load, before the container layout is ready, if you have passed in the index prop to the BottomSheet with a value greater than 0 (e.g. if you're passing in more than one snap point value, and have passed in index={1} as you want the drawer to start open), it immediately errors as the index is out of range of the initial snapPoint array of [-999].

This PR reverts the initial load logic to how it was before version 4.5.0, where if the container layout is not yet ready, it returns instead an array filled with -999 that matches the length of the passed in snapPoint array.

@gorhom gorhom self-assigned this Jan 15, 2024
@gorhom gorhom added v4 Written in Reanimated v2 v5 labels Jan 15, 2024
@mlazari
Copy link

mlazari commented Mar 28, 2024

Any plans on merging this fix? I had to apply a patch with this fix since I was experiencing the same error.

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

Successfully merging this pull request may close these issues.

None yet

3 participants