Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"react-web-config": "^1.0.0",
"rn-fetch-blob": "^0.12.0",
"save": "^2.4.0",
"shim-keyboard-event-key": "^1.0.3",
"smoothscroll-polyfill": "^0.4.4",
"underscore": "^1.13.1",
"urbanairship-react-native": "^11.0.2"
Expand Down
7 changes: 4 additions & 3 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const CONST = {
WEB: 'web',
DESKTOP: 'desktop',
},
KEYBOARD_SHORTCUT_MODIFIERS: {
PLATFORM_SPECIFIC_KEYS: {
CTRL: {
DEFAULT: 'control',
[PLATFORM_OS_MACOS]: 'meta',
Expand Down Expand Up @@ -176,8 +176,9 @@ const CONST = {
},
},
KEYBOARD_SHORTCUT_KEY_DISPLAY_NAME: {
CONTROL: 'Ctrl',
META: 'Cmd',
CONTROL: 'CTRL',
ESCAPE: 'ESC',
META: 'CMD',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small question: How come this is called the META key instead of COMMAND?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK

SHIFT: 'Shift',
},
CURRENCY: {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const propTypes = {
/** Call the onPress function when Enter key is pressed */
pressOnEnter: PropTypes.bool,

/** The priority to assign the enter key event listener. 0 is the highest priority. */
enterKeyEventListenerPriority: PropTypes.number,

/** Additional styles to add after local styles. Applied to Pressable portion of button */
style: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.object),
Expand Down Expand Up @@ -92,6 +95,7 @@ const defaultProps = {
onPressIn: () => {},
onPressOut: () => {},
pressOnEnter: false,
enterKeyEventListenerPriority: 0,
style: [],
innerStyles: [],
textStyles: [],
Expand Down Expand Up @@ -124,7 +128,7 @@ class Button extends Component {
return;
}
this.props.onPress();
}, shortcutConfig.descriptionKey, shortcutConfig.modifiers, true);
}, shortcutConfig.descriptionKey, shortcutConfig.modifiers, true, false, this.props.enterKeyEventListenerPriority);
}

componentWillUnmount() {
Expand Down
5 changes: 2 additions & 3 deletions src/components/KeyboardShortcutsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ const defaultProps = {
class KeyboardShortcutsModal extends React.Component {
componentDidMount() {
const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.SHORTCUT_MODAL;
const shortcutModifiers = KeyboardShortcut.getShortcutModifiers(shortcutConfig.modifiers);
this.unsubscribeShortcutModal = KeyboardShortcut.subscribe(shortcutConfig.shortcutKey, () => {
KeyboardShortcutsActions.showKeyboardShortcutModal();
}, shortcutConfig.descriptionKey, shortcutModifiers, true);
}, shortcutConfig.descriptionKey, shortcutConfig.modifiers, true);
}

componentWillUnmount() {
Expand Down Expand Up @@ -73,7 +72,7 @@ class KeyboardShortcutsModal extends React.Component {
}

render() {
const shortcuts = KeyboardShortcut.getKeyboardShortcuts();
const shortcuts = KeyboardShortcut.getDocumentedShortcuts();
const modalType = this.props.isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE;

return (
Expand Down
Loading