Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to automatically reload the app in react native?

Tags:

react-native

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?

like image 338
lhahne Avatar asked Mar 27 '15 19:03

lhahne


People also ask

How do I automatically refresh apps in react-native?

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.

How do I reload the whole app in react-native?

UPDATE: From 0.62, React Native have added DevSettings. reload() . So, if you want to reload programmatically while developing you can use that.

How do I auto refresh in react?

If set to true, the browser will do a complete page refresh from the server and not from the cached version of the page. import React from 'react'; function App() { function refreshPage() { window. location. reload(false); } return ( <div> <button onClick={refreshPage}>Click to reload!

How does Hot reloading work in react-native?

Hot reloading allows you to see the changes that you have made in the code without reloading your entire app. Whenever you make any changes, all you need to do is save your code. As soon as you save your code, React Native tracks which files have changed since your last saved, and only reload those file for you.


2 Answers

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.

like image 134
tadeuzagallo Avatar answered Oct 10 '22 14:10

tadeuzagallo


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.

like image 41
Janaka Pushpakumara Avatar answered Oct 10 '22 13:10

Janaka Pushpakumara