Avoid Snackbar to be hidden on external click
See original GitHub issueDescription
There is no way to prevent a Snackbar from being hidden when clicking outside. Or maybe I miss something. onRequestClose
tells:
The reason parameter can optionally be used to control the response to
onRequestClose
, for example ignoringclickaway
.
There is no doc regarding how to ignore such a clickaway
. Is there?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Avoid Snackbar to be hidden on external click #5184 - GitHub
The correct solution is to ignore the onClose event callback when reason === "clickaway" (since v1).
Read more >Prevent Snackbar from dismissing on action click
First, set your snackbar action using an empty OnClickListener: snackbar.setAction("Save", new View.OnClickListener() { @Override ...
Read more >Snackbars - Material Design
Don'tAvoid significantly altering the shape of a snackbar container. Snackbar without shadow. Don'tAvoid displaying a snackbar container without elevation.
Read more >Build and display a pop-up message | Android Developers
A Snackbar is attached to a view. The Snackbar provides basic functionality if it is attached to any object derived from the View...
Read more >Flutter: Showing SnackBar within the Widget that builds a ...
In this solution, you would have an outer widget that creates the Scaffold populated by instances of your new inner widgets, and then...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The correct solution is to ignore the
onClose
event callback whenreason === "clickaway"
(since v1).I couldn’t get this working with
onRequestClose
.Instead I used
ClickAwayListenerProps
as so:Here are the docs for ClickAwayListnerProps for reference.