Skip to content
Merged
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
7 changes: 5 additions & 2 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import OptionsList from '../OptionsList';
import CONST from '../../CONST';
import styles from '../../styles/styles';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import withNavigationFocus, {withNavigationFocusPropTypes} from '../withNavigationFocus';
import TextInput from '../TextInput';
import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
import KeyboardShortcut from '../../libs/KeyboardShortcut';
import {propTypes as optionsSelectorPropTypes, defaultProps as optionsSelectorDefaultProps} from './optionsSelectorPropTypes';
import setSelection from '../../libs/setSelection';
import compose from '../../libs/compose';

const propTypes = {
/** Whether we should wait before focusing the TextInput, useful when using transitions on Android */
Expand All @@ -24,6 +26,7 @@ const propTypes = {

...optionsSelectorPropTypes,
...withLocalizePropTypes,
...withNavigationFocusPropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -57,7 +60,7 @@ class BaseOptionsSelector extends Component {
enterConfig.shortcutKey,
() => {
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption) {
if (!focusedOption || !this.props.isFocused) {
return;
}
if (this.props.canSelectMultipleOptions) {
Expand Down Expand Up @@ -375,4 +378,4 @@ class BaseOptionsSelector extends Component {
BaseOptionsSelector.defaultProps = defaultProps;
BaseOptionsSelector.propTypes = propTypes;

export default withLocalize(BaseOptionsSelector);
export default compose(withLocalize, withNavigationFocus)(BaseOptionsSelector);