Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not focus input after other interactions #48415

Merged
merged 18 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c337d6f
remove focusing durty
rezkiy37 Sep 2, 2024
986becc
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 3, 2024
6ff977c
clear redundant code
rezkiy37 Sep 3, 2024
29bd065
do not focus on web
rezkiy37 Sep 3, 2024
c14d687
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 4, 2024
64fbcd7
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 9, 2024
89366c6
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 16, 2024
3c4b392
refocus when RHP closed
rezkiy37 Sep 16, 2024
00ce01f
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 16, 2024
c8c7f30
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 17, 2024
110c693
focus after emojis
rezkiy37 Sep 18, 2024
0fd7fb4
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 18, 2024
138290a
refactor AttachmentPickerWithMenuItems
rezkiy37 Sep 18, 2024
522277c
refactor ReportActionCompose
rezkiy37 Sep 18, 2024
be472cd
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 24, 2024
a14bd8f
Refactor willBlurTextInputOnTapOutside to use getIsNarrowLayout
rezkiy37 Sep 25, 2024
291050a
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 26, 2024
3555591
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Sep 27, 2024
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
3 changes: 2 additions & 1 deletion src/libs/willBlurTextInputOnTapOutside/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getIsNarrowLayout from '@libs/getIsNarrowLayout';
import type WillBlurTextInputOnTapOutside from './types';

const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => true;
const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => !getIsNarrowLayout();

export default willBlurTextInputOnTapOutside;
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ type AttachmentPickerWithMenuItemsProps = {
onTriggerAttachmentPicker: () => void;

/** Called when cancelling the attachment picker */
onCanceledAttachmentPicker: () => void;
onCanceledAttachmentPicker?: () => void;

/** Called when the menu with the items is closed after it was open */
onMenuClosed: () => void;
onMenuClosed?: () => void;

/** Called when the add action button is pressed */
onAddActionPressed: () => void;
Expand Down Expand Up @@ -192,7 +192,7 @@ function AttachmentPickerWithMenuItems({

const onPopoverMenuClose = () => {
setMenuVisibility(false);
onMenuClosed();
onMenuClosed?.();
};

const prevIsFocused = usePrevious(isFocused);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,6 @@ function ReportActionCompose({

const isKeyboardVisibleWhenShowingModalRef = useRef(false);
const isNextModalWillOpenRef = useRef(false);
const restoreKeyboardState = useCallback(() => {
if (!isKeyboardVisibleWhenShowingModalRef.current || isNextModalWillOpenRef.current) {
return;
}
focus();
isKeyboardVisibleWhenShowingModalRef.current = false;
}, []);

const containerRef = useRef<View>(null);
const measureContainer = useCallback(
Expand Down Expand Up @@ -263,8 +256,7 @@ function ReportActionCompose({
const onAttachmentPreviewClose = useCallback(() => {
updateShouldShowSuggestionMenuToFalse();
setIsAttachmentPreviewActive(false);
restoreKeyboardState();
}, [updateShouldShowSuggestionMenuToFalse, restoreKeyboardState]);
}, [updateShouldShowSuggestionMenuToFalse]);

/**
* Add a new comment to this chat
Expand Down Expand Up @@ -455,11 +447,6 @@ function ReportActionCompose({
isMenuVisible={isMenuVisible}
onTriggerAttachmentPicker={onTriggerAttachmentPicker}
raiseIsScrollLikelyLayoutTriggered={raiseIsScrollLikelyLayoutTriggered}
onCanceledAttachmentPicker={() => {
isNextModalWillOpenRef.current = false;
restoreKeyboardState();
}}
onMenuClosed={restoreKeyboardState}
onAddActionPressed={onAddActionPressed}
onItemSelected={onItemSelected}
actionButtonRef={actionButtonRef}
Expand Down
Loading