Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redux support #20

Open
shiftrtech opened this issue Nov 14, 2018 · 2 comments
Open

Redux support #20

shiftrtech opened this issue Nov 14, 2018 · 2 comments

Comments

@shiftrtech
Copy link

shiftrtech commented Nov 14, 2018

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 shiftrtech changed the title react-native-router-flux Redux support Nov 17, 2018
@mikitasolo
Copy link

@shiftrtech you can use something like
export default connect( mapStateToProps, mapDispatchToProps )(withInAppNotification(Component))

@sa2812
Copy link

sa2812 commented Nov 20, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants