Skip to content

Commit

Permalink
Avoid swallowing children's ref property, if it's set. Fixes JedWatso…
Browse files Browse the repository at this point in the history
  • Loading branch information
raulrene committed Dec 21, 2017
1 parent 14500eb commit e1f3190
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Hammer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ export default class HammerComponent extends React.Component {
}, this);

var self = this;
props.ref = function(domElement) {
if (self.props.ref) {
props.ref = function (domElement) {
if (self.props.children && self.props.children.ref) {
// If the child has the ref set, call the child's ref method
self.props.children.ref(domElement);
} else if (self.props.ref) {
self.props.ref(domElement);
}
self.domElement = domElement;
Expand Down

0 comments on commit e1f3190

Please sign in to comment.