From af95ab63476d9054783a5a1b4fc0dc8aaa44bf01 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 3 Oct 2023 11:43:50 +0700 Subject: [PATCH] fix allow to type when report is loading --- src/pages/home/ReportScreen.js | 2 +- .../report/ReportActionCompose/ReportActionCompose.js | 8 ++++++-- src/pages/home/report/ReportFooter.js | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 7a979ae18783..43900daf939e 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -432,7 +432,7 @@ function ReportScreen({ policies={policies} /> ) : ( - + )} diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 552cd2cc21ad..b43400287269 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -73,6 +73,8 @@ const propTypes = { /** The type of action that's pending */ pendingAction: PropTypes.oneOf(['add', 'update', 'delete']), + /** /** Whetjer the report is ready for display */ + isReportReadyForDisplay: PropTypes.bool, ...withCurrentUserPersonalDetailsPropTypes, }; @@ -84,6 +86,7 @@ const defaultProps = { isComposerFullSize: false, pendingAction: null, shouldShowComposeInput: true, + isReportReadyForDisplay: true, ...withCurrentUserPersonalDetailsDefaultProps, }; @@ -106,6 +109,7 @@ function ReportActionCompose({ reportID, reportActions, shouldShowComposeInput, + isReportReadyForDisplay, }) { const {translate} = useLocalize(); const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions(); @@ -318,7 +322,7 @@ function ReportActionCompose({ const handleSendMessage = useCallback(() => { 'worklet'; - if (isSendDisabled) { + if (isSendDisabled || !isReportReadyForDisplay) { return; } @@ -330,7 +334,7 @@ function ReportActionCompose({ runOnJS(resetFullComposerSize)(); updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread runOnJS(submitForm)(); - }, [isSendDisabled, resetFullComposerSize, submitForm, animatedRef]); + }, [isSendDisabled, resetFullComposerSize, submitForm, animatedRef, isReportReadyForDisplay]); return (