react-navigation / react-navigation/react-navigation.github.io
Document how to render conditional child navigation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 324
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Hi. In my team we’ve struggled to implement conditional child navigation, where a branch of the navigation depends on user data (e.g. data in Redux and/or received from an API). In pseudo-code:
const Section1Default = StackNavigator(/* Some screens */)
const Section1Onboarding = StackNavigator(/* Different screens */)
const RootNavigator = TabNavigator({
section1: Section1Default OR Section1Onboarding,
section2: …,
section3: …
})
The idea is that when clicking on a specific tab, the user should see either a series of "onboarding" screens or the feature’s screens. (Both options are navigators themselves, but could be single screens too.)
@brentvatne & @ericvicenti Do you think that’s a use case worth addressing in the docs?
I think I could contribute a page section or a page on this, but I’m not sure what solution to offer.
So far we’ve only found hackish workarounds, such as: a wrapper component which has a StackRouter with the two navigation branches, and which navigates to the correct branch on willFocus. It works, but the trick falls short when using the Android back button.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No documentation file, test, or entry point is named. Start by reviewing the existing navigation documentation and the reported wrapper-component workaround, then verify how conditional child navigators interact with the Android back button. Done means documenting an agreed, supported pattern for choosing onboarding or feature navigation from user data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- documentation, mobile-dev
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100