react-frame-component 5.2.2-alpha.0 → 5.2.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Frame.js +5 -5
- package/package.json +1 -1
package/lib/Frame.js
CHANGED
|
@@ -60,7 +60,10 @@ var Frame = exports.Frame = function (_Component) {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
_this.handleLoad = function () {
|
|
63
|
-
|
|
63
|
+
// Bail update as some browsers will trigger on both DOMContentLoaded & onLoad ala firefox
|
|
64
|
+
if (!_this.state.iframeLoaded) {
|
|
65
|
+
_this.setState({ iframeLoaded: true });
|
|
66
|
+
}
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
_this._isMounted = false;
|
|
@@ -75,9 +78,6 @@ var Frame = exports.Frame = function (_Component) {
|
|
|
75
78
|
this._isMounted = true;
|
|
76
79
|
|
|
77
80
|
var doc = this.getDoc();
|
|
78
|
-
if (doc && doc.readyState === 'complete') {
|
|
79
|
-
this.forceUpdate();
|
|
80
|
-
}
|
|
81
81
|
|
|
82
82
|
if (doc) {
|
|
83
83
|
this.nodeRef.current.contentWindow.addEventListener('DOMContentLoaded', this.handleLoad);
|
|
@@ -157,7 +157,7 @@ var Frame = exports.Frame = function (_Component) {
|
|
|
157
157
|
delete props.forwardedRef;
|
|
158
158
|
return _react2.default.createElement(
|
|
159
159
|
'iframe',
|
|
160
|
-
_extends({}, props, { ref: this.setRef }),
|
|
160
|
+
_extends({}, props, { ref: this.setRef, onLoad: this.handleLoad }),
|
|
161
161
|
this.state.iframeLoaded && this.renderFrameContents()
|
|
162
162
|
);
|
|
163
163
|
}
|
package/package.json
CHANGED