Skip to content

Commit

Permalink
Merge pull request #36 from yahoo/checkcomponent
Browse files Browse the repository at this point in the history
check component before detect viewport
  • Loading branch information
kaesonho committed Jul 30, 2015
2 parents 3a5d9fe + ca8e414 commit 5b40e59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mixins/I13nMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var I13nMixin = {
if (!this._getReactI13n()) {
return;
}
clearTimeout(pageInitViewportDetectionTimeout);
this._createI13nNode();
this._i13nNode.setReactComponent(this);
},
Expand Down Expand Up @@ -306,7 +307,10 @@ var I13nMixin = {
self._detectViewport(function detectCallback () {
if (self._i13nNode.isInViewport()) {
self._i13nNode.getChildrenNodes().forEach(function detectChildrenViewport (childNode) {
childNode.getReactComponent()._recursiveDetectViewport();
var reactComponent = childNode.getReactComponent();
if (reactComponent) {
reactComponent._recursiveDetectViewport();
}
});
}
});
Expand Down

0 comments on commit 5b40e59

Please sign in to comment.