Skip to content

Commit

Permalink
Revert "use optional chaining"
Browse files Browse the repository at this point in the history
This reverts commit 8433620.
  • Loading branch information
rushatgabhane committed Aug 28, 2023
1 parent 8433620 commit 345485d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/pages/home/report/ReportActionCompose/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function ReportActionCompose({
if (!isKeyboardVisibleWhenShowingModalRef.current) {
return;
}
composerRef?.current?.focus(true);
composerRef.current.focus(true);
isKeyboardVisibleWhenShowingModalRef.current = false;
}, []);

Expand All @@ -197,9 +197,9 @@ function ReportActionCompose({

const onAddActionPressed = useCallback(() => {
if (!willBlurTextInputOnTapOutside) {
isKeyboardVisibleWhenShowingModalRef.current = composerRef?.current?.isFocused();
isKeyboardVisibleWhenShowingModalRef.current = composerRef.current.isFocused();
}
composerRef?.current?.blur();
composerRef.current.blur();
}, []);

const updateShouldShowSuggestionMenuToFalse = useCallback(() => {
Expand All @@ -218,7 +218,7 @@ function ReportActionCompose({
// We don't really care about saving the draft the user was typing
// We need to make sure an empty draft gets saved instead
debouncedSaveReportComment.cancel();
const newComment = composerRef?.current?.prepareCommentAndResetComposer();
const newComment = composerRef.current.prepareCommentAndResetComposer();
Report.addAttachment(reportID, file, newComment);
setTextInputShouldClear(false);
},
Expand Down Expand Up @@ -250,7 +250,7 @@ function ReportActionCompose({
// We need to make sure an empty draft gets saved instead
debouncedSaveReportComment.cancel();

const newComment = composerRef?.current?.prepareCommentAndResetComposer();
const newComment = composerRef.current.prepareCommentAndResetComposer();
if (!newComment) {
return;
}
Expand Down Expand Up @@ -403,8 +403,13 @@ function ReportActionCompose({
{DeviceCapabilities.canUseTouchScreen() && isMediumScreenWidth ? null : (
<EmojiPickerButton
isDisabled={isBlockedFromConcierge || disabled}
onModalHide={() => composerRef?.current?.focus(true)}
onEmojiSelected={(...args) => composerRef?.current?.replaceSelectionWithText(...args)}
onModalHide={() => {
if (composerRef === null || composerRef.current === null) {
return;
}
composerRef.current.focus(true);
}}
onEmojiSelected={(...args) => composerRef.current.replaceSelectionWithText(...args)}
emojiPickerID={report.reportID}
/>
)}
Expand Down

0 comments on commit 345485d

Please sign in to comment.