8

Is there a way to automatically set the Debug server host & port for device in react-native apps?

I have to trigger this menu and set a proxy for my app and I want it to be done automatically when the app is installed. Is that possible?

enter image description here

mbob
  • 590
  • 1
  • 4
  • 22

2 Answers2

0

I wrote a little package for this because it was driving me nuts. Check it out here:

npm i @nick-bull/react-native-debug-address

# DEBUG_HOST=127.0.0.1:8081 npx react-native start --port 8081
# or, equivalently
DEBUG_PORT=8081 npx react-native start --port 8081

npx react-native run-android --port 8081 
Nick Bull
  • 9,518
  • 6
  • 36
  • 58
-1

Try this :

add to package.json scripts

"android": "react-native run-android --host=<ip-address>:8081"

then to run to start up project

npm run android

Or:

take a look at this

How to modify IP & port use react-native Android?

endlessCode
  • 1,255
  • 4
  • 21
  • 36