react-native-navigation的迁移库

1234567891011121314151617181920212223242526
  1. const exec = require('shell-utils').exec;
  2. module.exports = {
  3. pressBack: () => {
  4. exec.execSync('adb shell input keyevent 4');
  5. },
  6. pressMenu: () => {
  7. exec.execSync('adb shell input keyevent 82');
  8. },
  9. pressKeyCode: (keyCode) => {
  10. exec.execSync(`adb shell input keyevent ${keyCode}`);
  11. },
  12. grantPermission: () => {
  13. exec.execSync('adb shell pm grant com.reactnativenavigation.playground android.permission.READ_PHONE_STATE');
  14. },
  15. revokePermission: () => {
  16. exec.execSync('adb shell pm revoke com.reactnativenavigation.playground android.permission.READ_PHONE_STATE');
  17. },
  18. openActivity: () => {
  19. exec.execSync('adb shell am start -n com.reactnativenavigation.playground/.MainActivity');
  20. },
  21. executeShellCommand: (command) => {
  22. exec.execSync(`adb shell ${command}`);
  23. }
  24. };