重命名反应原生示例应用程序

时间:2016-07-20 09:10:43

标签: javascript android ios reactjs react-native

所以我试图从这个示例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.

1 个答案:

答案 0 :(得分:1)

  1. 更改package.json
  2. 中的名称属性
  3. 运行react-native upgrade
  4. 更改您的Appregistry AppRegistry.registerComponent('MyApp', () => MyApp);
相关问题