Skip to content

Commit

Permalink
Merge pull request #28677 from Expensify/revert-27653-krishna2323/iss…
Browse files Browse the repository at this point in the history
…ue/27182

Revert "fix: Refocus issue on address field on delete and cancel"
  • Loading branch information
Li357 authored Oct 4, 2023
2 parents 1663440 + e0978fe commit 0a85bb8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
2 changes: 0 additions & 2 deletions src/components/HeaderWithBackButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function HeaderWithBackButton({
threeDotsMenuItems = [],
shouldEnableDetailPageNavigation = false,
children = null,
onModalHide = () => {},
shouldOverlay = false,
}) {
const [isDownloadButtonActive, temporarilyDisableDownloadButton] = useThrottledButtonState();
Expand Down Expand Up @@ -140,7 +139,6 @@ function HeaderWithBackButton({
menuItems={threeDotsMenuItems}
onIconPress={onThreeDotsButtonPress}
anchorPosition={threeDotsAnchorPosition}
onModalHide={onModalHide}
shouldOverlay={shouldOverlay}
/>
)}
Expand Down
5 changes: 0 additions & 5 deletions src/components/PopoverMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const propTypes = {
}),

withoutOverlay: PropTypes.bool,

/** Function to call on modal hide */
onModalHide: PropTypes.func,
};

const defaultProps = {
Expand All @@ -47,7 +44,6 @@ const defaultProps = {
},
anchorRef: () => {},
withoutOverlay: false,
onModalHide: () => {},
};

function PopoverMenu(props) {
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 2 additions & 10 deletions src/components/ThreeDotsMenu/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
};
Expand All @@ -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();
Expand All @@ -77,9 +73,6 @@ function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, me
};

const hidePopoverMenu = () => {
InteractionManager.runAfterInteractions(() => {
onModalHide();
});
setPopupMenuVisible(false);
};

Expand Down Expand Up @@ -112,7 +105,6 @@ function ThreeDotsMenu({iconTooltip, icon, iconFill, iconStyles, onIconPress, me
</View>
<PopoverMenu
onClose={hidePopoverMenu}
onPopoverHide={onModalHide}
isVisible={isPopupMenuVisible}
anchorPosition={anchorPosition}
anchorAlignment={anchorAlignment}
Expand Down
13 changes: 1 addition & 12 deletions src/pages/iou/WaypointEditor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useMemo, useRef, useState} from 'react';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import {InteractionManager, View} from 'react-native';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import {useNavigation} from '@react-navigation/native';
Expand Down Expand Up @@ -173,15 +173,6 @@ function WaypointEditor({route: {params: {iouType = '', transactionID = '', wayp
Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType));
};

const focusAddressInput = () => {
InteractionManager.runAfterInteractions(() => {
if (!textInput.current) {
return;
}
textInput.current.focus();
});
};

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand All @@ -205,14 +196,12 @@ function WaypointEditor({route: {params: {iouType = '', transactionID = '', wayp
onSelected: () => setIsDeleteStopModalOpen(true),
},
]}
onModalHide={focusAddressInput}
/>
<ConfirmModal
title={translate('distance.deleteWaypoint')}
isVisible={isDeleteStopModalOpen}
onConfirm={deleteStopAndHideModal}
onCancel={() => setIsDeleteStopModalOpen(false)}
onModalHide={focusAddressInput}
prompt={translate('distance.deleteWaypointConfirmation')}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
Expand Down

0 comments on commit 0a85bb8

Please sign in to comment.