File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type {ModalProps} from 'react-native-modal';
88import type { SvgProps } from 'react-native-svg' ;
99import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager' ;
1010import useKeyboardShortcut from '@hooks/useKeyboardShortcut' ;
11+ import usePrevious from '@hooks/usePrevious' ;
1112import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
1213import useStyleUtils from '@hooks/useStyleUtils' ;
1314import useTheme from '@hooks/useTheme' ;
@@ -178,7 +179,16 @@ function getSelectedItemIndex(menuItems: PopoverMenuItem[]) {
178179 return menuItems . findIndex ( ( option ) => option . isSelected ) ;
179180}
180181
181- function PopoverMenu ( {
182+ function PopoverMenu ( props : PopoverMenuProps ) {
183+ const wasVisible = usePrevious ( props . isVisible ) ;
184+ // Do not render the PopoverMenu before it gets opened. Until then both values are false
185+ if ( ! wasVisible && ! props . isVisible ) {
186+ return null ;
187+ }
188+ return < BasePopoverMenu { ...props } /> ;
189+ }
190+
191+ function BasePopoverMenu ( {
182192 menuItems,
183193 onItemSelected,
184194 isVisible,
You can’t perform that action at this time.
0 commit comments