Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

How to link to a detail view in a different tab #65

@eaco-andrew

Description

@eaco-andrew

Question
How to you link to a detail view in a different tab?

What is the current behavior?
When I click on the link in the root view, on the item page the back button goes back to the root view. How do you make it go back to the items view?

What is the expected behavior?
That it would go back to the items view

Environment (include versions). Did this work in previous versions?

  • Device: iPhone 8 simulator
  • OS: iOS 11
  • React-Native (version): 0.53.3
  • React-Router (version): 4.2.0
  • React-Router-Navigation (version): 1.0.0-rc.4
import React, {Component} from 'react'
import {
    Text,
    View,
} from 'react-native'
import {NativeRouter, Link} from 'react-router-native'
import {BottomNavigation, Navigation, Card, Tab} from 'react-router-navigation'

export default class App extends Component<Props> {
    render() {
        return (
            <NativeRouter>
                <BottomNavigation>
                    <Tab
                        label="Root"
                        exact
                        path="/"
                        render={() => (
                            <View style={{marginTop: 50}}>
                                <Text>Root View</Text>
                                <Link to={'/items/1'}>
                                    <Text>Go to Item 1</Text>
                                </Link>
                            </View>
                        )}/>
                    <Tab
                        label="Items"
                        path="/items"
                        render={() => (
                            <Navigation>
                                <Card path="/items/:id" render={() => (
                                    <View>
                                        <Text>Item 1 View</Text>
                                    </View>
                                )}/>
                                <Card path="/items" render={() => (
                                    <View>
                                        <Text>Items View</Text>
                                        <Link to={'/items/1'}>
                                            <Text>Go to Item 1</Text>
                                        </Link>
                                    </View>
                                )}/>
                            </Navigation>
                        )}/>
                </BottomNavigation>
            </NativeRouter>
        )
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions