Skip to content

Commit 5b866bc

Browse files
committed
fix: handle navigation back for button with dropdown menu
1 parent 4764b6b commit 5b866bc

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/components/ButtonWithDropdownMenu/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function ButtonWithDropdownMenu<IValueType>({
5151
secondLineText = '',
5252
icon,
5353
shouldUseModalPaddingStyle = true,
54+
shouldHandleNavigationBack = true,
5455
}: ButtonWithDropdownMenuProps<IValueType>) {
5556
const theme = useTheme();
5657
const styles = useThemeStyles();
@@ -221,6 +222,7 @@ function ButtonWithDropdownMenu<IValueType>({
221222
setIsMenuVisible(false);
222223
onOptionsMenuHide?.();
223224
}}
225+
shouldHandleNavigationBack={shouldHandleNavigationBack}
224226
onModalShow={onOptionsMenuShow}
225227
onItemSelected={(selectedSubitem, index, event) => {
226228
onSubItemSelected?.(selectedSubitem, index, event);

src/components/ButtonWithDropdownMenu/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ type ButtonWithDropdownMenuProps<TValueType> = {
142142

143143
/** Whether to use modal padding style for the popover menu */
144144
shouldUseModalPaddingStyle?: boolean;
145+
146+
/** Whether handle navigation back when modal show. */
147+
shouldHandleNavigationBack?: boolean;
145148
};
146149

147150
export type {

src/components/PopoverMenu.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ type PopoverMenuProps = Partial<PopoverModalProps> & {
158158

159159
/** Used to locate the component in the tests */
160160
testID?: string;
161+
162+
/** Whether handle navigation back when modal show. */
163+
shouldHandleNavigationBack?: boolean;
161164
};
162165

163166
const renderWithConditionalWrapper = (shouldUseScrollView: boolean, contentContainerStyle: StyleProp<ViewStyle>, children: ReactNode): React.JSX.Element => {
@@ -209,6 +212,7 @@ function PopoverMenu({
209212
shouldUseModalPaddingStyle,
210213
shouldAvoidSafariException = false,
211214
testID,
215+
shouldHandleNavigationBack,
212216
}: PopoverMenuProps) {
213217
const styles = useThemeStyles();
214218
const theme = useTheme();
@@ -405,6 +409,7 @@ function PopoverMenu({
405409
setEnteredSubMenuIndexes(CONST.EMPTY_ARRAY);
406410
onClose();
407411
}}
412+
shouldHandleNavigationBack={shouldHandleNavigationBack}
408413
isVisible={isVisible}
409414
onModalHide={handleModalHide}
410415
onModalShow={onModalShow}

0 commit comments

Comments
 (0)