Skip to content

Commit

Permalink
Merge pull request #27015 from HezekielT/fix--Android-App---resizing-…
Browse files Browse the repository at this point in the history
…icon-doesn't-disappear-immediately-after-sending-the-message

fix: android app - expand icon doesn't disappear immediately after sending the message
  • Loading branch information
MariaHCD authored Sep 11, 2023
2 parents 3c8029d + 6232d7e commit 4a8fb06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/pages/home/report/ReportActionCompose/ReportActionCompose.js
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}
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

0 comments on commit 4a8fb06

Please sign in to comment.