Skip to content

Commit

Permalink
Make react-devtools server port can be changed
Browse files Browse the repository at this point in the history
Summary:
This PR make [server port of react-devtools](https://github.com/facebook/react-devtools/blob/master/shells/electron/index.html#L71) can be changed, currently we can set the port yourself and open it, so I think it would be better if it could also be set here.

Another reason is I can debug two RN app (`react-native start --port 8082`), but I cannot let them use react-devtools together, it would be better if I set
different `__REACT_DEVTOOLS_PORT__` in `index.ios.js` and `index.android.js`.
Closes facebook#10522

Differential Revision: D4144011

Pulled By: hramos

fbshipit-source-id: de67931f377092871a0fe92e7d9a18799625217e
  • Loading branch information
jhen0409 authored and mlguys committed Nov 8, 2016
1 parent 7b495cc commit da6e5fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libraries/Core/Devtools/setupDevtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function setupDevtools() {
if (Platform.OS === 'android' && NativeModules.AndroidConstants) {
hostname = NativeModules.AndroidConstants.ServerHost.split(':')[0];
}
var ws = new window.WebSocket('ws://' + hostname + ':8097/devtools');
var port = window.__REACT_DEVTOOLS_PORT__ || 8097;
var ws = new window.WebSocket('ws://' + hostname + ':' + port + '/devtools');
// this is accessed by the eval'd backend code
var FOR_BACKEND = { // eslint-disable-line no-unused-vars
resolveRNStyle: require('flattenStyle'),
Expand Down

0 comments on commit da6e5fc

Please sign in to comment.