nmac nmac - 1 year ago 143
React JSX Question

React Native dev server does not run on device

I'm using React Native v0.35 after upgrading from v0.26. I can no longer use the dev server on my device like I used to. When it builds to my phone, connected on the same wireless ip as my macbook, it builds from a pre bundle instead of the server. I used to be able to just set the ip in the app delegate, but that's no longer an option. I just want to be able to develop on an actual device.

Answer Source

For anyone who is seeking a solution to this problem:

The issue was that if you are developing on ios using a macbook, the code that governs the auto ip detection fails to pick up your machine's ip, so it defaults to the pre bundled package. In order to resolve this (for versions >= 0.29 && < 0.36-rc.1 - which already includes this patch), open up your node modules directory, find the react-native directory, then open that and find the packager directory. In packager, there is a file named 'react-native-xcode.sh', open that up. Then, find the code snippet and add the three lines of new code from here. After that, rebuild your app and restart your packager. The dev server should now load.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download