fix: fix dialog does not appear (#2134)
This commit is contained in:
parent
516fe408b9
commit
08a9398a19
@ -28,7 +28,6 @@ import React, {
|
|||||||
useMemo,
|
useMemo,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
useTransition as useReactTransition,
|
useTransition as useReactTransition,
|
||||||
useRef,
|
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
@ -148,7 +147,6 @@ export const SchemaSettings: React.FC<SchemaSettingsProps> & SchemaSettingsNeste
|
|||||||
const { title, dn, ...others } = props;
|
const { title, dn, ...others } = props;
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const { Component, getMenuItems } = useMenuItem();
|
const { Component, getMenuItems } = useMenuItem();
|
||||||
const menuItems = useRef([]);
|
|
||||||
const [isPending, startTransition] = useReactTransition();
|
const [isPending, startTransition] = useReactTransition();
|
||||||
|
|
||||||
const changeMenu = (v: boolean) => {
|
const changeMenu = (v: boolean) => {
|
||||||
@ -157,19 +155,17 @@ export const SchemaSettings: React.FC<SchemaSettingsProps> & SchemaSettingsNeste
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (visible) {
|
const items = getMenuItems(() => props.children);
|
||||||
menuItems.current = getMenuItems(() => props.children);
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropdownMenu = () => (
|
const dropdownMenu = () => (
|
||||||
<>
|
<>
|
||||||
{visible ? <Component /> : null}
|
<Component />
|
||||||
<Dropdown
|
<Dropdown
|
||||||
open={visible}
|
open={visible}
|
||||||
onOpenChange={() => {
|
onOpenChange={() => {
|
||||||
changeMenu(!visible);
|
changeMenu(!visible);
|
||||||
}}
|
}}
|
||||||
menu={{ items: menuItems.current, className: classNames({ [hidden]: !visible }) }}
|
menu={{ items, className: classNames({ [hidden]: !visible }) }}
|
||||||
overlayClassName={overlayClassName}
|
overlayClassName={overlayClassName}
|
||||||
>
|
>
|
||||||
{typeof title === 'string' ? <span>{title}</span> : title}
|
{typeof title === 'string' ? <span>{title}</span> : title}
|
||||||
|
Loading…
Reference in New Issue
Block a user