Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-menu",
"version": "7.4.6",
"version": "7.4.7",
"description": "menu ui component for react",
"keywords": [
"react",
Expand Down
19 changes: 9 additions & 10 deletions src/DOMWrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class DOMWrap extends React.Component {

this.overflowedItems = [];
let currentSumWidth = 0;
const children = this.props.children;

// index for last visible child in horizontal mode
let lastVisibleIndex = undefined;
Expand All @@ -172,15 +171,6 @@ class DOMWrap extends React.Component {
lastVisibleIndex++;
}
});

children.slice(lastVisibleIndex + 1).forEach(c => {
// children[index].key will become '.$key' in clone by default,
// we have to overwrite with the correct key explicitly
this.overflowedItems.push(React.cloneElement(
c,
{ key: c.props.eventKey, mode: 'vertical-left' },
));
});
}

this.setState({ lastVisibleIndex });
Expand All @@ -205,6 +195,15 @@ class DOMWrap extends React.Component {
);
}
if (index === lastVisibleIndex + 1) {
this.overflowedItems = children.slice(lastVisibleIndex + 1).map(c => {
return React.cloneElement(
c,
// children[index].key will become '.$key' in clone by default,
// we have to overwrite with the correct key explicitly
{ key: c.props.eventKey, mode: 'vertical-left' },
);
});

overflowed = this.getOverflowedSubMenuItem(
childNode.props.eventKey,
this.overflowedItems,
Expand Down