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

IMPORTANT: v4 beta release is ready (v3 is not supported anymore) #1974

Closed
aksonov opened this issue Jul 5, 2017 · 27 comments
Closed

IMPORTANT: v4 beta release is ready (v3 is not supported anymore) #1974

aksonov opened this issue Jul 5, 2017 · 27 comments

Comments

@aksonov
Copy link
Owner

aksonov commented Jul 5, 2017

Please check latest 4.0.0-beta.* , Example as demo:
https://github.com/aksonov/react-native-router-flux/tree/v4

V4 Features:

  • Based on latest https://reactnavigation.org API
  • Separated navigation logic from presentation. You may change now navigation state directly from your business logic code - stores/reducers/etc. navigationStore
  • Built-in state machine (former Switch replacement) - each ‘scene’ has onEnter/onExit handlers.
  • MobX-powered, all used scenes are wrapped as 'observer' automatically. You may subscribe to navigationStore (former Actions), observe current navigation state, etc. If you are using Redux, you still could pass your reducer factory to createReducer param for Router.
  • Flexible nav bar customization, that is not allowed by react navigation right now:
    How to customize the back button in Stack Navigator react-navigation/react-navigation#779
  • Built-in reactnavigation drawer support (use drawer attribute for Scene and contentComponent to use your own Drawer)
  • 'Lightbox' support (used by popups like Error alert within Example project)

Breaking changes (comparing to v3):

  1. No duration/panHandlers support - you have to implement custom navigator now instead and pass it as ‘navigator’ prop:
    https://reactnavigation.org/docs/navigators/custom

  2. No support for partial hiding of tab bar for some tabs because of react navigation bug:
    Cannot read property 'setNativeProps' of undefined react-navigation/react-navigation#1584

  3. No possibility to skip animation during reset/replace:
    How to reset the navigation stack without animation? react-navigation/react-navigation#1493

  4. Switch is removed - you may use onEnter (or just on) / onExit handlers for more flexible logic. They could be async functions. Success termination of onEnter will run success handler, failure handler will be run otherwise. You can pass just state keys to success/failure too. This way you can create very complex state machine and don't use Switch or navigation from componentDidMount.

  5. getSceneStyle is removed (no needed in v4).

  6. Custom reducer (‘createReducer prop for Router) - Redux actions now are passed from React Navigation (‘Navigation/BACK’, ‘Navigation/NAVIGATE’, etc.)

  7. Drawer is 'drawer' attribute Scene

  8. Modal is 'modal' attribute for Scene

  9. No flux 'focus' actions - use onEnter/onExit handlers instead.

As you can see React Navigation still contains some issues, but anyway it is more stable than obsolete 'react-native-experimental-navigation' used by v3 now.

Here is link about road to v1 (so you can see all issues at one place):
react-navigation/react-navigation#723

@Kennytian
Copy link

Good news, I love you!!

@hungdev
Copy link

hungdev commented Jul 6, 2017

i love you.

@isAlmogK
Copy link

isAlmogK commented Jul 7, 2017

How do you install version 4, I'm not seeing a tag or release for it?

@aksonov
Copy link
Owner Author

aksonov commented Jul 7, 2017

It is with 'beta' tag. Latest beta for today is 4.0.0-beta.5

@southerneer
Copy link
Collaborator

@AlmogRnD in package.json it would be:

"react-native-router-flux": "^4.0.0-beta.5",

@isAlmogK
Copy link

isAlmogK commented Jul 8, 2017

Thanks this is perfect

@aksonov
Copy link
Owner Author

aksonov commented Jul 8, 2017

Master is replaced with v4 now. v3 is moved to 'v3' branch.

@guysegal
Copy link

guysegal commented Jul 8, 2017

Amazing Work!

I have a few questions though:

  1. When is documentation for v4 is expected? Will it contain a tutorial for migration from v3 to v4?

  2. if a future release of react-native will break something in v3, will it be fixed in v3 patch releases?

Thanks

@aksonov
Copy link
Owner Author

aksonov commented Jul 8, 2017

@guysegal

  1. We will start working on it next week. Yes, eventually migration tutorial will be created too - actually most API is the same, differences are already listed. Feel free to submit PRs, it is open-source project. Follow me on github/twitter to get updates.

  2. If community will submit PR/patch I will publish new v3 revision.

@eseQ
Copy link

eseQ commented Jul 10, 2017

@aksonov awesome. But i have one q: why mobx in dependencies?

@aksonov
Copy link
Owner Author

aksonov commented Jul 10, 2017

@dictory mobx manages navigation state and reload navigators after state changes.

@isAlmogK
Copy link

isAlmogK commented Jul 10, 2017 via email

@aksonov
Copy link
Owner Author

aksonov commented Jul 10, 2017

@AlmogRnD Will do it today.

@isAlmogK
Copy link

isAlmogK commented Jul 10, 2017 via email

@bragur
Copy link

bragur commented Jul 10, 2017

Beautiful! How about further drawer attributes, like drawerPosition, initialRoutename etc.? Where or how would they be declared?

@aksonov
Copy link
Owner Author

aksonov commented Jul 10, 2017

@bragur Check beta.7, you could define it as Scene props for drawer now

@aksonov
Copy link
Owner Author

aksonov commented Jul 10, 2017

My lighting talk proposal about RNRF v4 version:
https://gist.github.com/aksonov/e2d7454421e44b1c4c72214d14053410

@itinance
Copy link

Can you explain pls the following statement:

Built-in reactnavigation drawer support (use drawer attribute for Scene and contentComponent to use your own Drawer)

In the API-documentation i've found nothing about it.

Is the new drawer-Attribute simply a boolean setting to true when a scene is managed by a drawer? I understood, that contentCOmponent is the attribute where to pass the final Drawer-Component is it was with "drawer" in v3

@aksonov
Copy link
Owner Author

aksonov commented Jul 18, 2017

@itinance Please check Example project to see new drawer syntax.

@aksonov
Copy link
Owner Author

aksonov commented Jul 18, 2017

I've just updated 'migration' docs about drawer.

@saimonmoore
Copy link

@aksonov I just upgraded a really simple app from v3 to v4 (4.0.0-beta.17) and navigation just stopped working (no errors or anything in the console). I checked the breaking changes and migration file but I didn't see anything that affected my app so I haven't really changed anything. Not sure how to proceed:
screenshot from 2017-08-09 10-19-47

(onPress for each song would execute this: const goToSongScene = () => Actions.song({song: this.props.song});). The callback executes but the Action call does nothing.

Is there anything there that you can see offhand? Or tips to go about debugging this?

Very much appreciate any help with this.
Thanks.

@saimonmoore
Copy link

Nm thanks, I switched to react-navigation pure

@antonsivogrivov
Copy link

antonsivogrivov commented Aug 16, 2017

Tell me please, what is better (v3 or v4) to use for production with redux?

@waqas19921
Copy link

@aksonov Please provide a better documentation for v4 as in example The components Lightbox, modal are used and there is no documentation about them and also many changes in props but have nothing documented.

@tejacoder
Copy link

how to add icon in v4 ?

@eseQ
Copy link

eseQ commented Aug 21, 2017

Anyone can write migration guide like webpack

@aksonov
Copy link
Owner Author

aksonov commented Aug 21, 2017

@waqas19921, @dictory Yes, v4 lacks of documentation and we are trying to improve it. Unfortunately we have lack of maintainers now.

Guys, this project is open source, feel free to check sources and submit PR for docs. Guys, let's improve open source, not just use it for free.

@tejacoder Check Example project and existing docs. If still not clear, create separate issue.

All, I'm closing this ticket (original aim was just to make announce), create issue (and better with PRs) if any.

@aksonov aksonov closed this as completed Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests