react-native-snackbar
react-native-snackbar copied to clipboard
Compatibility with react-native-navigation modals on android
Hi,
first of all, thanks for this awesome library.
I noticed that the snackbars won't show on android in modals if one uses react-native-navigation. Imho, this is due to the fact, that react-native modals are rendered in the view hiearchy of the current activity, but react-native-navigation modals aren't (as they are internally Dialogs
). Therefore, they are not found by the current implementation of recursiveLoopChildren
.
I fixed it on my fork at https://github.com/johakr/react-native-snackbar. However, this enforces react-native-navigation as a dependency and is therefore not compatible with projects not using react-native-navigation.
To be honest, I currently have no idea and no time to figure out how to make this work for both kind of projects (those using react-native-navigation and those using standard react-native modals). Maybe someone wants to take a look at it and bring it into a mergable state.
For those using react-native-navigation and struggling with getting snackbars working in modals, feel free to use my fork as an interim solution.
Thank you @johakr! Permalink to commit: https://github.com/johakr/react-native-snackbar/commit/c1d485d3e3ab8b7b608adc97dc0636264472e10f.
If anyone is willing to make a more general PR for this I'd be happy to merge.
Also see https://github.com/cooperka/react-native-snackbar/issues/28 for a similar issue.
How can I use this commit in my project? Modifications in node_modules are lost easily. Could you drop it in npm to be installed please, because I'm having the same problem and need this fix. Thanks for this great lib!
@CoderProject You can install the fork directly from github, no need for npm. Just update your package.json to "react-native-snackbar": "johakr/react-native-snackbar"