@@ -2,8 +2,7 @@ import React, {useRef, useState} from 'react';
22import { View } from 'react-native' ;
33import Button from '@components/Button' ;
44import type { DropdownOption } from '@components/ButtonWithDropdownMenu/types' ;
5- import MenuItem from '@components/MenuItem' ;
6- import Modal from '@components/Modal' ;
5+ import PopoverMenu from '@components/PopoverMenu' ;
76import type { SearchHeaderOptionValue } from '@components/Search/SearchPageHeader/SearchPageHeader' ;
87import useLocalize from '@hooks/useLocalize' ;
98import useThemeStyles from '@hooks/useThemeStyles' ;
@@ -58,24 +57,33 @@ function SearchSelectedNarrow({options, itemsLength}: SearchSelectedNarrowProps)
5857 shouldShowRightIcon = { options . length !== 0 }
5958 success
6059 />
61- < Modal
60+ < PopoverMenu
6261 isVisible = { isModalVisible }
63- type = { CONST . MODAL . MODAL_TYPE . BOTTOM_DOCKED }
6462 onClose = { handleOnCloseMenu }
6563 onModalHide = { handleOnModalHide }
66- >
67- { options . map ( ( option , index ) => (
68- < MenuItem
69- // eslint-disable-next-line react/jsx-props-no-spreading
70- { ...option }
71- title = { option . text }
72- titleStyle = { option . titleStyle }
73- icon = { option . icon }
74- onPress = { ( ) => handleOnMenuItemPress ( option , index ) }
75- key = { option . value }
76- />
77- ) ) }
78- </ Modal >
64+ onItemSelected = { ( selectedItem , index ) => {
65+ handleOnMenuItemPress ( selectedItem as DropdownOption < SearchHeaderOptionValue > , index ) ;
66+ } }
67+ anchorPosition = { { horizontal : 0 , vertical : 0 } }
68+ anchorRef = { buttonRef }
69+ anchorAlignment = { {
70+ horizontal : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT ,
71+ vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . BOTTOM ,
72+ } }
73+ fromSidebarMediumScreen = { false }
74+ shouldUseModalPaddingStyle
75+ menuItems = { options . map ( ( item , index ) => ( {
76+ ...item ,
77+ onSelected : item . onSelected
78+ ? ( ) => {
79+ item . onSelected ?.( ) ;
80+ }
81+ : ( ) => {
82+ handleOnMenuItemPress ( item , index ) ;
83+ } ,
84+ shouldCallAfterModalHide : true ,
85+ } ) ) }
86+ />
7987 </ View >
8088 ) ;
8189}
0 commit comments