Skip to content

Commit

Permalink
fix(atoms): fix dropdown flip
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x authored and zouxuoz committed Jul 17, 2018
1 parent 6c91afa commit 810638e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/atoms/Dropdown/DropdownBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const setOffset = (offset?: PropSizes) => offset && offset !== 'none'
? fp.merge({ offset: { enabled: true, offset: offsetSizes[offset] }})
: fp.identity;

const setFlip = fp.merge({
flip: { behavior: ['bottom'] },
boundariesElement: 'window',
});

const dropdownBodyEnhancer: HOC<*, DropdownBodyProps> = compose(
setDisplayName('Dropdown.Body'),
withDropdownContext,
Expand Down Expand Up @@ -94,13 +99,14 @@ class DropdownBodyBase extends PureComponent<DropdownBodyEnhancedProps> {
const { preventOverflow, offset } = this.props;

return fp.pipe(
setFlip,
setPreventOverflow(preventOverflow),
setOffset(offset),
)({});
}

getBodyWidth = () => {
const { stretch, targetWidth, width } = this.props;
const { stretch, dropdown: { targetWidth }, width } = this.props;

return stretch
? targetWidth
Expand Down

0 comments on commit 810638e

Please sign in to comment.