DEV Community

Discussion on: react-native-bottomsheet-reanimated

Collapse
kennymanman profile image
kennymanman

Hey how do i onpress this?

Collapse
saffellikhan profile image
Saif Ali Khan

if you want to open the modal just use the initial snap points.

For Example: snapPoints={[200, 100, 0]}

this.refs.BottomSheet.current.snapTo(200) // To Open Full Modal in onPress Function add value of 200;

this.refs.BottomSheet.current.snapTo(0) // To Close Modal change the value to 0;

Hope it helps :)

Collapse
parazitenew profile image
parazitenew • Edited on

Hi, the ref method is not working.

this.sheetRef = React.createRef(); (inside props constructor)
ref={this.sheetRef} as prop of the BottomSheet component.

Then onPress button I call a function that do this:
this.sheetRef.current.snapTo('50%');

returning error: undefined is not an object (evaluating 'snapPoint.tension')

Thread Thread
saffellikhan profile image
Saif Ali Khan

this.sheetRef.current.snapTo('50%'); //here you was wrong. please use array index number instead of '50%'.