@@ -510,24 +510,33 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
510510 ) ;
511511 const deleteNavigateBackUrl = goBackRoute ?? backTo ?? Navigation . getActiveRoute ( ) ;
512512 setDeleteTransactionNavigateBackUrl ( deleteNavigateBackUrl ) ;
513+ // The wide RHP close animation was changed, and because of that the expense was deleted right after
514+ // the animation finished, which caused flickering in the expenses list. We want the user to see
515+ // the expense in the list for a little bit longer, so we wait for the animation to finish and then
516+ // add an additional delay before removing it.
517+ // See https://github.com/Expensify/App/issues/92036
518+ const afterTransition = ( ) => {
519+ setTimeout ( ( ) => {
520+ const deleteResult = deleteTransactions (
521+ [ transaction . transactionID ] ,
522+ duplicateTransactions ,
523+ duplicateTransactionViolations ,
524+ isReportInSearch ? currentSearchHash : undefined ,
525+ false ,
526+ ) ;
527+
528+ if ( deleteResult . action === 'redirected' ) {
529+ return ;
530+ }
531+
532+ removeTransaction ( transaction . transactionID ) ;
533+ } , CONST . EXPENSE_REPORT_DELETE_DELAY_MS ) ;
534+ } ;
513535 if ( goBackRoute ) {
514- navigateOnDeleteExpense ( goBackRoute ) ;
536+ navigateOnDeleteExpense ( goBackRoute , afterTransition ) ;
537+ } else {
538+ afterTransition ( ) ;
515539 }
516- InteractionManager . runAfterInteractions ( ( ) => {
517- const deleteResult = deleteTransactions (
518- [ transaction . transactionID ] ,
519- duplicateTransactions ,
520- duplicateTransactionViolations ,
521- isReportInSearch ? currentSearchHash : undefined ,
522- false ,
523- ) ;
524-
525- if ( deleteResult . action === 'redirected' ) {
526- return ;
527- }
528-
529- removeTransaction ( transaction . transactionID ) ;
530- } ) ;
531540 }
532541 return ;
533542 }
@@ -546,19 +555,27 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
546555 const deleteNavigateBackUrl = backToRoute ?? Navigation . getActiveRoute ( ) ;
547556 setDeleteTransactionNavigateBackUrl ( deleteNavigateBackUrl ) ;
548557
558+ // The wide RHP close animation was changed, and because of that the report was deleted right after
559+ // the animation finished, which caused flickering in the reports list. We want the user to see
560+ // the report in the list for a little bit longer, so we wait for the animation to finish and then
561+ // add an additional delay before removing it.
562+ // See https://github.com/Expensify/App/issues/92036
549563 Navigation . setNavigationActionToMicrotaskQueue ( ( ) => {
550- Navigation . goBack ( backToRoute ) ;
551- InteractionManager . runAfterInteractions ( ( ) => {
552- deleteAppReport ( {
553- report : moneyRequestReport ,
554- selfDMReport,
555- currentUserEmailParam : email ?? '' ,
556- currentUserAccountIDParam : accountID ,
557- reportTransactions,
558- allTransactionViolations,
559- bankAccountList,
560- hash : currentSearchHash ,
561- } ) ;
564+ Navigation . goBack ( backToRoute , {
565+ afterTransition : ( ) => {
566+ setTimeout ( ( ) => {
567+ deleteAppReport ( {
568+ report : moneyRequestReport ,
569+ selfDMReport,
570+ currentUserEmailParam : email ?? '' ,
571+ currentUserAccountIDParam : accountID ,
572+ reportTransactions,
573+ allTransactionViolations,
574+ bankAccountList,
575+ hash : currentSearchHash ,
576+ } ) ;
577+ } , CONST . EXPENSE_REPORT_DELETE_DELAY_MS ) ;
578+ } ,
562579 } ) ;
563580 } ) ;
564581 } ,
0 commit comments