fix: Menu not support React.Fragment (#26656)

* fix: Menu support React.Fragment

* chore: tweak menu demo

* fix: React key warning
This commit is contained in:
偏右 2020-09-09 16:52:04 +08:00 committed by GitHub
parent d98981b279
commit 39b40b573d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 8 deletions

View File

@ -24,6 +24,26 @@ describe('Menu', () => {
</Menu>
));
mountTest(() => (
<Menu>
<Menu.Item />
<>
<Menu.ItemGroup />
<Menu.SubMenu />
{null}
</>
<>
<Menu.Item />
</>
{undefined}
<>
<>
<Menu.Item />
</>
</>
</Menu>
));
rtlTest(() => (
<Menu>
<Menu.Item />

View File

@ -39,7 +39,7 @@ class App extends React.Component {
<Menu.Item key="app" disabled icon={<AppstoreOutlined />}>
Navigation Two
</Menu.Item>
<SubMenu icon={<SettingOutlined />} title="Navigation Three - Submenu">
<SubMenu key="SubMenu" icon={<SettingOutlined />} title="Navigation Three - Submenu">
<Menu.ItemGroup title="Item 1">
<Menu.Item key="setting:1">Option 1</Menu.Item>
<Menu.Item key="setting:2">Option 2</Menu.Item>

View File

@ -34,21 +34,22 @@ function renderFilterItems({
locale: TableLocale;
}) {
if (filters.length === 0) {
// wrapped with <></> to avoid react warning
// wrapped with <div /> to avoid react warning
// https://github.com/ant-design/ant-design/issues/25979
return (
<>
<div
style={{
margin: '16px 0',
}}
>
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={locale.filterEmptyText}
style={{
margin: '16px 0',
}}
imageStyle={{
height: 24,
}}
/>
</>
</div>
);
}
return filters.map((filter, index) => {

View File

@ -128,7 +128,7 @@
"rc-image": "~3.0.6",
"rc-input-number": "~6.0.0",
"rc-mentions": "~1.4.0",
"rc-menu": "~8.5.2",
"rc-menu": "~8.6.1",
"rc-motion": "^2.0.0",
"rc-notification": "~4.4.0",
"rc-pagination": "~3.0.3",