Skip to content

React IOS & Android simultaneous device development

Tam edited this page Feb 20, 2018 · 3 revisions

Android

With the device connected and in development mode (Google it), port-forward :8081 on your Android device.

Then run react-native run-android. Done.

IOS

Open AppDelegate.m in Xcode.

Replace:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

with

#ifdef DEBUG
  jsCodeLocation = [NSURL URLWithString:@"http://[YOUR_LOCAL_IP_HERE]:8080/index.ios.bundle?platform=ios&dev=true"];
#else
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#endif

Then run react-native start --port 8080. Build from Xcode to your IOS device. Done.

Notes

  • Make sure you're running everything on the same Wifi network
  • Shake devices to open dev menu and enable hot/live reloading
  • Debug JS Remotely is shit so only use it when you reallly need to console.log something. It's better now so you can probably always have it enabled.
Clone this wiki locally