diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 017359b34173..675b0f0572a9 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -2,7 +2,7 @@ import _ from 'underscore'; import lodashGet from 'lodash/get'; import React, {Component} from 'react'; import PropTypes from 'prop-types'; -import {View} from 'react-native'; +import {View, InteractionManager} from 'react-native'; import Button from '../Button'; import FixedFooter from '../FixedFooter'; import OptionsList from '../OptionsList'; @@ -125,6 +125,14 @@ class BaseOptionsSelector extends Component { } componentDidUpdate(prevProps) { + if (this.textInput && this.props.autoFocus && !prevProps.isFocused && this.props.isFocused) { + InteractionManager.runAfterInteractions(() => { + // If we automatically focus on a text input when mounting a component, + // let's automatically focus on it when the component updates as well (eg, when navigating back from a page) + this.textInput.focus(); + }); + } + if (_.isEqual(this.props.sections, prevProps.sections)) { return; }