Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ function ReportActionCompose({
setIsFocused(true);
}, []);

// resets the composer to normal size when
// the send button is pressed.
const resetFullComposerSize = useCallback(() => {
if (isComposerFullSize) {
Report.setIsComposerFullSize(reportID, false);
}
setIsFullComposerAvailable(false);
}, [isComposerFullSize, reportID]);

// We are returning a callback here as we want to incoke the method on unmount only
useEffect(
() => () => {
Expand Down Expand Up @@ -338,7 +347,7 @@ function ReportActionCompose({
reportID={reportID}
report={report}
reportParticipantIDs={reportParticipantIDs}
isFullComposerAvailable={isFullComposerAvailable}
isFullComposerAvailable={isFullComposerAvailable && !isCommentEmpty}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused regression of not showing compose button on multiple new lines - #28093 (comment)

isComposerFullSize={isComposerFullSize}
updateShouldShowSuggestionMenuToFalse={updateShouldShowSuggestionMenuToFalse}
isBlockedFromConcierge={isBlockedFromConcierge}
Expand Down Expand Up @@ -400,6 +409,7 @@ function ReportActionCompose({
<SendButton
isDisabled={isSendDisabled}
setIsCommentEmpty={setIsCommentEmpty}
resetFullComposerSize={resetFullComposerSize}
submitForm={submitForm}
animatedRef={animatedRef}
/>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/home/report/ReportActionCompose/SendButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ const propTypes = {
/** Sets the isCommentEmpty flag to true */
setIsCommentEmpty: PropTypes.func.isRequired,

/** resets the composer to normal size */
resetFullComposerSize: PropTypes.func.isRequired,

/** Submits the form */
submitForm: PropTypes.func.isRequired,
};

function SendButton({isDisabled: isDisabledProp, animatedRef, setIsCommentEmpty, submitForm}) {
function SendButton({isDisabled: isDisabledProp, animatedRef, setIsCommentEmpty, resetFullComposerSize, submitForm}) {
const {translate} = useLocalize();

const Tap = Gesture.Tap()
Expand All @@ -40,6 +43,7 @@ function SendButton({isDisabled: isDisabledProp, animatedRef, setIsCommentEmpty,
const updates = {text: ''};
// We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state
runOnJS(setIsCommentEmpty)(true);
runOnJS(resetFullComposerSize)();
updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread
runOnJS(submitForm)();
});
Expand Down