I started using React Native for about 2 weeks, and sometimes I need to reinstall the app, then shake the phone again and enable the live reload.
It's funny at the first week, but then it gets boring to have to shake the phone while developing.
Is there any config file which I can set those development properties to be always enabled?
You can add hot reload function with hold the menu
button in your phone
it show the developer menu setting for react native app
after that you can select the hotreload function
or you can type this on your terminal
adb shell input keyevent 82
There's a closed issue related to open the menu by pressing the screen with 3 fingers. You can check if in the latest versions (or in expo) it is working: https://github.com/facebook/react-native/issues/10191
Also there are other 3 solutions:
1) You can run adb shell input keyevent KEYCODE_MENU
in your terminal
2) Try this: https://github.com/facebook/react-native/issues/10191#issuecomment-328854286
Open RN dev menu
/usr/local/bin/adb shell input keyevent KEYCODE_MENU Reload RN
/usr/local/bin/adb shell input keyevent 82 /usr/local/bin/adb shell input keyevent 66 /usr/local/bin/adb shell input keyevent 66 (reload was not always working without adding the last line)
In Preferences->Keyboard->Keyboard shortcuts you can then map these services to keyboard shortcuts. I added the shortcuts for the context of my editor (Webstorm) and React Native debugger. In these programs I can now press Ctrl+D to show the developer menu and Ctrl+R to reload which works perfectly.
3) Or you can try this (Android only) https://medium.com/delivery-com-engineering/react-native-stop-shaking-your-phone-1f4863140146
Set up an Automator Service by opening Automator, clicking “New Document”, and choosing “Service”.
Find and select the “Run Shell Script” action. Choose “no input” for “Service receives” and enter: /usr/local/bin/adb shell input keyevent 82 If adb is located elsewhere in your system, change the path to adb. You can find out with: $ which adb
Save and remember what name you give the action.
- Open “System Preferences”, go to “Keyboard” and select the “Shortcuts” tab. Select “Services” on the left column and find your service by name.
- Click where it says “none” and enter the keyboard shortcut you want to use. Make it something unique or it will conflict with an existing shortcut.
Notes: Android only Must be plugged in If you’ve never run the following with this device, run it first before trying the shortcut: $ adb reverse tcp:8081 tcp:8081
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With