facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.2k stars 24.33k forks source link

Any reference about the static bundle? #528

Closed matth3wga0 closed 9 years ago

matth3wga0 commented 9 years ago

The react-native cli automatically generates index.os.js, but I'm planning to design a universal app targeting both iOS and Android, so the entry point should be the same. By checking out the official examples, I found the Movies app did the trick, and in the AppDelegate.m,

[NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle"]

instead of

[NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];

then I renamed index.os.js to App.js and made some modifications as below, hit the run, but it seems that the App.bundle couldn't be found.

//App.js
AppRegistry.registerComponent('App', () => App);
module.exports = App;
//AppDelegate.m
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/App.bundle"];
glenjamin commented 9 years ago

See #240

amasad commented 9 years ago

What do you get if you open http://localhost:8081/App.bundle in your browser?