11

I'm building a simple React Native app and using the Expo iOS app to run it. But Expo is constantly refreshing my app, making it unusable / untestable. It refreshes every few seconds, sometimes multiple times a second, when I haven't changed anything. The only times when there is enough of a break between refreshes for me to test out the app is when, in my terminal, the app decides to rebuild (Again, nothing changed) and takes a few seconds to rebuild the bundle.

I set up the app using create-react-native-app and run it with npm start -- I've changed nothing else, besides adding a few components.

I've tried quitting my IDE (Sublime) and changing to a stronger wifi network.

I'm developing on macOS Sierra 10.12.2 and running on an iPhone 6S.

Luke Knepper
  • 931
  • 8
  • 18

3 Answers3

32

It turns out this happened because my app's code was stored inside a Dropbox folder. (The same applies to iCloud backups.)

I guess that Dropbox's / iCloud's syncing interferes with watchman or other Expo / React Native internals.

I solved the problem by removing the app's directory from my Dropbox folder.

Luke Knepper
  • 931
  • 8
  • 18
3

For all the people who have this problem on Mac because of iCloud downloading the folder, if you rename a folder to "tmp" then iCloud will skip it.

2

Do you have watchman installed?

The React Native packager ("metro bundler") watches your app directory for changes and reloads the app whenever a file is changed in the directory, oddly this doesn't cause any problems for me when I use Dropbox, though.

brentvatne
  • 7,603
  • 4
  • 38
  • 55
  • I had `watchman` as a local dep and also tried it with and without watchman as a global dep (`npm install -g watchman`). I didn't try installing watchman with brew, though. – Luke Knepper Jul 10 '17 at 23:05
  • It only seems to happen on a Dropbox folder while the files in the RN app folder are actively syncing to Dropbox. If you pause syncing the behavior stops. If you resume syncing the behavior starts again. – Matthew Snyder Dec 20 '18 at 22:43