-
Notifications
You must be signed in to change notification settings - Fork 44
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
is there an example using navigation-rfc + react-redux? #29
Comments
You probably wouldn't want to use both NavigationContainer.RootContainer and a redux provider- you would use one of them. I don't currently have the bandwidth to put together a redux example, but it would be great to see somebody contribute that |
Why I don't want to do that? I mean, I need to connect my components to my redux store somehow and to do that I need to use I'm just implementing that right now, I'm the stage of making my connectors so I can dynamically bind them to the right component when I call the routeMapper to render the correspondent component for that route. When I finish I can share here what I've done and even get some feedback |
You can use both if you prefer. IMO, it will be easier to only use redux if you already have it in your app |
here is a partial example of how you might go about implementing navigation-rfc with redux: https://gist.github.com/rt2zz/b8d9fe31f4d94ce903e4 The basic idea is skip the RootContainer and simply manage the |
I actually like your proposal, @rt2zz! Looks like What I'd like to have is a @ericvicenti should I try to make a working example? |
Guys I think he is talking how he can connect his components using the navigator with his redux store and not how to use the redux store for control the navigation. |
@lucasfeliciano who are you talking about? 😃 |
about @sibeliusseraphini issue.
|
This discussion is great: the redux + router + navigation problem does not have a definite solution. @Kureev's idea makes even simpler how we can integrate a redux instance with the navigation @rt2zz code should be provided by @Kureev I would like to see a working example with your ideias, maybe even with the modified |
I'll try to make an example using a forked version of the I post an update here when the example will be ready |
Pinging @taion, he might be interested to join this discussion |
Yep, agreed. The pieces of @Kureev, let me know how it goes! Hopefully you won't need to fork too many modules. Let me know if you run into any problems! |
After a quick brainstorming I've spent some time on prototyping routing based on the redux state. It's not on the github yet, but I want to share some of my ideas: const store = createStore(reducer, makeNavState([<Content />]));
class Basic extends Component {
render() {
return (
<Provider store={store}>
<NavigatorRedux />
</Provider>
);
}
} In this example we have a new Currently, redux navigation node has a following signature: {
__nav: {
stack: new Immutable.Stack(stack),
index: index,
},
}; Parameters
nav: { route, index, stack, actions }, Where:
The biggest unsolved question for now is an animated scene transitions. But I suggest to open a new issue for this discussion. |
@Kureev That looks good to me. Seems to me like Animated transitions can definitely be trickier (but certainly not impossible) with a pure stateless context, so I concur it's a subject for another issue. |
@ohanhi Exactly. |
If somebody is curious, I've made a small redux navigator based on this one. It's more to validate my ideas than to make a solid standalone project, so don't take it serious. Now I'm thinking if there's a way to merge it in anyhow, @ericvicenti ? 😃 |
This code is about to be moved to the |
I forked and just move state outside NavigationRootContainer, you can use it with redux or other flux lib. |
Here's an example I came across for using NavigationExperimental with Redux: https://github.com/jlyman/RN-NavigationExperimental-Redux-Example I can't vouch for it, but thought I'd at least throw in a link. |
I recently posted a blog post on this too if anyone needs it - https://medium.com/@satya164/react-natives-navigationexperimental-with-redux-467acee02756 |
closing this as react-navigation is out tks |
How to combine NavigationContainer.RootContainer and Provider for instance
The text was updated successfully, but these errors were encountered: