Skip to content

Commit b5f5f9c

Browse files
authored
Merge pull request #78258 from software-mansion-labs/fix-wide-rhp-infinite-loading
[CP Staging] Expense - Review duplicates RHP loads infinitely after deleting expense
2 parents 6e1702d + b24e845 commit b5f5f9c

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) {
341341
<Stack.Screen
342342
name={SCREENS.RIGHT_MODAL.SEARCH_REPORT}
343343
getComponent={loadReportScreen}
344-
options={{...modalStackScreenOptions, animation: Animations.NONE}}
344+
options={(props) => {
345+
const options = modalStackScreenOptions(props);
346+
return {...options, animation: Animations.NONE};
347+
}}
345348
/>
346349
<Stack.Screen
347350
name={SCREENS.RIGHT_MODAL.RESTRICTED_ACTION}

src/pages/home/ReportScreen.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {PortalHost} from '@gorhom/portal';
22
import {useIsFocused} from '@react-navigation/native';
33
import {accountIDSelector} from '@selectors/Session';
44
import {deepEqual} from 'fast-equals';
5-
import React, {memo, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
5+
import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react';
66
import type {FlatList, ViewStyle} from 'react-native';
77
// We use Animated for all functionality related to wide RHP to make it easier
88
// to interact with react-navigation components (e.g., CardContainer, interpolator), which also use Animated.
@@ -20,7 +20,6 @@ import MoneyRequestReceiptView from '@components/ReportActionItem/MoneyRequestRe
2020
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
2121
import ScreenWrapper from '@components/ScreenWrapper';
2222
import ScrollView from '@components/ScrollView';
23-
import {WideRHPContext} from '@components/WideRHPContextProvider';
2423
import useShowWideRHPVersion from '@components/WideRHPContextProvider/useShowWideRHPVersion';
2524
import WideRHPOverlayWrapper from '@components/WideRHPOverlayWrapper';
2625
import useAppFocusEvent from '@hooks/useAppFocusEvent';
@@ -174,9 +173,6 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
174173
const {isOffline} = useNetwork();
175174
const {shouldUseNarrowLayout, isInNarrowPaneModal} = useResponsiveLayout();
176175

177-
const {wideRHPRouteKeys, superWideRHPRouteKeys} = useContext(WideRHPContext);
178-
const isDisplayedInWidePaneModal = wideRHPRouteKeys.includes(route.key) || superWideRHPRouteKeys.includes(route.key);
179-
const isWideRHPOpened = wideRHPRouteKeys.length > 0 || superWideRHPRouteKeys.length > 0;
180176
const currentReportIDValue = useCurrentReportID();
181177

182178
const [isComposerFullSize = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportIDFromRoute}`, {canBeMissing: true});
@@ -388,8 +384,7 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
388384
closeSidePanel();
389385
return;
390386
}
391-
392-
if (backTo === SCREENS.RIGHT_MODAL.SEARCH_REPORT || isDisplayedInWidePaneModal || isWideRHPOpened) {
387+
if (backTo === SCREENS.RIGHT_MODAL.SEARCH_REPORT) {
393388
Navigation.goBack();
394389
return;
395390
}
@@ -411,7 +406,7 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
411406
}
412407
Navigation.goBack();
413408
},
414-
[isInSidePanel, backTo, isDisplayedInWidePaneModal, isWideRHPOpened, isInNarrowPaneModal, closeSidePanel],
409+
[isInSidePanel, backTo, isInNarrowPaneModal, closeSidePanel],
415410
);
416411

417412
let headerView = (

0 commit comments

Comments
 (0)