-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Comments
The sibling file of |
This would be nice when working with Expo as well! |
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:
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. |
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
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
Is this a bug report?
Yes
Have you read the Bugs section of the How to Contribute guide?
Yes
Environment
react-native -V
: 0.46.3node -v
: v6.11.0npm -v
: 3.10.10yarn --version
: not usedThen, specify:
Steps to Reproduce
(Write your steps here:)
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'
isrequire('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.
The text was updated successfully, but these errors were encountered: