Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ckknight opened this issue Jul 20, 2017 · 3 comments
Closed

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

ckknight opened this issue Jul 20, 2017 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ckknight
Copy link

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.

@ckknight
Copy link
Author

The sibling file of getDevServer.js seems ideal to solve this - it's not obvious why it wasn't used.

@nahuelhds
Copy link

This would be nice when working with Expo as well!

@pull-bot
Copy link

pull-bot commented Oct 9, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Oct 9, 2017
@hramos hramos closed this as completed Oct 9, 2017
facebook-github-bot pushed a commit that referenced this issue Dec 29, 2017
Summary:
Related to #15126, and this would be useful for use React DevTools on real device without modify `setupDevtools.js`.

In Android emulator, the host of `SourceCode.scriptURL` is same with `PlatformConstants.ServerHost` so we can just replace it.

* Tested on iOS device with [react-devtools](https://github.com/facebook/react-devtools/tree/master/packages/react-devtools) package.
* Tested on Android emulator, the `getDevServer` module got the correctly hostname so that don't need `adb reverse`.

[ENHANCEMENT] [setupDevtools] Set host of development server for setupDevtools
Closes #15547

Differential Revision: D6544980

Pulled By: javache

fbshipit-source-id: a286874bcef0501c5d2e0be2251d58c236a5534a
mathiasbynens pushed a commit to mathiasbynens/react-native that referenced this issue Jan 13, 2018
Summary:
Related to facebook#15126, and this would be useful for use React DevTools on real device without modify `setupDevtools.js`.

In Android emulator, the host of `SourceCode.scriptURL` is same with `PlatformConstants.ServerHost` so we can just replace it.

* Tested on iOS device with [react-devtools](https://github.com/facebook/react-devtools/tree/master/packages/react-devtools) package.
* Tested on Android emulator, the `getDevServer` module got the correctly hostname so that don't need `adb reverse`.

[ENHANCEMENT] [setupDevtools] Set host of development server for setupDevtools
Closes facebook#15547

Differential Revision: D6544980

Pulled By: javache

fbshipit-source-id: a286874bcef0501c5d2e0be2251d58c236a5534a
@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants