1+ import { useFocusEffect } from '@react-navigation/native' ;
12import isEmpty from 'lodash/isEmpty' ;
23import reject from 'lodash/reject' ;
34import React , { forwardRef , useCallback , useEffect , useImperativeHandle , useMemo , useRef , useState } from 'react' ;
@@ -18,7 +19,6 @@ import useLocalize from '@hooks/useLocalize';
1819import useNetwork from '@hooks/useNetwork' ;
1920import useOnyx from '@hooks/useOnyx' ;
2021import useSafeAreaInsets from '@hooks/useSafeAreaInsets' ;
21- import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus' ;
2222import useThemeStyles from '@hooks/useThemeStyles' ;
2323import { navigateToAndOpenReport , searchInServer , setGroupDraft } from '@libs/actions/Report' ;
2424import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
@@ -55,7 +55,9 @@ function useOptions() {
5555 const [ betas ] = useOnyx ( ONYXKEYS . BETAS , { canBeMissing : true } ) ;
5656 const [ newGroupDraft ] = useOnyx ( ONYXKEYS . NEW_GROUP_CHAT_DRAFT , { canBeMissing : true } ) ;
5757 const personalData = useCurrentUserPersonalDetails ( ) ;
58- const { didScreenTransitionEnd} = useScreenWrapperTransitionStatus ( ) ;
58+ const focusTimeoutRef = useRef < NodeJS . Timeout | null > ( null ) ;
59+ const [ didScreenTransitionEnd , setDidScreenTransitionEnd ] = useState ( false ) ;
60+
5961 const { options : listOptions , areOptionsInitialized} = useOptionsList ( {
6062 shouldInitialize : didScreenTransitionEnd ,
6163 } ) ;
@@ -93,6 +95,16 @@ function useOptions() {
9395 ) ;
9496 } , [ cleanSearchTerm , debouncedSearchTerm , options . personalDetails . length , options . recentReports . length , options . userToInvite , selectedOptions ] ) ;
9597
98+ useFocusEffect (
99+ useCallback ( ( ) => {
100+ focusTimeoutRef . current = setTimeout ( ( ) => {
101+ setDidScreenTransitionEnd ( true ) ;
102+ } , CONST . ANIMATED_TRANSITION ) ;
103+
104+ return ( ) => focusTimeoutRef . current && clearTimeout ( focusTimeoutRef . current ) ;
105+ } , [ ] ) ,
106+ ) ;
107+
96108 useEffect ( ( ) => {
97109 if ( ! debouncedSearchTerm . length ) {
98110 return ;
0 commit comments