A short example with React-Native buid with webpack and Babel-ES6. The example is render the Map and show your location.
npm install
Start react-native-webpack-server.
npm start
This will start the server on port 8080.
On iOS, change the URL of your application bundle in AppDelegate.m
, changing 8081 to 8080:
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8080/index.ios.bundle"];
On Android, start your emulator or connect your device and run adb reverse tcp:8081 tcp:8080
. This causes the device to connect to RNWS on port 8080 when it tries to download to http://localhost:8081/index.android.bundle?platform=android. Ensure that you also set Dev Settings -> Debug server host for device to "localhost":
Note: No debugger or hot module replacement support is available yet for Android.
npm run hot
When you are ready to ship your app, you will want to generate a minified bundle and package it in the binary. Similar to the React Native packager, you can generate an offline JS bundle to use your app without a development server:
npm bundle