Commit 85be971f authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/Branded' into 'main'

optimize NeosModal

See merge request mycard/Neos!337
parents 2e26ecf6 5d60f0c9
......@@ -3,6 +3,8 @@ import { Modal, type ModalProps } from "antd";
import classNames from "classnames";
import { useEffect, useState } from "react";
import { sleep } from "@/infra";
import styles from "./index.module.scss";
export const NeosModal: React.FC<ModalProps> = (props) => {
......@@ -11,9 +13,15 @@ export const NeosModal: React.FC<ModalProps> = (props) => {
// 为了修antd的bug,先让isOpen发生变化,同时设置visibility为`hidden`,再让它变回来
const [realOpen, setRealOpen] = useState(true);
const [hidden, setHidden] = useState(true);
useEffect(() => {
const close = async () => {
setRealOpen(false);
await sleep(1000);
setHidden(false);
};
useEffect(() => {
close();
}, []);
useEffect(() => setRealOpen(!!props.open), [props.open]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment