React-native-reanimated-bottom-sheet: How to programmaticaly close a BottomSheet after open it ?

Created on 4 Jun 2020  路  2Comments  路  Source: osdnk/react-native-reanimated-bottom-sheet

First, Thanks for this awesome library. However, I'm a little bit stuck about something. I'm currently showing the bottom sheet on press on something then inside it, I have something a close button which I want it to close the bottom sheet. So please how can I achieve it?

Most helpful comment

@PatrissolJuns The snapPoints are the "position" of the bottomSheet at the moment. For example if you have snapPoints={[0, 200]}:

  • To open the bottom sheet is going to the snap point in position 1 -> bottomSheetRef.current.snapTo(1)
  • So to close the bottom sheet is to return to the first snap point who is in the position 0 -> bottomSheetRef.current.snapTo(0)

All 2 comments

@PatrissolJuns The snapPoints are the "position" of the bottomSheet at the moment. For example if you have snapPoints={[0, 200]}:

  • To open the bottom sheet is going to the snap point in position 1 -> bottomSheetRef.current.snapTo(1)
  • So to close the bottom sheet is to return to the first snap point who is in the position 0 -> bottomSheetRef.current.snapTo(0)

Thanks. It worked!

Was this page helpful?
0 / 5 - 0 ratings