Comments (4)
React Router matches routes in the order they are defined. See also, remix-run/react-router#1923. Hence, the jumps between tabs. So you will need to make sure "identical" paths are relative
to their respective <StackRoute>
or <TabRoute>
.
I think the best way to approach it will be the following:
const userRoutes = (
/* relative paths */
<Route path="user/:userId">
<Route path="user/:userId/followers">
);
const routes = (
<TabsRoute path="/">
<StackRoute path="/friends">
<Route path="list">
{userRoutes}
</StackRoute>
<StackRoute path="/profile">
<Route path="me">
{userRoutes}
</StackRoute>
</TabsRoute>
);
However, there is a bug, #17, that prevents this from working as expected. The fix should be live in a week or so few weeks.
🍺
from react-router-native.
With proposed solution, how can I hide tab bar when on userRoutes
? Trying to build something similar like FB messenger (Home -> conversation, People -> conversation)
from react-router-native.
@arthurpark You can refer to facebook/react-native#8350 for how to control overlays from the scene. I think the best way is to use either redux or some kind of event system as suggested on the thread.
@jmurzy What do you think about writing a new url matcher that first matches routes under the current route subtree, then climb up the tree if not found, and so on, for each level?
The new matcher will always try to match the route that is closest to the current route, and there can be multiple routes sharing the same url pattern. Do you see any potential problems with this approach?
from react-router-native.
@arthurpark Take a look at the example app. The only difference is that instead of rendering the tabs in the Master
component, you'd have to put them in each of your route components that render the individual tabs. So when the transition happens, tabs will just simply hide away as with the rest of your tab component.
@joonhocho I'm still working on this. Recent refactoring of the internal API was to pave the way for more flexibility in how routes are matched. I need to cover all the cases and avoid as much of the magic as possible. Honestly, this is the reason why I'm still tagging the releases with alpha
.
🍺
from react-router-native.
Related Issues (20)
- Tabs Route creates a new view in the hierarchy every time
- <Link> component has excessive required props. HOT 1
- Component not unmounting on goBack() HOT 3
- Override navigationCard styles
- Change Icon when the tab is active
- Header right button disable
- Router not passed to children HOT 3
- Unnecessary warning: An <IndexRoute> is not allowed for <TabsRoute>? HOT 1
- compatibility react-native-web ? HOT 5
- undefined is not a function(evaluating '(0, _reactRouterNative.withRouter)') HOT 3
- Can't specify routes as a plain object
- Not fired componentDidMount when change route in StackRoute through history.push
- How does this relate to react-router v4 new native package? HOT 3
- Please sanity test my query modification functions [Suggestion?]
- Is it possible to use es6 class syntax for component definition?
- Cannot read property 'location' of undefined HOT 2
- Not working in react-native-web HOT 1
- is this project abandoned? HOT 5
- Add react-router-native to reactnative.gallery 🎨
- Tabs getting reset to initial route on modifying device font
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router-native.