29

Is it possible to have a react native app to automatically reload in the emulator once I edit the sources and the thing recompiles itself?

lhahne
  • 5,909
  • 9
  • 33
  • 40
  • http://stackoverflow.com/questions/36933287/how-to-enable-live-reload-in-react-native-on-android/42571633#42571633 – itzmebibin Mar 14 '17 at 16:45

5 Answers5

66

If you've created your project with react-native init, then on the simulator, press cmd+ctrl+Z or Hardware > Shake Gesture and the Dev Menu will popup.

Just press Enable Live Reload and Done! :D

EDIT : React Native team does now encourage to user Hot Reloading instead of Live Reload. More info about the difference between those two features here.

Alexandre Bourlier
  • 3,972
  • 4
  • 44
  • 76
tadeuzagallo
  • 2,422
  • 1
  • 18
  • 9
3

You can use hot-reload in the settings for your react native app to automatically reload. you can enable hot-reloading click the "Menu" button on the sidebar inside genymotion.

Janaka Pushpakumara
  • 4,769
  • 5
  • 29
  • 34
2

Hot Module Reloading (HMR) shipped with RN 0.22 a few days ago, which lets the simulator automatically reload a single screen or other module without reloading the entire app. It's enabled via the same CMD+D / CMD+CTRL+Z / Shake Gesture menu.

Lane Rettig
  • 6,640
  • 5
  • 42
  • 51
1

This is a huge workaround – but it is saving a lot of time and avoiding the frustration of not shaking correctly.

Also it covers the edge case of complete reloading the bundle, not only for live reloading or hot replacement.

We just throw new Error('Want to refresh?') to prompt the error screen while in development, so we can hit RELOAD on the bottom.

Beware of the dragons. This is not the most usual move.

jsdario
  • 6,477
  • 7
  • 41
  • 75
0

use this command from the shell

adb shell input keyevent 82

to get dev menu on android real device.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241