amis
Version:
一种MIS页面生成工具
13 lines (10 loc) • 396 B
text/typescript
/**
* 兼容之前的 RootCloseWrapper 写法
*/
import React, {useState} from 'react';
import useRootClose from 'react-overlays/useRootClose';
export const RootClose = ({children, onRootClose, ...props}: any) => {
const [rootElement, attachRef] = useState(null);
useRootClose(rootElement, onRootClose, props);
return typeof children === 'function' ? children(attachRef) : children;
};