React-native-router-flux: Route 'key0' should declare a screen. For example

Created on 26 Jan 2018  路  9Comments  路  Source: aksonov/react-native-router-flux

Version

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.52.1

    Actual behaviour

throw error like below:

Unhandled JS Exception: Error: Route 'key0' should declare a screen. For example:

    import MyScreen from './MyScreen';
    ...
    key0: {
        screen: MyScreen,
    }
    ...

Expected behaviour

then I import all business components into the entry file, and combine them into wrap, it works, but I want organize my route in each business module, and export some module files, combine them in entry file finally.

sorry i'm not good at English.

please give me a hand, I can't thank you any more

Steps to reproduce

I export some Components from my business modules like below:

mm01.js

(...some imports gose here)
export default class MM01 extends Component{
  render(){
    return (
      <Scene key="myModule01" initial tabs>
          <Scene key="myModule010" initial component={MM010}>
          <Scene key="myModule011" component={MM011}>
          <Scene key="myModule012" component={MM012}>
          <Scene key="myModule013" component={MM013}>
      </Scene>
    );
  }
}

mm02.js

(...some imports gose here)
export default class MM02 extends Component{
  render(){
    return (
      <Scene key="myModule02">
          <Scene key="myModule020" initial component={MM020}>
          <Scene key="myModule021" component={MM021}>
      </Scene>
    );
  }
}

entry.js like below:

(...some imports gose here) 
class App extends Component {
    return (
      <Router>
          <Scene key="root">
              <MM01 />
              <MM02 />
          </Scene>
      </Router>
    );
}
AppRegistry.registerComponent('rnMbox', () => App);
v3 or v4.0.0-beta

Most helpful comment

https://github.com/aksonov/react-native-router-flux/blob/v4/docs/OTHER_INFO.md#split-your-scenes-to-smaller-parts-if-needed

It works for me.

All 9 comments

https://github.com/aksonov/react-native-router-flux/blob/v4/docs/OTHER_INFO.md#split-your-scenes-to-smaller-parts-if-needed

It works for me.

@wulala 璋㈣阿

@felixzxk Did you find a fix? Please help i'm having the same problem.

@isaackdamian
@wulala told the fix, Split your scenes to smaller parts if needed
https://github.com/aksonov/react-native-router-flux/blob/v4/docs/OTHER_INFO.md#split-your-scenes-to-smaller-parts-if-needed

How to use Component to divide routers?

Getting the same error as well with beta 31, the v3 method no longer works and the link above throws a 404 error

is this problem still going on ?

seriously ! please don't write packages if you can't maintain them, fix the issues

v3 and beta are not supported.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sylvainbaronnet picture sylvainbaronnet  路  3Comments

wootwoot1234 picture wootwoot1234  路  3Comments

GCour picture GCour  路  3Comments

VictorK1902 picture VictorK1902  路  3Comments

basdvries picture basdvries  路  3Comments