From e0978fe7924eaff6631b87377b5363bdb7760e1a Mon Sep 17 00:00:00 2001 From: Amy Evans Date: Tue, 3 Oct 2023 11:14:52 +0900 Subject: [PATCH] Revert "fix: Refocus issue on address field on delete and cancel" --- src/components/HeaderWithBackButton/index.js | 2 -- src/components/PopoverMenu/index.js | 5 ----- src/components/ThreeDotsMenu/index.js | 12 ++---------- src/pages/iou/WaypointEditor.js | 13 +------------ 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js index c720529371d7..1637e90c7e82 100755 --- a/src/components/HeaderWithBackButton/index.js +++ b/src/components/HeaderWithBackButton/index.js @@ -47,7 +47,6 @@ function HeaderWithBackButton({ }, threeDotsMenuItems = [], children = null, - onModalHide = () => {}, shouldOverlay = false, }) { const [isDownloadButtonActive, temporarilyDisableDownloadButton] = useThrottledButtonState(); @@ -139,7 +138,6 @@ function HeaderWithBackButton({ menuItems={threeDotsMenuItems} onIconPress={onThreeDotsButtonPress} anchorPosition={threeDotsAnchorPosition} - onModalHide={onModalHide} shouldOverlay={shouldOverlay} /> )} diff --git a/src/components/PopoverMenu/index.js b/src/components/PopoverMenu/index.js index 840e777b2479..4cdc7a5a4f47 100644 --- a/src/components/PopoverMenu/index.js +++ b/src/components/PopoverMenu/index.js @@ -34,9 +34,6 @@ const propTypes = { }), withoutOverlay: PropTypes.bool, - - /** Function to call on modal hide */ - onModalHide: PropTypes.func, }; const defaultProps = { @@ -47,7 +44,6 @@ const defaultProps = { }, anchorRef: () => {}, withoutOverlay: false, - onModalHide: () => {}, }; function PopoverMenu(props) { @@ -82,7 +78,6 @@ function PopoverMenu(props) { isVisible={props.isVisible} onModalHide={() => { setFocusedIndex(-1); - props.onModalHide(); if (selectedItemIndex.current !== null) { props.menuItems[selectedItemIndex.current].onSelected(); selectedItemIndex.current = null; diff --git a/src/components/ThreeDotsMenu/index.js b/src/components/ThreeDotsMenu/index.js index 5e22a74fa37e..f0cee6fdea2f 100644 --- a/src/components/ThreeDotsMenu/index.js +++ b/src/components/ThreeDotsMenu/index.js @@ -1,5 +1,5 @@ import React, {useState, useRef} from 'react'; -import {InteractionManager, View} from 'react-native'; +import {View} from 'react-native'; import PropTypes from 'prop-types'; import _ from 'underscore'; import Icon from '../Icon'; @@ -46,9 +46,6 @@ const propTypes = { vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)), }), - /** Function to call on modal hide */ - onModalHide: PropTypes.func, - /** Whether the popover menu should overlay the current view */ shouldOverlay: PropTypes.bool, }; @@ -63,11 +60,10 @@ const defaultProps = { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, // we assume that popover menu opens below the button, anchor is at TOP }, - onModalHide: () => {}, shouldOverlay: false, }; -function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, menuItems, anchorPosition, anchorAlignment, onModalHide, shouldOverlay}) { +function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, menuItems, anchorPosition, anchorAlignment, shouldOverlay}) { const [isPopupMenuVisible, setPopupMenuVisible] = useState(false); const buttonRef = useRef(null); const {translate} = useLocalize(); @@ -77,9 +73,6 @@ function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, me }; const hidePopoverMenu = () => { - InteractionManager.runAfterInteractions(() => { - onModalHide(); - }); setPopupMenuVisible(false); }; @@ -112,7 +105,6 @@ function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, me { - InteractionManager.runAfterInteractions(() => { - if (!textInput.current) { - return; - } - textInput.current.focus(); - }); - }; - return ( setIsDeleteStopModalOpen(true), }, ]} - onModalHide={focusAddressInput} /> setIsDeleteStopModalOpen(false)} - onModalHide={focusAddressInput} prompt={translate('distance.deleteWaypointConfirmation')} confirmText={translate('common.delete')} cancelText={translate('common.cancel')}