Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Tam/299a42aed45ca4ffbf9b1cf2e85fe7f7 to your computer and use it in GitHub Desktop.
Save Tam/299a42aed45ca4ffbf9b1cf2e85fe7f7 to your computer and use it in GitHub Desktop.

Android

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

Then run react-native run-andoid. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment