Skip to content

Commit

Permalink
Merge pull request #9672 from Expensify/Rory-CMDEnter
Browse files Browse the repository at this point in the history
Make CMD+Enter work for single-selection pages

(cherry picked from commit 7c2c5db)
  • Loading branch information
marcaaron authored and OSBotify committed Jul 1, 2022
1 parent b698671 commit e92939f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/components/OptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,17 @@ class OptionsSelector extends Component {
this.unsubscribeCTRLEnter = KeyboardShortcut.subscribe(
CTRLEnterConfig.shortcutKey,
() => {
if (this.props.canSelectMultipleOptions) {
this.props.onConfirmSelection();
return;
}

const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!this.canSelectMultipleOptions && !focusedOption) {
if (!focusedOption) {
return;
}

this.props.onConfirmSelection(focusedOption);
this.selectRow(focusedOption);
},
CTRLEnterConfig.descriptionKey,
CTRLEnterConfig.modifiers,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class NewChatPage extends Component {
shouldFocusOnSelectRow={this.props.isGroupChat}
shouldShowConfirmButton={this.props.isGroupChat}
confirmButtonText={this.props.translate('newChatPage.createGroup')}
onConfirmSelection={this.props.isGroupChat ? this.createGroup : this.createChat}
onConfirmSelection={this.props.isGroupChat ? this.createGroup : () => {}}
/>
)}
</View>
Expand Down

0 comments on commit e92939f

Please sign in to comment.