所以我试图从这个示例App:
开始工作https://github.com/aksonov/react-native-router-flux/tree/master/Example
但是当我重命名以下行时:
index.ios.js
import App from './App';
AppRegistry.registerComponent('App', () => App);
index.android.js
import App from './App';
AppRegistry.registerComponent('App', () => App);
我已将Example.js
重命名为App.js
并更新了内容:
class App extends Component {
render() {
return (
<Router createReducer={reducerCreate} getSceneStyle={getSceneStyle}>
//...
</Router>
);
}
}
export default App;
但是当我尝试编译应用程序时,我收到以下错误。
Application Example has not been registered.
This is either due to a require() error during initialisation or failure to call AppRegistery.registerComponent.
答案 0 :(得分:1)
package.json
AppRegistry.registerComponent('MyApp', () => MyApp);