所以我正在尝试从这个示例应用程序工作:

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.

最佳答案

更改package.json中的名称属性
运行本机升级
更改您的Appregistry AppRegistry.registerComponent('MyApp', () => MyApp);

10-06 06:21