diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index 6bfe0301cceb7..e968482651e87 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -754,7 +754,7 @@ describe('ReactDOMInput', () => { ); expectDev(console.error.calls.count()).toBe(1); expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe( - 'Warning: Failed form propType: You provided a `value` prop to a form ' + + 'Warning: Failed prop type: You provided a `value` prop to a form ' + 'field without an `onChange` handler. This will render a read-only ' + 'field. If the field should be mutable use `defaultValue`. ' + 'Otherwise, set either `onChange` or `readOnly`.\n' + diff --git a/packages/react-dom/src/shared/ReactControlledValuePropTypes.js b/packages/react-dom/src/shared/ReactControlledValuePropTypes.js index 31cdbc46d2aa0..67230cf043e52 100644 --- a/packages/react-dom/src/shared/ReactControlledValuePropTypes.js +++ b/packages/react-dom/src/shared/ReactControlledValuePropTypes.js @@ -12,13 +12,8 @@ var ReactControlledValuePropTypes = { }; if (__DEV__) { - var warning = require('fbjs/lib/warning'); - var emptyFunction = require('fbjs/lib/emptyFunction'); - var PropTypes = require('prop-types'); + var checkPropTypes = require('prop-types/checkPropTypes'); - var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - - ReactControlledValuePropTypes.checkPropTypes = emptyFunction; var hasReadOnlyValue = { button: true, checkbox: true, @@ -63,11 +58,8 @@ if (__DEV__) { 'set either `onChange` or `readOnly`.', ); }, - onChange: PropTypes.func, }; - var loggedTypeFailures = {}; - /** * Provide a linked `value` attribute for controlled forms. You should not use * this outside of the ReactDOM controlled form components. @@ -77,25 +69,7 @@ if (__DEV__) { props, getStack, ) { - for (var propName in propTypes) { - if (propTypes.hasOwnProperty(propName)) { - var error = propTypes[propName]( - props, - propName, - tagName, - 'prop', - null, - ReactPropTypesSecret, - ); - } - if (error instanceof Error && !(error.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error.message] = true; - - warning(false, 'Failed form propType: %s%s', error.message, getStack()); - } - } + checkPropTypes(propTypes, props, 'prop', tagName, getStack); }; } diff --git a/scripts/rollup/results.json b/scripts/rollup/results.json index 8e76bc270dee6..6b00064111b62 100644 --- a/scripts/rollup/results.json +++ b/scripts/rollup/results.json @@ -25,24 +25,24 @@ "gzip": 6776 }, "react-dom.development.js (UMD_DEV)": { - "size": 629993, - "gzip": 144537 + "size": 609118, + "gzip": 139930 }, "react-dom.production.min.js (UMD_PROD)": { "size": 101759, "gzip": 31837 }, "react-dom.development.js (NODE_DEV)": { - "size": 594328, - "gzip": 136213 + "size": 593556, + "gzip": 135968 }, "react-dom.production.min.js (NODE_PROD)": { "size": 107772, "gzip": 33333 }, "ReactDOM-dev.js (FB_DEV)": { - "size": 594288, - "gzip": 136503 + "size": 593516, + "gzip": 136258 }, "ReactDOM-prod.js (FB_PROD)": { "size": 422865, @@ -85,32 +85,32 @@ "gzip": 15630 }, "react-dom-server.browser.development.js (UMD_DEV)": { - "size": 126953, - "gzip": 32659 + "size": 106084, + "gzip": 27905 }, "react-dom-server.browser.production.min.js (UMD_PROD)": { "size": 15612, "gzip": 6067 }, "react-dom-server.browser.development.js (NODE_DEV)": { - "size": 96840, - "gzip": 25434 + "size": 96070, + "gzip": 25231 }, "react-dom-server.browser.production.min.js (NODE_PROD)": { "size": 15340, "gzip": 5985 }, "ReactDOMServer-dev.js (FB_DEV)": { - "size": 96316, - "gzip": 25374 + "size": 95546, + "gzip": 25176 }, "ReactDOMServer-prod.js (FB_PROD)": { "size": 43775, "gzip": 12037 }, "react-dom-server.node.development.js (NODE_DEV)": { - "size": 99113, - "gzip": 25973 + "size": 98343, + "gzip": 25770 }, "react-dom-server.node.production.min.js (NODE_PROD)": { "size": 16264,