React-native-reanimated-bottom-sheet: snapTo method only works good if called two times

Created on 19 Apr 2020  路  5Comments  路  Source: osdnk/react-native-reanimated-bottom-sheet

Hey! I'm currently having some issues with snapTo method.

If I call it to present the bottom sheet like this

// Present bottom sheet on button press
const onButtonPress = () => {
    bottomSheetRef.current.snapTo(1)
}

// Hide bottom sheet on inner button press
const onInnerButtonPress = () => {
    bottomSheetRef.current.snapTo(0)
}

// sheet setup
<View>
    <Button onPress={onButtonPress} />
    <BottomSheet
        snapPoints = {[0, 250]}
        renderContent = {this.renderContent} // inner button lies here
    />
</View>

So this works only if I press both buttons twice or call snapTo twice in each function..

However snapTo works when i hide the sheet with gesture.

Looks like you can't use method multiple times in a row without gesture interaction.
By the way, waiting time between presses doesn't change anything

Most helpful comment

should be fixed on master

All 5 comments

i am also having this issue
@lukebars Did you able to solve this or any workaround?

@amilaDulanjana Currently I'm resorting to double calling the method.. dirty, but works.

Same here

should be fixed on master

You also I think resolved another issue where "hide" was also opening other bottom sheets. 馃憦

Was this page helpful?
0 / 5 - 0 ratings