Automatically set a debug server host & port for device in react-native apps
Asked Answered
U

2

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

Urson answered 12/6, 2019 at 13:58 Comment(0)
H
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 
Horsetail answered 14/3, 2021 at 10:44 Comment(0)
L
-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?

Lunseth answered 25/6, 2019 at 14:54 Comment(1)
this doesnt work error: unknown option ``--host'`Isadoraisadore

© 2022 - 2024 — McMap. All rights reserved.