Add PlatformConstants.ServerHost for iOS to support react-devtools on device
See original GitHub issueDescription
As described in this issue, react-devtools works great for iOS and Android in simulator/emulator, but only works on device on Android. I believe this is because PlatformConstants.ServerHost
is not implemented on iOS, so it always falls back to attempting to connect to localhost, and therefore from your device the react-devtools are unreachable.
Reproduction Steps and Sample Code
Try to run react-devtools and connect with an iOS device
Solution
Add PlatformConstants.ServerHost
to RCTPlatform, it should be a string constant that returns the ip:port
string that points to the packager. With this change in place, react-devtools should work out of the box on device on iOS.
Additional Information
- React Native version: 0.45
- Platform: iOS
- Development Operating System: macOS
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:18 (9 by maintainers)
Top Results From Across the Web
React-devtools not working · Issue #124 · expo/create ... - GitHub
I think by just adding PlatformConstants.ServerHost to iOS this would work in most cases. 2
Read more >React Native Debugger's connect to React not working with ...
Specifically connecting to react devtools have failed. I think this is because I am using Expo client (real device ... ServerHost ?
Read more >Using react-devtools with React Native | by Brent Vatne
Add “devtools”: “react-devtools” under scripts in package.json. npm run devtools; Now when you run your app it will connect and display the component...
Read more >react-devtools - npm
This package can be used to debug non-browser-based React applications (e.g. React Native, mobile browser or embedded webview, Safari). React ...
Read more >Debugging - React Native Archive
Debugging on a device with Chrome Developer Tools. If you're using Create React Native App or Expo CLI, this is configured for you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any news on this? Would be very nice.
In some places we use getDevserverUrl. It sounds like we should merge that with ServerHost, which is only exposed on Android right now.