Skip to content

Commit a139e00

Browse files
goldylucksabinavseelan
authored andcommitted
Maintain ref prop to child (#2)
1 parent d63c7c2 commit a139e00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ class InputTrigger extends Component {
131131
? (
132132
React.Children.map(this.props.children, child => (
133133
React.cloneElement(child, {
134-
ref: (element) => { this.element = element; },
134+
ref: (element) => {
135+
this.element = element;
136+
if (typeof child.ref === 'function') {
137+
child.ref(element);
138+
}
139+
},
135140
})
136141
))
137142
)

0 commit comments

Comments
 (0)