prscX / react-native-bottom-action-sheet

React Native: Native Bottom Action Sheet
Apache License 2.0
633 stars 48 forks source link

Sometimes it's open up automatically for no reason #59

Closed boypanjaitan16 closed 4 years ago

boypanjaitan16 commented 4 years ago

Sometimes the bottom action sheet show up for no reason. This happen on other action, something like on button click.

And I pretty sure that the value of variable for visible props is false.

May I know why this happen and how to fix it ?

boypanjaitan16 commented 4 years ago

it's happen everytime i fired this.setState method

elmawardy commented 4 years ago

I faced the same issue it seems like when the sheet is closed after clicking outside , the "isVisible" state remains true , I've figured this out with react-devtools

I was able to resolve the issue by adding the onCancel prop

onCancel={(e)=>{this.setState({isVisible:false})}}

THis will automatically change the state to false after closing the sheet .

prscX commented 4 years ago

Thanks @elmawardy for sharing the fix.

@boypanjaitan16: Incase you don't want to render bottom sheet using react way then you can use static API as well where you need not have to handle state. Please refer README/Example project for the same.

Thanks </ Pranav >