React-native-router-flux: Adopt RNRF for latest React Navigation (v2+)

Created on 6 Jun 2018  路  14Comments  路  Source: aksonov/react-native-router-flux

Current 4.0.0-beta.31 depends from react-navigation 1.5.6. It would be great to migrate to latest v2. createNavigator API is changed and some other breaking changes were made..

enhancement help wanted

Most helpful comment

I have this partially done - when finished I can push a PR and reference it here.

All 14 comments

I have this partially done - when finished I can push a PR and reference it here.

I want to know what version of react-native is required after the upgrade?

@gyf19 I'll confirm it as soon as I get back to contribute here - probably end of next week. Thank you.

I'm really looking forward to an integration with the new versions since the following bug is very visible in our app: https://github.com/react-navigation/react-navigation/issues/4185

It's fixed in 2.5.5 :)

Unfortunately it seems to be quite hard... I started and stuck here: https://github.com/react-navigation/react-navigation/issues/4481

As you can see react-navigation starts recommending to store state within their library only and will not support (?) external management of state with Redux, MobX, etc. (as well as RNRF), etc. starting next major version. I will think what I can do.

I found one easy and one complex way. First is to remove state management from RNRF, second is to build own navigators and use them instead of react-navigation ones, use only views from react-navigation. I'm working on first way while probably second way may be implemented at the future (or maybe not).

Feel free to check my PR (Some links work, some not - login/lightbox/modal don't work yet)

@daviscabral what do you think about my comments above and my PR? There are still a lot of things to to do, maybe you can help here (new tab navigator, our custom actions like popTo, etc)....

@aksonov Great - I've been thinking about removing state management from RNRF - but that would make the project name a bit out of sync with it. I'll check your PR and start to hack on missing stuff - let me know things that you would prefer me to look into first.

@daviscabral Could you clarify - "make the project name a bit out of sync with it." ? RNRF name?
You may start from converting Modal/Overlay/Lightbox navigators and restore original Example demo, fix eslint errors or restore original actions like POP_TO, checking all other actions like RESET, REPLACE - they may not work..., etc.

@aksonov sure - yeah - when I was trying to make it to work with react-navigation@2 here - ended being more like a utils than something like it is now. But checking your PR, that's a way better than I thought.

I have created a few helpers/utils for some projects where I am using react-navigation@2 that I think might be useful there. I'll get started with it tonight! 馃憤

@daviscabral Great! Also we can remove mobx now too to make RNRF more lightweight (everybody who are observing state/or currentScene will be able to pass own onNavigationState function)

@aksonov I can do it - even provide the way to connect it with onNavigationState.

Also - with the new React context API - we might want to explore that instead of a forward props hell that usually happens.

Please check latest 4.0.0-beta.40, it uses React Navigation v2.x now

There's quite the annoying bug in 2.x of RNavigation, did anyone find a workaround?

https://github.com/react-navigation/react-navigation/issues/4884

Unfortunately, I'm still stuck in the beta's because of it...

Was this page helpful?
0 / 5 - 0 ratings