From d1b8388528a22781ffd7fea968ba2e68df4ec6da Mon Sep 17 00:00:00 2001 From: Brandon Stites <42391420+stitesExpensify@users.noreply.github.com> Date: Mon, 8 Jan 2024 07:54:00 -0700 Subject: [PATCH] Merge pull request #34089 from Expensify/revert-33483-fix/32970-don't-focus-if-popover-visible Revert "Fix composer is focused after opening another popover" (cherry picked from commit 57c6c2f488ef7e06fee7304f66fe9be19447c0a4) --- .../ComposerWithSuggestions.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js index 1e8439c0086b..6c1d71625dc9 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js @@ -5,7 +5,6 @@ import {findNodeHandle, InteractionManager, NativeModules, View} from 'react-nat import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import Composer from '@components/Composer'; -import {PopoverContext} from '@components/PopoverProvider'; import withKeyboardState from '@components/withKeyboardState'; import useLocalize from '@hooks/useLocalize'; import usePrevious from '@hooks/usePrevious'; @@ -108,7 +107,6 @@ function ComposerWithSuggestions({ // For testing children, }) { - const {isOpen: isPopoverOpen} = React.useContext(PopoverContext); const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -411,15 +409,9 @@ function ComposerWithSuggestions({ * @param {Boolean} [shouldDelay=false] Impose delay before focusing the composer * @memberof ReportActionCompose */ - const focus = useCallback( - (shouldDelay = false) => { - if (isPopoverOpen) { - return; - } - focusComposerWithDelay(textInputRef.current)(shouldDelay); - }, - [isPopoverOpen], - ); + const focus = useCallback((shouldDelay = false) => { + focusComposerWithDelay(textInputRef.current)(shouldDelay); + }, []); const setUpComposeFocusManager = useCallback(() => { // This callback is used in the contextMenuActions to manage giving focus back to the compose input.