Skip to content

Commit

Permalink
Fix child's ref
Browse files Browse the repository at this point in the history
current behavior overrides the child's ref. [Read this](facebook/react#8873 (comment)) for more info.
  • Loading branch information
goldylucks authored Apr 3, 2018
1 parent 7c85c47 commit 7ec9e51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ class InputTrigger extends Component {
? (
React.Children.map(this.props.children, child => (
React.cloneElement(child, {
ref: (element) => { this.element = element; },
ref: (element) => {
this.element = element;
if (typeof child.ref === 'function') {
child.ref(element);
}
},
})
))
)
Expand Down

0 comments on commit 7ec9e51

Please sign in to comment.