Skip to content

Commit d9c8c32

Browse files
authored
Merge pull request #60957 from software-mansion-labs/jnowakow/fix-59927
Fix disappearing payment button
2 parents c4c889f + a7084b3 commit d9c8c32

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,12 @@ function MoneyRequestReportPreviewContent({
448448
}, [iouReportID]);
449449

450450
const reportPreviewAction = useMemo(() => {
451+
// It's necessary to allow payment animation to finish before button is changed
452+
if (isPaidAnimationRunning) {
453+
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.PAY;
454+
}
451455
return getReportPreviewAction(violations, iouReport, policy, transactions);
452-
}, [iouReport, policy, violations, transactions]);
456+
}, [isPaidAnimationRunning, violations, iouReport, policy, transactions]);
453457

454458
const reportPreviewActions = {
455459
[CONST.REPORT.REPORT_PREVIEW_ACTIONS.SUBMIT]: (
@@ -675,7 +679,8 @@ function MoneyRequestReportPreviewContent({
675679
))}
676680
</View>
677681
)}
678-
<View style={[buttonMaxWidth]}>{reportPreviewActions[reportPreviewAction]}</View>
682+
{/* height is needed to avoid flickering on animation */}
683+
<View style={[buttonMaxWidth, {height: variables.h40}]}>{reportPreviewActions[reportPreviewAction]}</View>
679684
</View>
680685
</View>
681686
</View>

src/components/ReportActionItem/ReportPreview.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,12 @@ function ReportPreview({
508508
}, [iouReportID]);
509509

510510
const reportPreviewAction = useMemo(() => {
511+
// It's necessary to allow payment animation to finish before button is changed
512+
if (isPaidAnimationRunning) {
513+
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.PAY;
514+
}
511515
return getReportPreviewAction(violations, iouReport, policy, transactions);
512-
}, [iouReport, policy, violations, transactions]);
516+
}, [isPaidAnimationRunning, violations, iouReport, policy, transactions]);
513517

514518
const reportPreviewActions = {
515519
[CONST.REPORT.REPORT_PREVIEW_ACTIONS.SUBMIT]: (
@@ -681,7 +685,8 @@ function ReportPreview({
681685
)}
682686
</View>
683687
</View>
684-
<View style={styles.pt4}>{reportPreviewActions[reportPreviewAction]}</View>
688+
{/* height is needed to avoid flickering on animation */}
689+
<View style={(styles.pt4, {height: variables.h40})}>{reportPreviewActions[reportPreviewAction]}</View>
685690
</View>
686691
</View>
687692
</View>

0 commit comments

Comments
 (0)