Feature: Displaying snackbar at the top/bottom of desired component
Opened this issue · 6 comments
It would be nice to have the snackbar displayed at the top/bottom of required components instead of displaying at the very bottom of the whole app. This is especially useful if the app has tabBar at the bottom or when the snackbar has to show on top (again not at the very top but at the top of the desired component)
Edit from maintainer:
A simple, generic way to accomplish this might be to use a top
and bottom
value similar to how CSS works. With top: 0
, the Snackbar would be at the very top of the screen. With bottom: 50
, the Snackbar would be 50 dp above the bottom of the screen.
This was originally attempted in #137 but the PR was abandoned before it could be merged. Feel free to take that work as an example.
This feature sounds similar in nature to #11; easy to do with plain JS, but hard to do natively. I would love to re-write this library to be completely JS and not require any linking, but I just haven't had the time quite yet. I'm very open to PRs though :)
Nooo complete js please! hahah
The native part is the most awesome part! I think it can easily be supported natively with CoordinatedLayout
as this guy demonstrates - https://android.jlelse.eu/scroll-your-bottom-navigation-view-away-with-10-lines-of-code-346f1ed40e9e#2514
The native snackbar also respects the native FAB - https://guides.codepath.com/android/Handling-Scrolls-with-CoordinatorLayout#responding-to-scroll-events - pretty please no pure js haha
Both could be supported at once -- it's not either/or 🙂 There are advantages to each.
I edited the issue description to suggest a generic solution. This is a quite popular request! I would happily merge a PR that does this well.