【问题标题】:Renaming react native example app重命名反应原生示例应用程序
【发布时间】:2016-07-20 09:10:42
【问题描述】:

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

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.

【问题讨论】:

    标签: javascript android ios reactjs react-native


    【解决方案1】:
    1. 更改package.json中的name属性
    2. 运行 react-native 升级
    3. 更改您的 Appregistry AppRegistry.registerComponent('MyApp', () =&gt; MyApp);

    【讨论】:

    • 嘿@kenitive 我忘了提到我已经更新了package.json,但是除了项目似乎没有更新之外,它仍然在错误中引用Example。还有为什么要从App重命名为MyApp
    猜你喜欢
    • 2019-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-29
    • 1970-01-01
    相关资源
    最近更新 更多