Update README for injectserver

This commit is contained in:
Jhen 2016-07-20 04:48:58 +08:00
parent 168206b9e0
commit f371a43f86

View File

@ -38,6 +38,34 @@ remotedev --hostname=localhost --port=8000
Change `hostname` and `port` to the values you want.
### Inject to React Native local server
##### Add in your React Native app's `package.json`:
```
"scripts": {
"remotedev": "remotedev --hostname=localhost --port=8000 --injectserver=reactnative"
}
```
The `injectserver` value can be `reactnative` or `desktop` ([react-native-desktop](https://github.com/ptmt/react-native-desktop)), it used `reactnative` by default.
Then, we can start React Native server and RemoteDev server with one command:
![Inject server](https://cloud.githubusercontent.com/assets/3001525/16925822/92b6b3ac-4d58-11e6-9f36-d57dac8892c4.png)
##### Revert the injection
Add in your React Native app's `package.json`:
```
"scripts": {
"remotedev-revert": "remotedev --revert=reactnative"
}
```
Or just run `$(npm bin)/remotedev --revert`.
### Connect from Android device or emulator
If you're running an Android 5.0+ device connected via USB or an Android emulator, use [adb command line tool](http://developer.android.com/tools/help/adb.html) to setup port forwarding from the device to your computer: