ResizeSensor
Summary: _typescript_ Reviewed By: danielbuechele Differential Revision: D17181422 fbshipit-source-id: 73b802ac339c7f7e474c9ee8f13b6aaa50884c97
This commit is contained in:
committed by
Facebook Github Bot
parent
d7e3514d9b
commit
158f7cba33
@@ -39,14 +39,14 @@ export default class ResizeSensor extends Component<{
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const {iframe} = this;
|
const {iframe} = this;
|
||||||
if (iframe != null) {
|
if (iframe != null && iframe.contentWindow != null) {
|
||||||
iframe.contentWindow.addEventListener('resize', this.handleResize);
|
iframe.contentWindow.addEventListener('resize', this.handleResize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const {iframe} = this;
|
const {iframe} = this;
|
||||||
if (iframe != null) {
|
if (iframe != null && iframe.contentWindow != null) {
|
||||||
iframe.contentWindow.removeEventListener('resize', this.handleResize);
|
iframe.contentWindow.removeEventListener('resize', this.handleResize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user