Add a functionality that will close the BottomSheet when a list item is pressed
See original GitHub issueIs your feature request related to a problem? Please Describe.
I’m trying to use the BottomSheet component to present a list of calendars to the user to add their event to. From what I can tell, there is no way to close the BottomSheet when the user has pressed one of the list items, which makes my use case difficult.
Describe the solution you’d like
Add a functionality that will close the BottomSheet when a list item is pressed.
As per a comment by @airen29 on https://github.com/react-native-elements/react-native-elements/pull/2325#issuecomment-671099539, it could look like this:
onPressClose: () => {
this.setVisible(false);
onPress && onPress();
},
Describe alternatives you’ve considered
There are some other ways this could be implemented. For example, having an open
variable and a onClose
function like Material UI’s modals. Another option is making cancelButtonIndex
into an array, but that doesn’t seem super intuitive.
Additional context Add any other context or screenshots about the feature request here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@MarcoDo99 Looks like there hasn’t been a release that includes #2507 yet, so no, it’s not possible yet. Hopefully will be soon though!
@saxenanihal95 I think those look like good changes. I think we can justify this for a 2.3 release (we’ll say BottomSheet was in “beta” for 2.2) - only change missing is the docs. @JoeDuncko does those changes look good to you or were there others that you also had in mind?