Skip to content

Commit

Permalink
fix(DropdownMenu): use Bootstrap default offsets (#5662)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Feb 25, 2021
1 parent 3963f72 commit f29ad48
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import warning from 'warning';
import NavbarContext from './NavbarContext';
import { useBootstrapPrefix } from './ThemeProvider';
import useWrappedRefWithWarning from './useWrappedRefWithWarning';
import usePopperMarginModifiers from './usePopperMarginModifiers';
import {
BsPrefixProps,
BsPrefixRefForwardingComponent,
Expand Down Expand Up @@ -155,7 +154,6 @@ const DropdownMenu: BsPrefixRefForwardingComponent<
) => {
const isNavbar = useContext(NavbarContext);
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown-menu');
const [popperRef, marginModifiers] = usePopperMarginModifiers();

const alignClasses: string[] = [];
if (align) {
Expand Down Expand Up @@ -195,18 +193,13 @@ const DropdownMenu: BsPrefixRefForwardingComponent<
show: showProps,
alignEnd: alignRight,
usePopper: !isNavbar && alignClasses.length === 0,
popperConfig: {
...popperConfig,
modifiers: marginModifiers.concat(popperConfig?.modifiers || []),
},
offset: [0, 2],
popperConfig,
}) as UseDropdownMenuValueHack;

menuProps.ref = useMergedRefs(
popperRef,
useMergedRefs(
useWrappedRefWithWarning(ref, 'DropdownMenu'),
menuProps.ref,
),
useWrappedRefWithWarning(ref, 'DropdownMenu'),
menuProps.ref,
);

if (!hasShown && !renderOnMount) return null;
Expand Down

0 comments on commit f29ad48

Please sign in to comment.