Repository navigation
fix(PopoverMenu): fix opening external links #45762
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
Changes from all commits
1e1ebe4
cd1d73c
9bfbcde
fadc4f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import lodashIsEqual from 'lodash/isEqual'; | ||
| import type {RefObject} from 'react'; | ||
| import React, {useEffect, useRef, useState} from 'react'; | ||
| import React, {useEffect, useState} from 'react'; | ||
| import {StyleSheet, View} from 'react-native'; | ||
| import type {ModalProps} from 'react-native-modal'; | ||
| import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager'; | ||
|
|
@@ -106,8 +106,6 @@ function PopoverMenu({ | |
| const styles = useThemeStyles(); | ||
| const theme = useTheme(); | ||
| const {isSmallScreenWidth} = useResponsiveLayout(); | ||
| const selectedItemIndex = useRef<number | null>(null); | ||
|
|
||
| const [currentMenuItems, setCurrentMenuItems] = useState(menuItems); | ||
| const currentMenuItemsFocusedIndex = currentMenuItems?.findIndex((option) => option.isSelected); | ||
| const [enteredSubMenuIndexes, setEnteredSubMenuIndexes] = useState<number[]>([]); | ||
|
|
@@ -122,8 +120,8 @@ function PopoverMenu({ | |
| const selectedSubMenuItemIndex = selectedItem?.subMenuItems.findIndex((option) => option.isSelected); | ||
| setFocusedIndex(selectedSubMenuItemIndex); | ||
| } else { | ||
| selectedItemIndex.current = index; | ||
| onItemSelected(selectedItem, index); | ||
| selectedItem.onSelected?.(); | ||
|
Comment on lines
123
to
+124
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes in this file caused a regression: #46746 I'm trying to understand this component, why do we have two callbacks when we click a menu item?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can ignore that question, I see that they are just two "types" of callback, and in the broken flow I think the difference in the implementation is that now |
||
| } | ||
| }; | ||
|
|
||
|
|
@@ -185,10 +183,6 @@ function PopoverMenu({ | |
|
|
||
| const onModalHide = () => { | ||
| setFocusedIndex(-1); | ||
| if (selectedItemIndex.current !== null) { | ||
| currentMenuItems[selectedItemIndex.current].onSelected?.(); | ||
| selectedItemIndex.current = null; | ||
| } | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.