mcnamee / react-native-starter-kit

:rocket: A React Native boilerplate app to get you up and running very, very quickly :rocket:
MIT License
3.35k stars 863 forks source link

Error message remains when returning to a scene #191

Closed GitHubGreg closed 5 years ago

GitHubGreg commented 6 years ago

If a user gets an error message on the signup scene (e.g. First name is missing), and then leaves that scene with the back button, then returns to the scene, they still see the error message. Is there a way to reset the scene (or the state.status.error) so that when they return to the scene it is new again? Thanks.

GitHubGreg commented 6 years ago

And even if they enter another scene that also calls the state.status.error conditionally, it will still show the error message even if it is a completely unrelated scene.

mcnamee commented 5 years ago

I'd suggest maintaining success/error/info/loading statuses on a container-component level, opposed to storing it in Redux. It avoids issues like you've described, and really doesn't need to be in an app-wide store (given they're typically specific to an individual screen/function at a point in time).

It's the pattern I lean toward - and does need to be changed in this repo. Happy to accept a PR if you get a moment?

GitHubGreg commented 5 years ago

Makes sense. If I can find the time I will be happy to do it. Thanks for this great repo.