Skip to content

Commit

Permalink
fix allow to type when report is loading
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanDylann committed Oct 3, 2023
1 parent 49b4de7 commit af95ab6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ function ReportScreen({
policies={policies}
/>
) : (
<ReportFooter shouldDisableCompose />
<ReportFooter isReportReadyForDisplay={false} />
)}
</View>
</DragAndDropProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -84,6 +86,7 @@ const defaultProps = {
isComposerFullSize: false,
pendingAction: null,
shouldShowComposeInput: true,
isReportReadyForDisplay: true,
...withCurrentUserPersonalDetailsDefaultProps,
};

Expand All @@ -106,6 +109,7 @@ function ReportActionCompose({
reportID,
reportActions,
shouldShowComposeInput,
isReportReadyForDisplay,
}) {
const {translate} = useLocalize();
const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions();
Expand Down Expand Up @@ -318,7 +322,7 @@ function ReportActionCompose({
const handleSendMessage = useCallback(() => {
'worklet';

if (isSendDisabled) {
if (isSendDisabled || !isReportReadyForDisplay) {
return;
}

Expand All @@ -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 (
<View
Expand Down
5 changes: 5 additions & 0 deletions src/pages/home/report/ReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const propTypes = {
/** Whether user interactions should be disabled */
shouldDisableCompose: PropTypes.bool,

/** Whetjer the report is ready for display */
isReportReadyForDisplay: PropTypes.bool,

...windowDimensionsPropTypes,
};

Expand All @@ -48,6 +51,7 @@ const defaultProps = {
pendingAction: null,
shouldShowComposeInput: true,
shouldDisableCompose: false,
isReportReadyForDisplay: true,
};

function ReportFooter(props) {
Expand Down Expand Up @@ -86,6 +90,7 @@ function ReportFooter(props) {
pendingAction={props.pendingAction}
isComposerFullSize={props.isComposerFullSize}
disabled={props.shouldDisableCompose}
isReportReadyForDisplay={props.isReportReadyForDisplay}
/>
</SwipeableView>
</View>
Expand Down

0 comments on commit af95ab6

Please sign in to comment.