From 228cb80af9ded20107f3c7a30ffe00e24471bfeb Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Wed, 20 Dec 2023 16:31:37 -0800 Subject: [PATCH] RN: Remove Deprecated Prop Types (#42019) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42019 Removes the following deprecated properties from React Native: - `Image.propTypes` - `Text.propTypes` - `TextInput.propTypes` - `ColorPropType` - `EdgeInsetsPropType` - `PointPropType` - `ViewPropTypes` The deprecation history for these prop types is not super obvious, so here is a summary: - `react@15.5` extracted `prop-types` into a separate package to reflect that not everybody uses them. - `react-native@0.68` added a deprecation warning to built-in prop types. (https://github.com/facebook/react-native/commit/3f629049ba9773793978cf9093c7a71af15e3e8d) - `react-native@0.69` removed built-in prop types. (https://github.com/facebook/react-native/commit/3e229f27bc9c7556876ff776abf70147289d544b) - `react-native@0.71` restored built-in prop types, along with bug fixes to isolate deprecated usage. (https://github.com/facebook/react-native/commit/b966d297245a4c1e2c744cfe571396cfa7e5ffd3) We believe that by the next public release, enough time will have passed for the community to be able to upgrade without patching React Native or otherwise working around the removal of these deprecated prop types. **If anyone has trouble identifying the source of a deleted prop types usage, please file an issue so we can help track it down with you.** Changelog: [General][Removed] - Removed deprecated prop types Reviewed By: lunaleaps, NickGerleman Differential Revision: D52337762 fbshipit-source-id: 9731f7e1dec29f3df535ab75cc50bed001fdfa0b --- .circleci/verdaccio.yml | 5 --- .../Components/TextInput/TextInput.js | 7 ---- .../Libraries/Image/Image.android.js | 6 --- .../react-native/Libraries/Image/Image.ios.js | 6 --- packages/react-native/Libraries/Text/Text.js | 6 --- packages/react-native/index.js | 41 ------------------- packages/react-native/package.json | 1 - yarn.lock | 14 ------- 8 files changed, 86 deletions(-) diff --git a/.circleci/verdaccio.yml b/.circleci/verdaccio.yml index c6eabda697e..cec3a220475 100644 --- a/.circleci/verdaccio.yml +++ b/.circleci/verdaccio.yml @@ -15,11 +15,6 @@ uplinks: maxSockets: 40 maxFreeSockets: 10 packages: - # Get @react-native/normalize-colors from npm registry, since its used in deprecated-react-native-prop-types package - '@react-native/normalize-colors': - access: $all - publish: $authenticated - proxy: npmjs # Group and isolate all local packages, avoid being proxy from outside '@react-native/*': access: $all diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index f9474401dbc..7b522fe5dcb 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -1752,13 +1752,6 @@ const ExportedForwardRef: React.AbstractComponent< ExportedForwardRef.displayName = 'TextInput'; -/** - * Switch to `deprecated-react-native-prop-types` for compatibility with future - * releases. This is deprecated and will be removed in the future. - */ -ExportedForwardRef.propTypes = - require('deprecated-react-native-prop-types').TextInputPropTypes; - // $FlowFixMe[prop-missing] ExportedForwardRef.State = { currentlyFocusedInput: TextInputState.currentlyFocusedInput, diff --git a/packages/react-native/Libraries/Image/Image.android.js b/packages/react-native/Libraries/Image/Image.android.js index e5c5d9f223b..ac8660e968e 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -312,12 +312,6 @@ Image.queryCache = queryCache; // $FlowFixMe[incompatible-use] This property isn't writable but we're actually defining it here for the first time. Image.resolveAssetSource = resolveAssetSource; -/** - * Switch to `deprecated-react-native-prop-types` for compatibility with future - * releases. This is deprecated and will be removed in the future. - */ -Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes; - const styles = StyleSheet.create({ base: { overflow: 'hidden', diff --git a/packages/react-native/Libraries/Image/Image.ios.js b/packages/react-native/Libraries/Image/Image.ios.js index ce21b5b4edf..9ba060e16a9 100644 --- a/packages/react-native/Libraries/Image/Image.ios.js +++ b/packages/react-native/Libraries/Image/Image.ios.js @@ -246,12 +246,6 @@ Image.queryCache = queryCache; // $FlowFixMe[incompatible-use] This property isn't writable but we're actually defining it here for the first time. Image.resolveAssetSource = resolveAssetSource; -/** - * Switch to `deprecated-react-native-prop-types` for compatibility with future - * releases. This is deprecated and will be removed in the future. - */ -Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes; - const styles = StyleSheet.create({ base: { overflow: 'hidden', diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index d737cccbbf9..5ccceefc346 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -286,12 +286,6 @@ const Text: React.AbstractComponent< Text.displayName = 'Text'; -/** - * Switch to `deprecated-react-native-prop-types` for compatibility with future - * releases. This is deprecated and will be removed in the future. - */ -Text.propTypes = require('deprecated-react-native-prop-types').TextPropTypes; - /** * Returns false until the first time `newValue` is true, after which this will * always return true. This is necessary to lazily initialize `Pressability` so diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 3e0a2396cff..7cd220bc075 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -375,47 +375,6 @@ module.exports = { 'LogBox is enabled by default so there is no need to call unstable_enableLogBox() anymore. This is a no op and will be removed in the next version.', ); }, - // Deprecated Prop Types - get ColorPropType(): $FlowFixMe { - console.error( - 'ColorPropType will be removed from React Native, along with all ' + - 'other PropTypes. We recommend that you migrate away from PropTypes ' + - 'and switch to a type system like TypeScript. If you need to ' + - 'continue using ColorPropType, migrate to the ' + - "'deprecated-react-native-prop-types' package.", - ); - return require('deprecated-react-native-prop-types').ColorPropType; - }, - get EdgeInsetsPropType(): $FlowFixMe { - console.error( - 'EdgeInsetsPropType will be removed from React Native, along with all ' + - 'other PropTypes. We recommend that you migrate away from PropTypes ' + - 'and switch to a type system like TypeScript. If you need to ' + - 'continue using EdgeInsetsPropType, migrate to the ' + - "'deprecated-react-native-prop-types' package.", - ); - return require('deprecated-react-native-prop-types').EdgeInsetsPropType; - }, - get PointPropType(): $FlowFixMe { - console.error( - 'PointPropType will be removed from React Native, along with all ' + - 'other PropTypes. We recommend that you migrate away from PropTypes ' + - 'and switch to a type system like TypeScript. If you need to ' + - 'continue using PointPropType, migrate to the ' + - "'deprecated-react-native-prop-types' package.", - ); - return require('deprecated-react-native-prop-types').PointPropType; - }, - get ViewPropTypes(): $FlowFixMe { - console.error( - 'ViewPropTypes will be removed from React Native, along with all ' + - 'other PropTypes. We recommend that you migrate away from PropTypes ' + - 'and switch to a type system like TypeScript. If you need to ' + - 'continue using ViewPropTypes, migrate to the ' + - "'deprecated-react-native-prop-types' package.", - ); - return require('deprecated-react-native-prop-types').ViewPropTypes; - }, }; if (__DEV__) { diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 2e80fbea17d..f43e512be94 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -109,7 +109,6 @@ "anser": "^1.4.9", "ansi-regex": "^5.0.0", "base64-js": "^1.5.1", - "deprecated-react-native-prop-types": "^5.0.0", "event-target-shim": "^5.0.1", "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", diff --git a/yarn.lock b/yarn.lock index a0d56fd011b..1527c55a55b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2537,11 +2537,6 @@ prompts "^2.4.2" semver "^7.5.2" -"@react-native/normalize-colors@^0.73.0": - version "0.73.2" - resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.73.2.tgz#cc8e48fbae2bbfff53e12f209369e8d2e4cf34ec" - integrity sha512-bRBcb2T+I88aG74LMVHaKms2p/T8aQd8+BZ7LuuzXlRfog1bMWWn/C5i0HVuvW4RPtXQYgIlGiXVDy9Ir1So/w== - "@rnx-kit/chromium-edge-launcher@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@rnx-kit/chromium-edge-launcher/-/chromium-edge-launcher-1.0.0.tgz#c0df8ea00a902c7a417cd9655aab06de398b939c" @@ -4333,15 +4328,6 @@ depd@2.0.0: resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== -deprecated-react-native-prop-types@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-5.0.0.tgz#02a12f090da7bd9e8c3ac53c31cf786a1315d302" - integrity sha512-cIK8KYiiGVOFsKdPMmm1L3tA/Gl+JopXL6F5+C7x39MyPsQYnP57Im/D6bNUzcborD7fcMwiwZqcBdBXXZucYQ== - dependencies: - "@react-native/normalize-colors" "^0.73.0" - invariant "^2.2.4" - prop-types "^15.8.1" - deprecation@^2.0.0, deprecation@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919"