Skip to content
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

fix: incorrect paddings in Search popover #53542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ type PopoverMenuProps = Partial<PopoverModalProps> & {

/** Whether to update the focused index on a row select */
shouldUpdateFocusedIndex?: boolean;

/** Should we apply padding style in modal itself. If this value is false, we will handle it in ScreenWrapper */
shouldUseModalPaddingStyle?: boolean;
};

const renderWithConditionalWrapper = (shouldUseScrollView: boolean, contentContainerStyle: StyleProp<ViewStyle>, children: ReactNode): React.JSX.Element => {
Expand Down Expand Up @@ -166,6 +169,7 @@ function PopoverMenu({
scrollContainerStyle,
shouldUseScrollView = false,
shouldUpdateFocusedIndex = true,
shouldUseModalPaddingStyle,
}: PopoverMenuProps) {
const styles = useThemeStyles();
const theme = useTheme();
Expand Down Expand Up @@ -338,6 +342,7 @@ function PopoverMenu({
useNativeDriver
restoreFocusType={restoreFocusType}
innerContainerStyle={innerContainerStyle}
shouldUseModalPaddingStyle={shouldUseModalPaddingStyle}
>
<FocusTrapForModal active={isVisible}>
<View style={[isSmallScreenWidth ? {maxHeight: windowHeight - 250} : styles.createMenuContainer, containerStyles]}>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Search/SearchTypeMenuNarrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import Text from '@components/Text';
import ThreeDotsMenu from '@components/ThreeDotsMenu';
import useDeleteSavedSearch from '@hooks/useDeleteSavedSearch';
import useLocalize from '@hooks/useLocalize';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useSingleExecution from '@hooks/useSingleExecution';
import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -63,7 +63,7 @@ function SearchTypeMenuNarrow({typeMenuItems, activeItemIndex, queryJSON, title,
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const taxRates = getAllTaxRates();
const [cardList = {}] = useOnyx(ONYXKEYS.CARD_LIST);
const {bottom} = useSafeAreaInsets();
const {unmodifiedPaddings} = useStyledSafeAreaInsets();

const [isPopoverVisible, setIsPopoverVisible] = useState(false);
const buttonRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -211,9 +211,9 @@ function SearchTypeMenuNarrow({typeMenuItems, activeItemIndex, queryJSON, title,
onClose={closeMenu}
onItemSelected={closeMenu}
anchorRef={buttonRef}
innerContainerStyle={{paddingBottom: bottom}}
scrollContainerStyle={styles.pv4}
shouldUseScrollView
shouldUseModalPaddingStyle={false}
innerContainerStyle={{paddingBottom: unmodifiedPaddings.bottom}}
/>
<DeleteConfirmModal />
</View>
Expand Down
Loading