react-native-navigation的迁移库

1234567891011121314
  1. const exec = require('shell-utils').exec;
  2. const utils = {
  3. pressBack: () => utils.pressKeyCode(4),
  4. pressMenu: () => utils.pressKeyCode(82),
  5. pressKeyCode: (keyCode) => utils.executeShellCommand(`input keyevent ${keyCode}`),
  6. grantPermission: () => utils.executeShellCommand('pm grant com.reactnativenavigation.playground android.permission.READ_PHONE_STATE'),
  7. revokePermission: () => utils.executeShellCommand('pm revoke com.reactnativenavigation.playground android.permission.READ_PHONE_STATE'),
  8. executeShellCommand: (command) => {
  9. exec.execSync(`adb -s ${device.id} shell ${command}`);
  10. },
  11. };
  12. module.exports = utils;