2

I'm using reanimated-bottom-sheet. Trying to close modal with this

this.bottomSheetRef.current.snapTo(0)

but this works at second click. If there is 3 snapPoint it goes heighest one at first than goes to where I want but at second click

1 Answers1

1

I'm using this code to avoid issues with snapTo(0).

Method to close:

closeBottomSheet = () => {
    if (this.bottomSheetRef && this.bottomSheetRef.snapTo) this.bottomSheetRef.snapTo(0);
}

Example component:

<BottomSheet
    ref={ref => this.bottomSheetRef= ref}
    snapPoints={[0, 300, 600]}
    initialSnap={0}
/>
Maycon Mesquita
  • 4,470
  • 2
  • 21
  • 29