@@ -3,7 +3,7 @@ import React, {useCallback, useEffect, useMemo} from 'react';
33// We use Animated for all functionality related to wide RHP to make it easier
44// to interact with react-navigation components (e.g., CardContainer, interpolator), which also use Animated.
55// eslint-disable-next-line no-restricted-imports
6- import { Animated , ScrollView , View } from 'react-native' ;
6+ import { Animated , InteractionManager , ScrollView , View } from 'react-native' ;
77import type { LayoutChangeEvent } from 'react-native' ;
88import type { OnyxEntry } from 'react-native-onyx' ;
99import CollapsibleHeaderOnKeyboard from '@components/CollapsibleHeaderOnKeyboard' ;
@@ -61,7 +61,7 @@ type MoneyRequestReportViewProps = {
6161 onLayout ?: ( event : LayoutChangeEvent ) => void ;
6262} ;
6363
64- function goBackFromSearchMoneyRequest ( options ?: { afterTransition ?: ( ) => void } ) {
64+ function goBackFromSearchMoneyRequest ( ) {
6565 const rootState = navigationRef . getRootState ( ) ;
6666 const lastRoute = rootState . routes . at ( - 1 ) ;
6767
@@ -71,7 +71,7 @@ function goBackFromSearchMoneyRequest(options?: {afterTransition?: () => void})
7171 }
7272
7373 if ( lastRoute ?. name === NAVIGATORS . RIGHT_MODAL_NAVIGATOR ) {
74- Navigation . goBack ( undefined , options ) ;
74+ Navigation . goBack ( ) ;
7575 return ;
7676 }
7777
@@ -81,11 +81,11 @@ function goBackFromSearchMoneyRequest(options?: {afterTransition?: () => void})
8181 }
8282
8383 if ( rootState . routes . length > 1 ) {
84- Navigation . goBack ( undefined , options ) ;
84+ Navigation . goBack ( ) ;
8585 return ;
8686 }
8787
88- Navigation . goBack ( ROUTES . SEARCH_ROOT . getRoute ( { query : buildCannedSearchQuery ( ) } ) , options ) ;
88+ Navigation . goBack ( ROUTES . SEARCH_ROOT . getRoute ( { query : buildCannedSearchQuery ( ) } ) ) ;
8989}
9090
9191function InitialLoadingSkeleton ( { styles, onLayout, reasonAttributes} : { styles : ThemeStyles ; onLayout ?: ( event : LayoutChangeEvent ) => void ; reasonAttributes : SkeletonSpanReasonAttributes } ) {
@@ -144,7 +144,8 @@ function MoneyRequestReportView({report, reportLoadingState, shouldDisplayReport
144144
145145 const isLoadingInitialReportActions = reportLoadingState ?. isLoadingInitialReportActions ;
146146 const dismissReportCreationError = useCallback ( ( ) => {
147- goBackFromSearchMoneyRequest ( { afterTransition : ( ) => removeFailedReport ( reportID ) } ) ;
147+ goBackFromSearchMoneyRequest ( ) ;
148+ InteractionManager . runAfterInteractions ( ( ) => removeFailedReport ( reportID ) ) ;
148149 } , [ reportID ] ) ;
149150
150151 // Special case handling a report that is a transaction thread
0 commit comments