Skip to content

Commit

Permalink
Check if ref not null
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejSWM committed Sep 15, 2023
1 parent 90b96de commit 4c478d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BaseOptionsSelector extends Component {
componentDidMount() {
this.subscribeToKeyboardShortcut();

if (this.props.isFocused && this.props.autoFocus) {
if (this.props.isFocused && this.props.autoFocus && this.textInput) {
setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);
Expand All @@ -89,7 +89,7 @@ class BaseOptionsSelector extends Component {
// Screen coming back into focus, for example
// when doing Cmd+Shift+K, then Cmd+K, then Cmd+Shift+K.
// Only applies to platforms that support keyboard shortcuts
if ([CONST.PLATFORM.DESKTOP, CONST.PLATFORM.WEB].includes(getPlatform()) && !prevProps.isFocused && this.props.isFocused && this.props.autoFocus) {
if ([CONST.PLATFORM.DESKTOP, CONST.PLATFORM.WEB].includes(getPlatform()) && !prevProps.isFocused && this.props.isFocused && this.props.autoFocus && this.textInput) {
setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);
Expand Down

0 comments on commit 4c478d3

Please sign in to comment.