diff --git a/src/view/com/util/forms/NativeDropdown.tsx b/src/view/com/util/forms/NativeDropdown.tsx index 0a47569f..c8e5fb2d 100644 --- a/src/view/com/util/forms/NativeDropdown.tsx +++ b/src/view/com/util/forms/NativeDropdown.tsx @@ -1,13 +1,15 @@ import React from 'react' +import {Platform, Pressable, StyleSheet, View, ViewStyle} from 'react-native' +import {IconProp} from '@fortawesome/fontawesome-svg-core' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import * as DropdownMenu from 'zeego/dropdown-menu' -import {Pressable, StyleSheet, Platform, View, ViewStyle} from 'react-native' -import {IconProp} from '@fortawesome/fontawesome-svg-core' import {MenuItemCommonProps} from 'zeego/lib/typescript/menu' -import {usePalette} from 'lib/hooks/usePalette' -import {isWeb} from 'platform/detection' -import {useTheme} from 'lib/ThemeContext' + import {HITSLOP_10} from 'lib/constants' +import {usePalette} from 'lib/hooks/usePalette' +import {useTheme} from 'lib/ThemeContext' +import {isIOS, isWeb} from 'platform/detection' +import {Portal} from '#/components/Portal' // Custom Dropdown Menu Components // == @@ -169,74 +171,105 @@ export function NativeDropdown({ }: React.PropsWithChildren) { const pal = usePalette('default') const theme = useTheme() + const [isOpen, setIsOpen] = React.useState(false) const dropDownBackgroundColor = theme.colorScheme === 'dark' ? pal.btn : pal.viewLight return ( - - - {children} - - - {items.map((item, index) => { - if (item.label === 'separator') { - return ( - - ) - } - if (index > 1 && items[index - 1].label === 'separator') { - return ( - - + {isIOS && isOpen && ( + + + + )} + + + {children} + + + {items.map((item, index) => { + if (item.label === 'separator') { + return ( + - {item.label} - {item.icon && ( - - - - )} - - + /> + ) + } + if (index > 1 && items[index - 1].label === 'separator') { + return ( + + + {item.label} + {item.icon && ( + + + + )} + + + ) + } + return ( + + {item.label} + {item.icon && ( + + + + )} + ) - } - return ( - - {item.label} - {item.icon && ( - - - - )} - - ) - })} - - + })} + + + + ) +} + +function Backdrop() { + // Not visible but it eats the click outside. + // Only necessary for iOS. + return ( + { + /* noop */ + }} + /> ) }