Skip to content

Commit

Permalink
fix composer focus regain
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Nov 29, 2024
1 parent 64eaf2f commit bb9318f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/focusComposerWithDelay/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {InteractionManager} from 'react-native';
import ComposerFocusManager from '@libs/ComposerFocusManager';
import isWindowReadyToFocus from '@libs/isWindowReadyToFocus';
import * as EmojiPickerAction from '@userActions/EmojiPickerAction';
Expand Down Expand Up @@ -31,7 +32,8 @@ function focusComposerWithDelay(textInput: InputType | null): FocusComposerWithD
if (!textInput) {
return;
}
textInput.focus();
// When the closing modal has a focused text input focus() needs a delay to properly work.
InteractionManager.runAfterInteractions(() => textInput.focus());
if (forcedSelectionRange) {
setTextInputSelection(textInput, forcedSelectionRange);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ function ReportActionCompose({
raiseIsScrollLikelyLayoutTriggered={raiseIsScrollLikelyLayoutTriggered}
onAddActionPressed={onAddActionPressed}
onItemSelected={onItemSelected}
onCanceledAttachmentPicker={() => {
if (!shouldFocusInputOnScreenFocus) {
return;
}
focus();
}}
actionButtonRef={actionButtonRef}
shouldDisableAttachmentItem={hasExceededMaxCommentLength}
/>
Expand Down

0 comments on commit bb9318f

Please sign in to comment.