Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1x 1x 2x 1x 2x | import React from "react"; import onClickOutSide from "react-onclickoutside"; export function withOutsideClick(methodName?: string) { return <C extends React.ComponentType<any>>(WrappedComponent: C): C => { const Component = onClickOutSide(WrappedComponent, { handleClickOutside: instance => instance[methodName], }); return ((props => React.createElement(Component, { ...props, outsideClickIgnoreClass: "ignore-outside-click", })) as any) as C; }; } |