Skip to content

Commit

Permalink
fix: leave auto focus logic to input component
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Aug 15, 2023
1 parent 53323f0 commit b0d81a4
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,6 @@ class BaseOptionsSelector extends Component {
);

this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false);

if (!this.props.autoFocus) {
return;
}

if (this.props.shouldShowTextInput) {
if (this.props.shouldDelayFocus) {
this.focusTimeout = setTimeout(() => this.textInput.focus(), CONST.ANIMATED_TRANSITION);
} else {
this.textInput.focus();
}
}
}

componentDidUpdate(prevProps) {
Expand Down Expand Up @@ -339,6 +327,8 @@ class BaseOptionsSelector extends Component {
selectTextOnFocus
blurOnSubmit={Boolean(this.state.allOptions.length)}
spellCheck={false}
autoFocus={this.props.autoFocus}
shouldDelayFocus={this.props.shouldDelayFocus}
/>
);
const optionsList = (
Expand Down

0 comments on commit b0d81a4

Please sign in to comment.