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: closed bottom sheet snap point (by @eastroot1590) #1043

Merged
merged 2 commits into from
Jul 31, 2022

Conversation

gorhom
Copy link
Owner

@gorhom gorhom commented Jul 31, 2022

Cloned from #1035

Closed bottom sheet can't directly snap to 100% because initial animatedNextPosition is 0 and 100%'s nextPosition is 0 too.

Motivation

this kind of sheets can't open

const snapPoint = ['100%'];
const ref = useRef<BottomSheet>(null);

const handlePress = () => {
    // doesn't work
    ref.current?.snapToIndex(0);
};

return (
  <Container>
    <Button onPress={handlePress} />
    <BottomSheet
      ref={ref}
      index={-1}
      snapPoints={snapPoint}
    />
  </Container>
)

in animateToPositionCompleted, animatedNextPosition always set to Number.NEGATIVE_INFINITY so this value can be initial value.

@gorhom gorhom added the v4 Written in Reanimated v2 label Jul 31, 2022
eastroot1590 and others added 2 commits July 31, 2022 18:01
closed bottom sheet can't directly snap to 100% because initial animatedNextPosition is 0 and 100%'s nextPosition is 0 too.
@gorhom gorhom merged commit c7f2ce2 into master Jul 31, 2022
@gorhom gorhom deleted the StaygeLabs/master branch July 31, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Written in Reanimated v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants