react-navigation / rfcs

RFCs for changes to React Navigation
Other
88 stars 16 forks source link

Standard flag for routers such as TabRouter whose children can handle actions without forcing the parent to switch focus #12

Closed brentvatne closed 4 years ago

brentvatne commented 6 years ago

Currently the TabRouter will switch to a child router that handles a navigation action if it is not SET_PARAMS or (soon) COMPLETE_TRANSITION. We should have some flag on navigation actions that either a) tells the router to switch focus to the child that handles the action or b) tells the router to not switch focus if the child handles the action. This lets people with custom routers and actions deal with the behavior properly without forking TabNavigator to add their action to the whitelist.

satya164 commented 4 years ago

Closing since we have added a flag on action (action.preserveFocus). In React Navigation 5, routers can specify a shouldActionChangeFocus method to control this behaviour.