Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reload a React Native app on an Android device manually via command line

I'd like to manually force a Reload of my React Native app on demand without physically shaking the device. (I'm getting carpal tunnel.)

I know that Live Reload / Hot Reload are available. I'm looking for a on-demand command line solution.

like image 414
brettlaforge Avatar asked May 25 '17 01:05

brettlaforge


People also ask

Which command is used to reload output on a React Native app in Android simulator?

For Android emulator press "CTRL + M" with keyboard on emulator for reloading the react native project.

How do you refresh the React Native app?

Setup Pull to RefreshPull to Refresh functionality is implemented using RefreshControl component in React Native. RefreshControl is used inside a ScrollView or ListView to add pull to refresh functionality. When the ScrollView is at scrollY: 0 , swiping down triggers an onRefresh event.


2 Answers

Using the cmd line you can send a command to the Android device.

adb shell input text "RR" 

This command tells the Android device to type the character "R" twice which is the React Native command to Reload on Android.

The adb shell command has many useful features many of which are described here:

ADB Shell Input Events

To open the developer menu:

adb shell input keyevent 82 
like image 122
brettlaforge Avatar answered Sep 30 '22 08:09

brettlaforge


Just posting it here in case you didn't know this trick

long press the menu button in your android device. Then you'll get this menu

tap the reload option and you are good to go

like image 37
vighnesh s Avatar answered Sep 30 '22 09:09

vighnesh s