Otis Wright
Otis Wright

Reputation: 2110

Renaming react native example app

So I am trying to work from this example App:

https://github.com/aksonov/react-native-router-flux/tree/master/Example

But when I rename the following lines:

index.ios.js

import App from './App';
AppRegistry.registerComponent('App', () => App);

index.android.js

import App from './App';
AppRegistry.registerComponent('App', () => App);

I have rename Example.js to App.js and updated the content:

class App extends Component {
  render() {
    return (
      <Router createReducer={reducerCreate} getSceneStyle={getSceneStyle}>
        //...
      </Router>
    );
  }
}

export default App;

But when I try to compile the app I receive the following error.

Application Example has not been registered.
This is either due to a require() error during initialisation or failure to call AppRegistery.registerComponent.

Upvotes: 0

Views: 462

Answers (1)

Serhii Baraniuk
Serhii Baraniuk

Reputation: 3375

  1. Change the name attribute in package.json
  2. run react-native upgrade
  3. change your Appregistry AppRegistry.registerComponent('MyApp', () => MyApp);

Upvotes: 1

Related Questions