react-native-in-app-notification
react-native-in-app-notification copied to clipboard
Redux support
Hi, can you please show me an example of using react-native-in-app-notification
with react-redux
.
On your docs says:
export default withInAppNotification(MyApp);
But i need to use it on my Routes
file (so i can routing on notification onPress event), i am using react-native-router-flux
, so right now i have this on my Routes
file:
export default connect(mapStateToProps)(Routes);
I think i can't consume the showNotification
prop on that file.
Maybe if i use this approach can i make it?:
https://gist.github.com/testshallpass/d76c656874e417bef4e0e6a63fc492af
So not using the context and use the static class helper.
What do you think guys.
Thanks.
@shiftrtech you can use something like
export default connect( mapStateToProps, mapDispatchToProps )(withInAppNotification(Component))
@SobakaSlava - this works and lets you then use this.props.showNotification
in the component. 👍
However, a further question on using this with Redux, is it possible to call the showNotification
method outside of the context of a view (and just show it up wherever the user is?). An example is that a user might submit something and that gets fired off asynchronously. Meanwhile the might visit another page. In that time, I would like to notify them that their submission was successful (or not). How can this be achieved?