question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add PlatformConstants.ServerHost for iOS to support react-devtools on device

See original GitHub issue

Description

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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
nahuelhdscommented, Jul 21, 2017

Any news on this? Would be very nice.

2reactions
javachecommented, Jun 9, 2017

In some places we use getDevserverUrl. It sounds like we should merge that with ServerHost, which is only exposed on Android right now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found