diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 10cb27196efd..cca04d745c97 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -1,5 +1,5 @@ /* eslint-disable es/no-optional-chaining */ -import React, {useState, useEffect, useMemo, useCallback} from 'react'; +import React, {useState, useEffect, useMemo, useCallback, useRef} from 'react'; import {View} from 'react-native'; import lodashGet from 'lodash/get'; import _ from 'underscore'; @@ -78,6 +78,8 @@ function TaskAssigneeSelectorModal(props) { const [filteredCurrentUserOption, setFilteredCurrentUserOption] = useState(null); const [isLoading, setIsLoading] = React.useState(true); + const optionRef = useRef(); + const updateOptions = useCallback(() => { const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getNewChatOptions( props.reports, @@ -189,7 +191,10 @@ function TaskAssigneeSelectorModal(props) { }; return ( - + optionRef.current && optionRef.current.textInput.focus()} + > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <> diff --git a/src/pages/tasks/TaskShareDestinationSelectorModal.js b/src/pages/tasks/TaskShareDestinationSelectorModal.js index 15e3f03964e6..125042fdbf5c 100644 --- a/src/pages/tasks/TaskShareDestinationSelectorModal.js +++ b/src/pages/tasks/TaskShareDestinationSelectorModal.js @@ -1,5 +1,5 @@ /* eslint-disable es/no-optional-chaining */ -import React, {useState, useEffect, useMemo, useCallback} from 'react'; +import React, {useState, useEffect, useMemo, useCallback, useRef} from 'react'; import _ from 'underscore'; import {View} from 'react-native'; import PropTypes from 'prop-types'; @@ -46,6 +46,8 @@ function TaskShareDestinationSelectorModal(props) { const [headerMessage, setHeaderMessage] = useState(''); const [filteredRecentReports, setFilteredRecentReports] = useState([]); + const optionRef = useRef(); + const filteredReports = useMemo(() => { const reports = {}; _.keys(props.reports).forEach((reportKey) => { @@ -107,7 +109,10 @@ function TaskShareDestinationSelectorModal(props) { const sections = getSections(); return ( - + optionRef.current && optionRef.current.textInput.focus()} + > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <>