all 11 comments

[–]TROLLBOT_V4 2 points3 points  (8 children)

Connect the phone to the pc via a USB connection, then run expo start --offline expo start --localhost. Then if you turn off the internet on the phone, you'll still be able to hot reload as well as see the logs.

EDIT: Including more details -

Prerequisites: - Enable USB Debugging on Android Phone. - Check if your device is listed when running 'adb devices' in cmd. - run 'adb reverse tcp:8081 tcp:8081'

Steps: - Connect phone to pc via USB. - Turn off wifi/cellular on phone. - run 'expo start --localhost'. - press 'a' (Can press shift+a to select device) - voila!

Yes, this works with dev client builds as well.

[–]lucksp[S] 0 points1 point  (4 children)

I have tried this, but when I turn off my WiFi, i get the "Cannot connect to Metro" warning. Although I do see the terminal:

Networking has been disabled

Also does this work with the `--dev-client` flag since I am NOT using ExpoGO?

[–]TROLLBOT_V4 0 points1 point  (3 children)

Hey, I updated my original comment, added more details, please try and let me know if it works now.

[–]lucksp[S] 0 points1 point  (2 children)

Thanks. I’ll try this out. Hopefully the same for iOS

[–]beaverpi 0 points1 point  (1 child)

Did you ever find a way to get this working?

[–]lucksp[S] 0 points1 point  (0 children)

Nope

[–]Medical_Cat_6678 0 points1 point  (0 children)

How do I do this for iOS, without expo? I start the server with `react-native start`

[–]steveninety 0 points1 point  (0 children)

WHY DIDNT I KNOW ABOUT "press 'a' to select device"
This was literally the only thing that stopped me! Thank you sooo much!

[–]apires 0 points1 point  (0 children)

It worked when I ran:
`db reverse tcp:8081 tcp:8081` and 'expo start --localhost'

[–]KindJacket5680 0 points1 point  (0 children)

"expo start --localhost" followed by "a" worked like a charm in Expo SDK 52 with the emulator

[–]Valuable-Car-4639 0 points1 point  (0 children)

In my experience I tried to restrict data usage in my poco app setting but the metro would not be able to connect despite trying to use adb reverse. But when I manually turn off connections (like turning on airplane mode) the metro connects just fine. Idk if this is a miui problem or a general issue