Navigate between StackRoute and TabsRoute, Cannot pop(-1)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, react-native
- Domain
- mobile
Research direction
Start with the Router example in the issue and inspect how NativeRouter coordinates StackRoute and TabsRoute transitions. Reproduce navigation between /terms and /dashboard and trace the “Cannot pop(-1)” failure. Done means both route groups can be entered and left without clearing the relevant navigation history.
Written by the indexing model from the issue text.
Description
I have an app which has a dashboard that needs login and some other screens before enter.
The dashboard has a tabbed layout so I went and use the TabsRoute for the dashboard and children and a StackRoute for the other routes.
It works, but not that very well, This is the structure of the routes I have to make:
- Frontpage screens (StackedRoute, all with the same style)
- Frontpage
- Login
- Terms and coditions
- ... some other static screens
- Main content (tabbed, and some screens with a header)
- Dashboard
- Statistics and other tabs
- Settings (StacedRoute but different styles and headers than the frontpage one)
- Settings
- Options and some forms
- Others to define
Here is the code I'm working on:
export class Router extends Component {
render() {
return (
<NativeRouter history={this.props.history} addressBar>
<StackRoute path="fullscreen" component={Master} >
<Route path="/" component={PageOne} />
<Route path="/terms" component={Terms} overlayComponent={Header({title: 'Terms of Service'})} />
<Route path="/login" component={Login} overlayComponent={Header()} />
<Route path="/reset-password" component={ResetPassword} overlayComponent={LeftCancelHeader()} />
<Route path="/register" component={Register} overlayComponent={Header()} />
<Route path="/verify-mobile" component={VerifyPhone} overlayComponent={CancelHeader({title: 'Verify Mobile', cancelText: 'Close'})} />
</StackRoute>
<TabsRoute path='mainApp' component={TabsWrapper}>
<Route path="/dashboard" component={Dashboard} />
<Route path="/profile" component={Profile} overlayComponent={Header({title: 'My account', back: false})}/>
</TabsRoute>
</NativeRouter>
)
}
}
Now, the problem I'm having is that there is no way to navigate back to /terms from /dashboard and viceversa. The error says it Cannot pop(-1), the stack cannot be emptied, so it seems to be clearing the complete history before changing between Routes.
By the Aviato example it seems to be possible to do this without loosing history, but as my app has a variety of navigation schemas and styles, I splited it instead of making all of them inside a single route
Any recomendation on how to archieve what I want?
Thanks in advance.
- Dominant language
- JavaScript
- Stars
- 636
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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.
More from jmurzy/react-router-native
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 1/5 Under an hour Newbie friendliness 10/100
jmurzy/react-router-native#81 · 5 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
jmurzy/react-router-native#79 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
jmurzy/react-router-native#78 · 2 comments · 3 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
All issues in jmurzy/react-router-native
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
keyxmakerx/Chronicle#2284 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
soroswap/token-list#125 ·
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EveryInc/compound-engineering-plugin#2085 ·
Maintainers usually reply within 1 day