@@ -121,7 +121,6 @@ function ReportPreview({
121
121
) ;
122
122
123
123
const [ isPaidAnimationRunning , setIsPaidAnimationRunning ] = useState ( false ) ;
124
- const [ isApprovedAnimationRunning , setIsApprovedAnimationRunning ] = useState ( false ) ;
125
124
const [ isHoldMenuVisible , setIsHoldMenuVisible ] = useState ( false ) ;
126
125
const [ requestType , setRequestType ] = useState < ActionHandledType > ( ) ;
127
126
const { nonHeldAmount, fullAmount, hasValidNonHeldAmount} = ReportUtils . getNonHeldAndFullAmount ( iouReport , policy ) ;
@@ -141,18 +140,12 @@ function ReportPreview({
141
140
} ) ) ;
142
141
const checkMarkScale = useSharedValue ( iouSettled ? 1 : 0 ) ;
143
142
144
- const isApproved = ReportUtils . isReportApproved ( iouReport , action ) ;
145
- const thumbsUpScale = useSharedValue ( isApproved ? 1 : 0.25 ) ;
146
- const thumbsUpStyle = useAnimatedStyle ( ( ) => ( {
147
- ...styles . defaultCheckmarkWrapper ,
148
- transform : [ { scale : thumbsUpScale . value } ] ,
149
- } ) ) ;
150
-
151
143
const moneyRequestComment = action ?. childLastMoneyRequestComment ?? '' ;
152
144
const isPolicyExpenseChat = ReportUtils . isPolicyExpenseChat ( chatReport ) ;
153
145
const isInvoiceRoom = ReportUtils . isInvoiceRoom ( chatReport ) ;
154
146
const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils . isOpenExpenseReport ( iouReport ) ;
155
147
148
+ const isApproved = ReportUtils . isReportApproved ( iouReport , action ) ;
156
149
const canAllowSettlement = ReportUtils . hasUpdatedTotal ( iouReport , policy ) ;
157
150
const numberOfRequests = allTransactions . length ;
158
151
const transactionsWithReceipts = ReportUtils . getTransactionsWithReceipts ( iouReportID ) ;
@@ -203,19 +196,11 @@ function ReportPreview({
203
196
const { isDelegateAccessRestricted, delegatorEmail} = useDelegateUserDetails ( ) ;
204
197
const [ isNoDelegateAccessMenuVisible , setIsNoDelegateAccessMenuVisible ] = useState ( false ) ;
205
198
206
- const stopAnimation = useCallback ( ( ) => {
207
- setIsPaidAnimationRunning ( false ) ;
208
- setIsApprovedAnimationRunning ( false ) ;
209
- } , [ ] ) ;
210
-
199
+ const stopAnimation = useCallback ( ( ) => setIsPaidAnimationRunning ( false ) , [ ] ) ;
211
200
const startAnimation = useCallback ( ( ) => {
212
201
setIsPaidAnimationRunning ( true ) ;
213
202
HapticFeedback . longPress ( ) ;
214
203
} , [ ] ) ;
215
- const startApprovedAnimation = useCallback ( ( ) => {
216
- setIsApprovedAnimationRunning ( true ) ;
217
- HapticFeedback . longPress ( ) ;
218
- } , [ ] ) ;
219
204
const confirmPayment = useCallback (
220
205
( type : PaymentMethodType | undefined , payAsBusiness ?: boolean ) => {
221
206
if ( ! type ) {
@@ -247,8 +232,6 @@ function ReportPreview({
247
232
} else if ( ReportUtils . hasHeldExpenses ( iouReport ?. reportID ) ) {
248
233
setIsHoldMenuVisible ( true ) ;
249
234
} else {
250
- setIsApprovedAnimationRunning ( true ) ;
251
- HapticFeedback . longPress ( ) ;
252
235
IOU . approveMoneyRequest ( iouReport , true ) ;
253
236
}
254
237
} ;
@@ -347,15 +330,14 @@ function ReportPreview({
347
330
348
331
const bankAccountRoute = ReportUtils . getBankAccountRoute ( chatReport ) ;
349
332
const getCanIOUBePaid = useCallback (
350
- ( onlyShowPayElsewhere = false , shouldCheckApprovedState = true ) => IOU . canIOUBePaid ( iouReport , chatReport , policy , allTransactions , onlyShowPayElsewhere , shouldCheckApprovedState ) ,
333
+ ( onlyShowPayElsewhere = false ) => IOU . canIOUBePaid ( iouReport , chatReport , policy , allTransactions , onlyShowPayElsewhere ) ,
351
334
[ iouReport , chatReport , policy , allTransactions ] ,
352
335
) ;
353
336
354
337
const canIOUBePaid = useMemo ( ( ) => getCanIOUBePaid ( ) , [ getCanIOUBePaid ] ) ;
355
- const canIOUBePaidAndApproved = useMemo ( ( ) => getCanIOUBePaid ( false , false ) , [ getCanIOUBePaid ] ) ;
356
338
const onlyShowPayElsewhere = useMemo ( ( ) => ! canIOUBePaid && getCanIOUBePaid ( true ) , [ canIOUBePaid , getCanIOUBePaid ] ) ;
357
339
const shouldShowPayButton = isPaidAnimationRunning || canIOUBePaid || onlyShowPayElsewhere ;
358
- const shouldShowApproveButton = useMemo ( ( ) => IOU . canApproveIOU ( iouReport , policy ) , [ iouReport , policy ] ) || isApprovedAnimationRunning ;
340
+ const shouldShowApproveButton = useMemo ( ( ) => IOU . canApproveIOU ( iouReport , policy ) , [ iouReport , policy ] ) ;
359
341
360
342
const shouldDisableApproveButton = shouldShowApproveButton && ! ReportUtils . isAllowedToApproveExpenseReport ( iouReport ) ;
361
343
@@ -442,7 +424,7 @@ function ReportPreview({
442
424
const shouldShowExportIntegrationButton = ! shouldShowPayButton && ! shouldShowSubmitButton && connectedIntegration && isAdmin && ReportUtils . canBeExported ( iouReport ) ;
443
425
444
426
useEffect ( ( ) => {
445
- if ( ! isPaidAnimationRunning || isApprovedAnimationRunning ) {
427
+ if ( ! isPaidAnimationRunning ) {
446
428
return ;
447
429
}
448
430
@@ -468,14 +450,6 @@ function ReportPreview({
468
450
}
469
451
} , [ isPaidAnimationRunning , iouSettled , checkMarkScale ] ) ;
470
452
471
- useEffect ( ( ) => {
472
- if ( ! isApproved ) {
473
- return ;
474
- }
475
-
476
- thumbsUpScale . value = withSpring ( 1 , { duration : 200 } ) ;
477
- } , [ isApproved , thumbsUpScale ] ) ;
478
-
479
453
return (
480
454
< OfflineWithFeedback
481
455
pendingAction = { iouReport ?. pendingFields ?. preview }
@@ -510,7 +484,7 @@ function ReportPreview({
510
484
< View style = { styles . expenseAndReportPreviewTextContainer } >
511
485
< View style = { styles . flexRow } >
512
486
< Animated . View style = { [ styles . flex1 , styles . flexRow , styles . alignItemsCenter , previewMessageStyle ] } >
513
- < Text style = { [ styles . textLabelSupporting , styles . lh20 ] } > { previewMessage } </ Text >
487
+ < Text style = { [ styles . textLabelSupporting , styles . lh16 ] } > { previewMessage } </ Text >
514
488
</ Animated . View >
515
489
{ shouldShowRBR && (
516
490
< Icon
@@ -538,14 +512,6 @@ function ReportPreview({
538
512
/>
539
513
</ Animated . View >
540
514
) }
541
- { isApproved && (
542
- < Animated . View style = { thumbsUpStyle } >
543
- < Icon
544
- src = { Expensicons . ThumbsUp }
545
- fill = { theme . icon }
546
- />
547
- </ Animated . View >
548
- ) }
549
515
</ View >
550
516
</ View >
551
517
{ shouldShowSubtitle && ! ! supportText && (
@@ -572,8 +538,6 @@ function ReportPreview({
572
538
< AnimatedSettlementButton
573
539
onlyShowPayElsewhere = { onlyShowPayElsewhere }
574
540
isPaidAnimationRunning = { isPaidAnimationRunning }
575
- isApprovedAnimationRunning = { isApprovedAnimationRunning }
576
- canIOUBePaid = { canIOUBePaidAndApproved || isPaidAnimationRunning }
577
541
onAnimationFinish = { stopAnimation }
578
542
formattedAmount = { getSettlementAmount ( ) ?? '' }
579
543
currency = { iouReport ?. currency }
@@ -642,13 +606,7 @@ function ReportPreview({
642
606
chatReport = { chatReport }
643
607
moneyRequestReport = { iouReport }
644
608
transactionCount = { numberOfRequests }
645
- startAnimation = { ( ) => {
646
- if ( requestType === CONST . IOU . REPORT_ACTION_TYPE . APPROVE ) {
647
- startApprovedAnimation ( ) ;
648
- } else {
649
- startAnimation ( ) ;
650
- }
651
- } }
609
+ startAnimation = { startAnimation }
652
610
/>
653
611
) }
654
612
</ OfflineWithFeedback >
0 commit comments