When I make changes and save them, the app in my emulator is not being refreshed; the emulator is not connected to the metro server I think.
I tried to clear cache by running expo -r -c
, but this didn't do any thing.
Did you try to enable the fast refreshing? I was having the same issue, but after I enable the "Fast Refresh" the auto refreshing started working again. To enable the fast refresh you just have to shake your smartphone and tap on "Enable Fast Refresh".
[Update 2022]
How wierd it sounds sometimes even with above or other solutions like I provided here at beginning that do not always works, sometimes expo seems just stack. A way that seems works, is to change connection type or just connection(from a wifi to another )
Initial answer:
Hope this would help others avoid waist time.
If the above solution won't work(Shake or refresh the entire Expo server) another 2 alternative are :
First option:
While being in the project directory where server is running Press:
r
│ --> it will reload the app
2 Option: Go to your device Settings find Expo Go and force stop or clean cache then reopen it. Unfortunately I noticed this not enough, start as well your metro server.
iOS Simulator: Hit Ctrl-Cmd-Z on a Mac in the emulator to simulate the shake gesture, or press Cmd+D. Then enable fast refresh in the menu
Android Emulator: Hit Cmd+M, then enable fast refresh in the menu.
That would do the trick
did you try to rerun npm? npm add expo .
and then run it as npm start .
If you have recently updated Expo versions, you may need to update OR remove the overrides
and resolutions
part of your package.json
that define what version of Metro it uses.
You can see what version you need by checking the dependencies in the package-lock.json
. I found mine under: "node_modules/@react-native-community/cli-plugin-metro"
In my case, I had to switch from:
"overrides": {
"metro": "0.76.0",
"metro-resolver": "0.76.0"
},
"resolutions": {
"metro": "0.76.0",
"metro-resolver": "0.76.0"
}
Over to:
"overrides": {
"metro": "0.76.7",
"metro-resolver": "0.76.7"
},
"resolutions": {
"metro": "0.76.7",
"metro-resolver": "0.76.7"
}
Expo automatically uses the Metro version installed by npx expo install
when you run npx expo start
. Removing the override and resolution is probably the right fix for many cases because of this.
run npm start / expo start open the project on your emulator once the JavaScript bundling is complete and metro is ready.
if you are using and iOS emulator click on i if android click a
for windows use CTRL + M and on mac use command + M.
Select "enable auto refresh" on the avd or ios emulator. On that same option-menu select "stop remote debugging".
close any react native debugging mode on your browser tab
reload your emulator and resave your project, that should work
Something else that might cause this: if you use a VPN, the app might still work in Expo Go, but fast refresh won't.
So switch off your VPN and refresh the app in Expo Go manually. Fast refresh might work again (it did for me).
Enable auto save if you are working von VS Code. It worked with me. 1- click on (file) at the top. 2- Click on (Auto Save).
npm add expo .
and then run it asnpm start .