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' ;
@@ -19,7 +20,6 @@ import useLocalize from '@hooks/useLocalize';
1920import useNetwork from '@hooks/useNetwork' ;
2021import useOnyx from '@hooks/useOnyx' ;
2122import useSafeAreaInsets from '@hooks/useSafeAreaInsets' ;
22- import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus' ;
2323import useThemeStyles from '@hooks/useThemeStyles' ;
2424import { navigateToAndOpenReport , searchInServer , setGroupDraft } from '@libs/actions/Report' ;
2525import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
@@ -60,7 +60,8 @@ function useOptions() {
6060 const [ betas ] = useOnyx ( ONYXKEYS . BETAS , { canBeMissing : true } ) ;
6161 const [ newGroupDraft ] = useOnyx ( ONYXKEYS . NEW_GROUP_CHAT_DRAFT , { canBeMissing : true } ) ;
6262 const personalData = useCurrentUserPersonalDetails ( ) ;
63- const { didScreenTransitionEnd} = useScreenWrapperTransitionStatus ( ) ;
63+ const focusTimeoutRef = useRef < NodeJS . Timeout | null > ( null ) ;
64+ const [ didScreenTransitionEnd , setDidScreenTransitionEnd ] = useState ( false ) ;
6465 const { contacts} = useContactImport ( ) ;
6566 const { options : listOptions , areOptionsInitialized} = useOptionsList ( {
6667 shouldInitialize : didScreenTransitionEnd ,
@@ -100,6 +101,16 @@ function useOptions() {
100101 ) ;
101102 } , [ cleanSearchTerm , debouncedSearchTerm , options . personalDetails . length , options . recentReports . length , options . userToInvite , selectedOptions ] ) ;
102103
104+ useFocusEffect (
105+ useCallback ( ( ) => {
106+ focusTimeoutRef . current = setTimeout ( ( ) => {
107+ setDidScreenTransitionEnd ( true ) ;
108+ } , CONST . ANIMATED_TRANSITION ) ;
109+
110+ return ( ) => focusTimeoutRef . current && clearTimeout ( focusTimeoutRef . current ) ;
111+ } , [ ] ) ,
112+ ) ;
113+
103114 useEffect ( ( ) => {
104115 if ( ! debouncedSearchTerm . length ) {
105116 return ;
0 commit comments