react-height
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -33,3 +33,4 @@ 'use strict'; | ||
componentWillMount: function componentWillMount() { | ||
this.height = -1; | ||
this.height = 0; | ||
this.dirty = true; | ||
}, | ||
@@ -39,6 +40,5 @@ | ||
this.height = this.refs.wrapper.clientHeight; | ||
if (this.height > -1) { | ||
this.forceUpdate(); | ||
return this.props.onHeightReady(this.height); | ||
} | ||
this.dirty = false; | ||
this.forceUpdate(); | ||
this.props.onHeightReady(this.height); | ||
}, | ||
@@ -50,3 +50,3 @@ | ||
if (children !== this.props.children) { | ||
this.height = -1; | ||
this.dirty = true; | ||
} | ||
@@ -59,7 +59,11 @@ }, | ||
if (this.refs.wrapper) { | ||
this.dirty = false; | ||
if (this.refs.wrapper.clientHeight !== this.height) { | ||
this.height = this.refs.wrapper.clientHeight; | ||
this.forceUpdate(); | ||
this.props.onHeightReady(this.height); | ||
} else { | ||
this.forceUpdate(); | ||
} | ||
this.forceUpdate(); | ||
} | ||
@@ -76,3 +80,3 @@ }, | ||
if (this.height > -1) { | ||
if (!this.dirty) { | ||
return hidden ? null : _react2['default'].createElement( | ||
@@ -79,0 +83,0 @@ 'div', |
{ | ||
"name": "react-height", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Component-wrapper to determine and report children elements height", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -19,3 +19,4 @@ import React from 'react'; | ||
componentWillMount() { | ||
this.height = -1; | ||
this.height = 0; | ||
this.dirty = true; | ||
}, | ||
@@ -26,6 +27,5 @@ | ||
this.height = this.refs.wrapper.clientHeight; | ||
if (this.height > -1) { | ||
this.forceUpdate(); | ||
return this.props.onHeightReady(this.height); | ||
} | ||
this.dirty = false; | ||
this.forceUpdate(); | ||
this.props.onHeightReady(this.height); | ||
}, | ||
@@ -36,3 +36,3 @@ | ||
if (children !== this.props.children) { | ||
this.height = -1; | ||
this.dirty = true; | ||
} | ||
@@ -47,7 +47,11 @@ }, | ||
if (this.refs.wrapper) { | ||
this.dirty = false; | ||
if (this.refs.wrapper.clientHeight !== this.height) { | ||
this.height = this.refs.wrapper.clientHeight; | ||
this.forceUpdate(); | ||
this.props.onHeightReady(this.height); | ||
} else { | ||
this.forceUpdate(); | ||
} | ||
this.forceUpdate(); | ||
} | ||
@@ -60,3 +64,3 @@ }, | ||
if (this.height > -1) { | ||
if (!this.dirty) { | ||
return hidden ? null : <div {...props}>{children}</div>; | ||
@@ -63,0 +67,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14982
138