Skip to content

Commit

Permalink
Merge pull request #48428 from struc/main
Browse files Browse the repository at this point in the history
Fix: iOS chat view to be hidden if the user clicks away/navigate to two screens or more.
  • Loading branch information
roryabraham authored Sep 2, 2024
2 parents f0c1725 + 56d9936 commit 7b4d98a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {useIsFocused, useRoute} from '@react-navigation/native';
import type {RouteProp} from '@react-navigation/native';
import type {DebouncedFunc} from 'lodash';
import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {DeviceEventEmitter, InteractionManager} from 'react-native';
import {DeviceEventEmitter, InteractionManager, View} from 'react-native';
import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
import InvertedFlatList from '@components/InvertedFlatList';
import {AUTOSCROLL_TO_TOP_THRESHOLD} from '@components/InvertedFlatList/BaseInvertedFlatList';
import {usePersonalDetails} from '@components/OnyxProvider';
Expand Down Expand Up @@ -164,7 +163,6 @@ function ReportActionsList({

const {isOffline} = useNetwork();
const route = useRoute<RouteProp<AuthScreensParamList, typeof SCREENS.REPORT>>();
const opacity = useSharedValue(0);
const reportScrollManager = useReportScrollManager();
const userActiveSince = useRef<string>(DateUtils.getDBTime());
const lastMessageTime = useRef<string | null>(null);
Expand Down Expand Up @@ -300,14 +298,6 @@ function ReportActionsList({
const isLastPendingActionIsDelete = sortedReportActions?.[0]?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;

const [isFloatingMessageCounterVisible, setIsFloatingMessageCounterVisible] = useState(false);
const animatedStyles = useAnimatedStyle(() => ({
opacity: opacity.value,
}));

useEffect(() => {
// eslint-disable-next-line react-compiler/react-compiler
opacity.value = withTiming(1, {duration: 100});
}, [opacity]);

useEffect(() => {
if (
Expand Down Expand Up @@ -652,7 +642,7 @@ function ReportActionsList({
isActive={(isFloatingMessageCounterVisible && !!unreadMarkerReportActionID) || canScrollToNewerComments}
onClick={scrollToBottomAndMarkReportAsRead}
/>
<Animated.View style={[animatedStyles, styles.flex1, !shouldShowReportRecipientLocalTime && !hideComposer ? styles.pb4 : {}]}>
<View style={[styles.flex1, !shouldShowReportRecipientLocalTime && !hideComposer ? styles.pb4 : {}]}>
<InvertedFlatList
accessibilityLabel={translate('sidebarScreen.listOfChatMessages')}
ref={reportScrollManager.ref}
Expand All @@ -678,7 +668,7 @@ function ReportActionsList({
key={listID}
shouldEnableAutoScrollToTopThreshold={shouldEnableAutoScrollToTopThreshold}
/>
</Animated.View>
</View>
</>
);
}
Expand Down

0 comments on commit 7b4d98a

Please sign in to comment.