@@ -11,6 +11,7 @@ import type {ListItem, SectionListDataType, SelectionListHandle} from '@componen
11
11
import useLocalize from '@hooks/useLocalize' ;
12
12
import useThemeStyles from '@hooks/useThemeStyles' ;
13
13
import interceptAnonymousUser from '@libs/interceptAnonymousUser' ;
14
+ import type { AddUnreportedExpensesParamList } from '@libs/Navigation/types' ;
14
15
import Navigation from '@navigation/Navigation' ;
15
16
import type { PlatformStackScreenProps } from '@navigation/PlatformStackNavigation/types' ;
16
17
import { startMoneyRequest } from '@userActions/IOU' ;
@@ -24,12 +25,6 @@ import UnreportedExpenseListItem from './UnreportedExpenseListItem';
24
25
25
26
type AddUnreportedExpensePageType = PlatformStackScreenProps < AddUnreportedExpensesParamList , typeof SCREENS . ADD_UNREPORTED_EXPENSES_ROOT > ;
26
27
27
- type AddUnreportedExpensesParamList = {
28
- [ SCREENS . ADD_UNREPORTED_EXPENSES_ROOT ] : {
29
- reportID : string ;
30
- } ;
31
- } ;
32
-
33
28
function AddUnreportedExpense ( { route} : AddUnreportedExpensePageType ) {
34
29
const { translate} = useLocalize ( ) ;
35
30
const [ errorMessage , setErrorMessage ] = useState < string > ( '' ) ;
@@ -58,7 +53,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) {
58
53
59
54
const thereIsNoUnreportedTransaction = ! ( ( sections . at ( 0 ) ?. data . length ?? 0 ) > 0 ) ;
60
55
61
- const reportID = route . params . reportID ;
56
+ const { reportID, backToReport } = route . params ;
62
57
const selectedIds = new Set < string > ( ) ;
63
58
const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` , { canBeMissing : true } ) ;
64
59
return (
@@ -91,7 +86,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) {
91
86
buttonText : translate ( 'iou.createExpense' ) ,
92
87
buttonAction : ( ) => {
93
88
interceptAnonymousUser ( ( ) => {
94
- startMoneyRequest ( CONST . IOU . TYPE . SUBMIT , reportID ) ;
89
+ startMoneyRequest ( CONST . IOU . TYPE . SUBMIT , reportID , undefined , false , backToReport ) ;
95
90
} ) ;
96
91
} ,
97
92
success : true ,
0 commit comments