mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Get server host in setupDevtools for Android
Summary:
The `setupDevtools` for Android looks coming on [v0.30](22fbb6d46d
), currently we need to run `adb reverse tcp:8097 tcp:8097`, I think get host IP (`10.0.2.2`, Genymotion: `10.0.3.2`) for Android will be better. (it can be found in `AndroidConstants` native module)
Closes https://github.com/facebook/react-native/pull/8811
Differential Revision: D3586177
Pulled By: javache
fbshipit-source-id: 3bfe04391b0fea608e4d3deab03dd376fab8727c
This commit is contained in:
parent
875d5d2364
commit
46417dd26a
@ -11,10 +11,17 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var Platform = require('Platform');
|
||||
var NativeModules = require('NativeModules');
|
||||
|
||||
function setupDevtools() {
|
||||
var messageListeners = [];
|
||||
var closeListeners = [];
|
||||
var ws = new window.WebSocket('ws://localhost:8097/devtools');
|
||||
var hostname = 'localhost';
|
||||
if (Platform.OS === 'android' && NativeModules.AndroidConstants) {
|
||||
hostname = NativeModules.AndroidConstants.ServerHost.split(':')[0];
|
||||
}
|
||||
var ws = new window.WebSocket('ws://' + hostname + ':8097/devtools');
|
||||
// this is accessed by the eval'd backend code
|
||||
var FOR_BACKEND = { // eslint-disable-line no-unused-vars
|
||||
resolveRNStyle: require('flattenStyle'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user