Skip to content

Commit f20d343

Browse files
Merge pull request #277 from cleandart/testing-react-17-rc
CPLAT-12469 Update to React 17
2 parents 9d46ae5 + 2978197 commit f20d343

24 files changed

+14890
-9176
lines changed

js_src/_dart_helpers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ function _createReactDartComponentClass2(dartInteropStatics, componentStatics, j
131131
return typeof derivedState !== 'undefined' ? derivedState : null;
132132
}
133133
render() {
134+
// Must call checkPropTypes manually because React moved away from using the `prop-types` package.
135+
// See: https://github.com/facebook/react/pull/18127
136+
// React now uses its own internal cache of errors for PropTypes which broke `PropTypes.resetWarningCache()`.
137+
// Solution was to use `PropTypes.checkPropTypes` directly which makes `PropTypes.resetWarningCache()` work.
138+
// Solution from: https://github.com/facebook/react/issues/18251#issuecomment-609024557
139+
if (process.env.NODE_ENV !== 'production') {
140+
React.PropTypes.checkPropTypes(jsConfig.propTypes, this.props, 'prop', ReactDartComponent2.displayName);
141+
}
134142
var result = dartInteropStatics.handleRender(this.dartComponent, this.props, this.state, this.context);
135143
if (typeof result === 'undefined') result = null;
136144
return result;
@@ -153,9 +161,6 @@ function _createReactDartComponentClass2(dartInteropStatics, componentStatics, j
153161
if (jsConfig.defaultProps) {
154162
ReactDartComponent2.defaultProps = jsConfig.defaultProps;
155163
}
156-
if (jsConfig.propTypes) {
157-
ReactDartComponent2.propTypes = jsConfig.propTypes;
158-
}
159164
}
160165

161166
return ReactDartComponent2;

lib/react.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,26 +2780,3 @@ _createDOMComponents(creator) {
27802780
view = creator('view');
27812781
vkern = creator('vkern');
27822782
}
2783-
2784-
/// Set configuration based on functions provided as arguments.
2785-
///
2786-
/// The arguments are assigned to global variables, and React DOM `Component`s are created by calling
2787-
/// [_createDOMComponents] with [domCreator].
2788-
///
2789-
/// > __DEPRECATED.__
2790-
/// >
2791-
/// > Environment configuration is now done by default and should not be altered. This can now be removed.
2792-
/// > This will be removed in 6.0.0, along with other configuration setting functions.
2793-
@Deprecated(
2794-
'Environment configuration is now done by default. You can remove this. Will be removed from this library in the 6.0.0 release.')
2795-
void setReactConfiguration(
2796-
domCreator,
2797-
customRegisterComponent, {
2798-
ComponentRegistrar2 customRegisterComponent2,
2799-
FunctionComponentRegistrar customRegisterFunctionComponent,
2800-
}) {
2801-
registerComponent = customRegisterComponent;
2802-
registerComponent2 = customRegisterComponent2;
2803-
// HTML Elements
2804-
_createDOMComponents(domCreator);
2805-
}

0 commit comments

Comments
 (0)