Skip to content

Devtools should talk to the development server instead of localhost #15126

@ckknight

Description

@ckknight

Is this a bug report?

Yes

Have you read the Bugs section of the How to Contribute guide?

Yes

Environment

  1. react-native -V: 0.46.3
  2. node -v: v6.11.0
  3. npm -v: 3.10.10
  4. yarn --version: not used

Then, specify:

  • Target Platform: iOS
  • Development Operating System: macOS
  • Build tools: using XCode to successfully deploy to an iPhone 7

Steps to Reproduce

(Write your steps here:)

  1. Deploy a debug build of a react-native app to a real device on WiFi
  2. Use a remote debugging tool such as Nuclide or react-native-debugger

Expected Behavior

React DevTools should work just as it does when running in the simulator.

Actual Behavior

In the debugger on my computer, the message "Waiting for React to connect..." appears and never goes away.

Instead of communicating to my computer, React DevTools is attempting to communicate via localhost which is the phone.

The offending line is https://github.com/facebook/react-native/blob/master/Libraries/Core/Devtools/setupDevtools.js#L33

A working replacement for 'localhost' is require('NativeModules').SourceCode.scriptURL.split('://')[1].split('/')[0].split(':')[0], which works on-device and in-simulator, but there is likely a much better solution.

Reproducible Demo

All react-native projects are affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions