From d53c2f19ce9b5c6ce4aaaf72f81b7c611f8f1af0 Mon Sep 17 00:00:00 2001 From: Mahesh Vagicherla Date: Wed, 6 Sep 2023 19:45:28 +0530 Subject: [PATCH 1/2] fix transition for task assignee/share modals --- src/pages/tasks/TaskAssigneeSelectorModal.js | 13 +++++++++++-- .../tasks/TaskShareDestinationSelectorModal.js | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 10cb27196efd..a51fd08f4d57 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,12 @@ 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..4474a4fb2a2e 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,12 @@ function TaskShareDestinationSelectorModal(props) { const sections = getSections(); return ( - + { + optionRef.current && optionRef.current.textInput.focus(); + }} + > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <> From 8c113ff310da809fb7f7bbc82460227f0a7d3330 Mon Sep 17 00:00:00 2001 From: Mahesh Vagicherla Date: Thu, 7 Sep 2023 00:56:08 +0530 Subject: [PATCH 2/2] fix lint error --- src/pages/tasks/TaskAssigneeSelectorModal.js | 4 +--- src/pages/tasks/TaskShareDestinationSelectorModal.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index a51fd08f4d57..cca04d745c97 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -193,9 +193,7 @@ function TaskAssigneeSelectorModal(props) { return ( { - optionRef.current && optionRef.current.textInput.focus(); - }} + onEntryTransitionEnd={() => optionRef.current && optionRef.current.textInput.focus()} > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <> diff --git a/src/pages/tasks/TaskShareDestinationSelectorModal.js b/src/pages/tasks/TaskShareDestinationSelectorModal.js index 4474a4fb2a2e..125042fdbf5c 100644 --- a/src/pages/tasks/TaskShareDestinationSelectorModal.js +++ b/src/pages/tasks/TaskShareDestinationSelectorModal.js @@ -111,9 +111,7 @@ function TaskShareDestinationSelectorModal(props) { return ( { - optionRef.current && optionRef.current.textInput.focus(); - }} + onEntryTransitionEnd={() => optionRef.current && optionRef.current.textInput.focus()} > {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <>