Skip to content

Inner routes are not working if required as component  #180

@amrnt

Description

@amrnt
// Main.js

import App from './containers/App.js';
...
const Routes = () => (
  <Router hideNavBar={true} name="root">
    <Schema name="default" sceneConfig={Navigator.SceneConfigs.FloatFromRight} />
    <Schema name="modal" sceneConfig={Navigator.SceneConfigs.FloatFromBottom} />
    <Schema name="tab" type="switch" icon={TabIcon} />

    <Route name="app" component={App} type="replace" />
  </Router>
);
// App.js

  render(){
    return (
      <Router footer={TabBar} showNavigationBar={true}>
        <Route name="tab1" type="switch" icon={TabIcon} title="Tab #1">
          <Router onPop={ ()=>{console.log("onPop is called!"); return true} }>
            <Route name="tab1_1" component={Dashboard} title="Tab #1_1" />
            <Route name="tab1_2" component={Dashboard} title="Tab #1_2" />
          </Router>
        </Route>
        <Route name="tab2" type="switch" icon={TabIcon} title="Tab #2" hideNavBar={true}>
          <Router onPop={ ()=>{console.log("onPop is called!"); return true} }>
            <Route name="tab2_1" component={Dashboard} title="Tab #2_1" />
            <Route name="tab2_2" component={Dashboard} title="Tab #2_2" />
          </Router>
        </Route>
        <Route name="tab3" component={Dashboard} type="switch" icon={TabIcon} title="Tab #3" />
        <Route name="tab4" component={Dashboard} type="switch" icon={TabIcon} title="Tab #4" />
        <Route name="tab5" component={Dashboard} type="switch" icon={TabIcon} title="Tab #5" />
      </Router>
    )
  }

When I go to any route inside App I'll get something like that:

screen shot 2016-02-05 at 23 15 27

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