Skip to content

Commit

Permalink
fix: popup should unmounted in inline mode (#666)
Browse files Browse the repository at this point in the history
* fix: popup should unmounted in inline mode

* chore: update
  • Loading branch information
MadCcc authored Oct 8, 2023
1 parent 89c09ad commit 489e90d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
28 changes: 20 additions & 8 deletions docs/examples/inlineCollapsed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import Menu, { SubMenu, Item } from 'rc-menu';
import Menu from 'rc-menu';
import './inlineCollapsed.less';

const App = () => {
Expand All @@ -15,13 +15,25 @@ const App = () => {
inlineCollapsed={collapsed}
style={{ width: 600 }}
className={collapsed ? 'collapsed' : ''}
>
<Item key="1">item 1</Item>
<SubMenu key="2" title={`inlineCollapsed: ${collapsed.toString()}`}>
<Item key="3">item 2</Item>
<Item key="4">item 3</Item>
</SubMenu>
</Menu>
items={[
{ key: '1', label: 'item 1' },
{
key: '2',
label: `inlineCollapsed: ${collapsed.toString()}`,
children: [
{ key: '3', label: 'item 2' },
{ key: '4', label: 'item 3' },
{
key: '5', label: 'SubMenu', children: [
{ key: '6', label: 'item 4' },
{ key: '7', label: 'item 5' },
{ key: '8', label: 'item 6' },
]
}
],
},
]}
/>
</>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/SubMenu/PopupTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default function PopupTrigger({
onPopupVisibleChange={onVisibleChange}
forceRender={forceSubMenuRender}
popupMotion={mergedMotion}
fresh
>
{children}
</Trigger>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"paths": {
"@/*": ["src/*"],
"@@/*": [".dumi/tmp/*"],
"rc-menu": ["src/index.tsx"]
"rc-menu": ["src/index.ts"]
}
}
}

0 comments on commit 489e90d

Please sign in to comment.