-
-
Save dbilgili/a3020d67d8c23aab701cc9da9461a925 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vim: syntax=JSX | |
render(){ | |
const { children } = this.props | |
const { isOpen, style } = this.state | |
const inputChildren = React.Children.map(children, child => { | |
if(child.type.displayName === "Select"){ | |
return React.cloneElement(child, {open: this.open}) | |
} | |
else{ | |
return ( | |
isOpen && ReactDOM.createPortal( | |
<span style={style}>{React.cloneElement(child)}</span>, document.body | |
) | |
) | |
} | |
}) | |
return inputChildren | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment