Skip to content

Unable to set selected default tab #238

@ippy04

Description

@ippy04

Hi - I'm trying to set the default tab to be the middle tab rather than the first tab on a 3 tab screen. My Route / Router:

<Route name="tabbar" hideNavBar={true}>
    <Router footer={TabBar} hideNavBar={true}>
        <Route name="foo" component={Foo1} title="Foo1" icon={FooIcon} schema="tab" />
        <Route name="foo2" component={Foo2} title="Foo2" icon={FooIcon2} schema="tab" />
        <Route name="foo3" component={Foo3} title="Foo3" icon={FooIcon3} schema="tab" />      
    </Router>
</Route>

Trying to set the selected prop on the react-native-tabs component copied from https://github.com/aksonov/react-native-router-flux/blob/master/TabBar.js

<Tabs selected="foo2" onSelect={this.onSelect.bind(this)} {...this.props}>
    {this.state.children}
</Tabs>

Results in a "cannot find router for route=foo2 current router=undefined" error

I'm assuming this is related to #164? Any ideas on how to set the default tab to not be the first defined route?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions