Skip to content

Commit

Permalink
fix: add a flag to DropdownMenu for Popper update
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmars authored and davidacevedo committed Jun 8, 2022
1 parent a92990d commit 74a9e4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DropdownMenu.js
Expand Up @@ -18,6 +18,7 @@ const propTypes = {
persist: PropTypes.bool,
strategy: PropTypes.string,
container: targetPropType,
updateOnSelect: PropTypes.bool,
right: deprecated(PropTypes.bool, 'Please use "end" instead.'),
};

Expand Down Expand Up @@ -58,6 +59,7 @@ class DropdownMenu extends React.Component {
persist,
strategy,
container,
updateOnSelect,
...attrs
} = this.props;

Expand Down Expand Up @@ -92,7 +94,7 @@ class DropdownMenu extends React.Component {
modifiers={poperModifiers}
strategy={strategy}
>
{({ ref, style, placement }) => {
{({ ref, style, placement, update }) => {
let combinedStyle = { ...this.props.style, ...style };

const handleRef = (tagRef) => {
Expand All @@ -114,6 +116,7 @@ class DropdownMenu extends React.Component {
aria-hidden={!this.context.isOpen}
className={classes}
data-popper-placement={placement}
onClick={() => updateOnSelect && update()}
/>
);
}}
Expand Down

0 comments on commit 74a9e4e

Please sign in to comment.