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

后端 未结 5 658
花落未央
花落未央 2020-12-16 08:27

I used the react-native Android demo project AwesomeProject and within the project I executed:

react-native start

In a second terminal:

5条回答
  •  半阙折子戏
    2020-12-16 09:12

    As stated in https://facebook.github.io/react-native/docs/debugging.html#accessing-the-in-app-developer-menu,

    You can access the developer menu by shaking your device or by selecting "Shake Gesture" inside the Hardware menu in the iOS Simulator. You can also use the ⌘D keyboard shortcut when your app is running in the iOS Simulator, or ⌘M when running in an Android emulator. Alternatively for Android, you can run the command adb shell input keyevent 82 to open the dev menu (82 being the Menu key code).

    So on iOS device shake it, on iOS emulator press control D, on Android emulator control M, on Android device do adb shell input keyevent 82

    Then in the menu that opens, go to Dev Settings, debug server & host port for device, and edit the IP and port.

    ps: will only work for non production

提交回复
热议问题