Skip to content

Commit

Permalink
use focus()
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Aug 28, 2023
1 parent 345485d commit d41c300
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 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);
focus();

Check failure on line 186 in src/pages/home/report/ReportActionCompose/ReportActionCompose.js

View workflow job for this annotation

GitHub Actions / lint

'focus' was used before it was defined
isKeyboardVisibleWhenShowingModalRef.current = false;
}, []);

Expand Down Expand Up @@ -270,6 +270,12 @@ function ReportActionCompose({
isNextModalWillOpenRef.current = true;
}, []);

const focus = () => {
if (composerRef === null || composerRef.current === null) {
return;
}
composerRef.current.focus(true);
}
const onBlur = useCallback((e) => {
setIsFocused(false);
suggestionsRef.current.resetSuggestions();
Expand Down Expand Up @@ -403,12 +409,7 @@ function ReportActionCompose({
{DeviceCapabilities.canUseTouchScreen() && isMediumScreenWidth ? null : (
<EmojiPickerButton
isDisabled={isBlockedFromConcierge || disabled}
onModalHide={() => {
if (composerRef === null || composerRef.current === null) {
return;
}
composerRef.current.focus(true);
}}
onModalHide={focus}
onEmojiSelected={(...args) => composerRef.current.replaceSelectionWithText(...args)}
emojiPickerID={report.reportID}
/>
Expand Down

0 comments on commit d41c300

Please sign in to comment.