From a7728d4510d05a0edb36e1f3830191ef365332c5 Mon Sep 17 00:00:00 2001 From: Mahesh Date: Tue, 12 Sep 2023 13:32:58 +0530 Subject: [PATCH 1/2] fix transition for task assignee modals --- src/pages/tasks/TaskAssigneeSelectorModal.js | 11 +++++++++-- src/pages/tasks/TaskShareDestinationSelectorModal.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index f8f567a7b913..9044edd6e67a 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, @@ -195,7 +197,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..447feb58f94f 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}) => ( <> From eb49e9208d5a0f93c06510fa7443fdd555b1e10c Mon Sep 17 00:00:00 2001 From: Mahesh Date: Tue, 12 Sep 2023 13:57:30 +0530 Subject: [PATCH 2/2] fix lint --- src/pages/tasks/TaskShareDestinationSelectorModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/tasks/TaskShareDestinationSelectorModal.js b/src/pages/tasks/TaskShareDestinationSelectorModal.js index 447feb58f94f..82a3ac5a45ec 100644 --- a/src/pages/tasks/TaskShareDestinationSelectorModal.js +++ b/src/pages/tasks/TaskShareDestinationSelectorModal.js @@ -46,7 +46,7 @@ function TaskShareDestinationSelectorModal(props) { const [headerMessage, setHeaderMessage] = useState(''); const [filteredRecentReports, setFilteredRecentReports] = useState([]); - const optionRef = useRef() + const optionRef = useRef(); const filteredReports = useMemo(() => { const reports = {};