Skip to content

Commit 59cc5f0

Browse files
committed
fix: Chat -Skeleton loading when open start chat page.
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 57f0196 commit 59cc5f0

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/pages/NewChatPage.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {useFocusEffect} from '@react-navigation/native';
12
import isEmpty from 'lodash/isEmpty';
23
import reject from 'lodash/reject';
34
import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
@@ -18,7 +19,6 @@ import useLocalize from '@hooks/useLocalize';
1819
import useNetwork from '@hooks/useNetwork';
1920
import useOnyx from '@hooks/useOnyx';
2021
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
21-
import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus';
2222
import useThemeStyles from '@hooks/useThemeStyles';
2323
import {navigateToAndOpenReport, searchInServer, setGroupDraft} from '@libs/actions/Report';
2424
import {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

Comments
 (0)