Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions js_src/_dart_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ function _createReactDartComponentClass2(dartInteropStatics, componentStatics, j
return typeof derivedState !== 'undefined' ? derivedState : null;
}
render() {
// Must call checkPropTypes manually because React moved away from using the `prop-types` package.
// See: https://github.com/facebook/react/pull/18127
// React now uses its own internal cache of errors for PropTypes which broke `PropTypes.resetWarningCache()`.
// Solution was to use `PropTypes.checkPropTypes` directly which makes `PropTypes.resetWarningCache()` work.
// Solution from: https://github.com/facebook/react/issues/18251#issuecomment-609024557
if (process.env.NODE_ENV !== 'production') {
React.PropTypes.checkPropTypes(jsConfig.propTypes, this.props, 'prop', ReactDartComponent2.displayName);
}
var result = dartInteropStatics.handleRender(this.dartComponent, this.props, this.state, this.context);
if (typeof result === 'undefined') result = null;
return result;
Expand All @@ -153,9 +161,6 @@ function _createReactDartComponentClass2(dartInteropStatics, componentStatics, j
if (jsConfig.defaultProps) {
ReactDartComponent2.defaultProps = jsConfig.defaultProps;
}
if (jsConfig.propTypes) {
ReactDartComponent2.propTypes = jsConfig.propTypes;
}
}

return ReactDartComponent2;
Expand Down
Loading