react-navigation/rfcs

Remove navigation and navigationConfig from StackView, TabView

aksonov opened this issue · 2 comments

I propose each navigation view like StackView, TabView should declare needed input properties directly as Props: goBack (for StackView), navigate, tabBarComponent (for TabView) state, descriptors and remove generic dispatch (use direct methods like completeTransition instead of dispatch(NavigationActions.completeTransition()))

This way API for views will become easier to understand.

So, the programming pattern of passing navigation to children that need to navigate will no longer work?

Just a side note but passing a subset as an object to said component is not the same navigation={{goBack, navigate, state}}, unlike navigation it will completely de-optimize PureComponent even when navigation state does not change.

It's implemented like this in React Navigation 5 (i.e. there's no navigationConfig, just regular props). We haven't exported the views yet, but something we'll do soon after ensuring that the public APIs look good.

Regarding removing navigation object, I'm not too sure about it coz it does makes things a bit more complex. But probably ok.