question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a functionality that will close the BottomSheet when a list item is pressed

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeDunckocommented, Aug 26, 2020

@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!

1reaction
flyingcirclecommented, Aug 15, 2020

@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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Close modal bottom sheet programmatically in flutter
Following a code snippet for better understanding. The problem is that the ModalBottomSheet isn't closing when tapping on "Item 1" or "Item 2"....
Read more >
Flutter Beginners Guide to using the Bottom Sheet - Medium
Knowing when it closes. The showBottomSheet function returns a PersistentBottomSheetController which is a generic class. We can use this to ...
Read more >
showModalBottomSheet function - material library - Dart API
This example demonstrates how to use showModalBottomSheet to display a bottom sheet that obscures the content behind it when a user taps a ......
Read more >
Creating and styling a modal bottom sheet in React Native
In this tutorial, we'll create a basic application with a modal bottom sheet feature. We'll set up the app, fetch data, and style...
Read more >
Services > $mdBottomSheet - AngularJS Material
The bottom sheet's template must have an outer <md-bottom-sheet> element. · Add the md-grid class to the bottom sheet for a grid layout....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found