UNPKG

duoyun-ui

Version:

A lightweight desktop UI component library, implemented using Gem

23 lines (22 loc) 797 B
import React from 'react'; import { forwardRef, useImperativeHandle, useRef, useLayoutEffect } from 'react'; export * from '../elements/popover'; export const DyPopover = forwardRef(function (props, ref) { const elementRef = useRef(null); useImperativeHandle(ref, () => { return { get popoverElement() { return elementRef.current.popoverElement; }, }; }, []); // React Bug? useLayoutEffect(() => { const element = elementRef.current; ["debug", "unreachable", "disabled", "trigger", "position", "content", "ghostStyle"].map(name => { element[name] = props[name]; }); }, []); return React.createElement("dy-popover", { ref: elementRef, ...props }); }); export default DyPopover;