From fc1770921310ecda49358797cbad5e87be7809e1 Mon Sep 17 00:00:00 2001 From: Adam Gleitman Date: Tue, 24 May 2022 16:47:28 -0700 Subject: [PATCH] Use deprecated-react-native-prop-types v2.3.0 --- Libraries/Animated/AnimatedMock.js | 3 +- Libraries/Components/TextInput/TextInput.js | 6 +-- Libraries/Image/Image.android.js | 10 ++-- Libraries/Image/Image.ios.js | 12 ++--- Libraries/Text/Text.js | 10 ++-- index.js | 26 +++------ package.json | 1 + packages/rn-tester/Podfile.lock | 58 ++++++++++----------- repo-config/package.json | 1 + yarn.lock | 13 ++++- 10 files changed, 68 insertions(+), 72 deletions(-) diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index fda962ab58..fc0238e039 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -99,7 +99,8 @@ const spring = function( // [TODO(macOS GH#774) - setValue can't handle AnimatedNodes if (config.toValue instanceof AnimatedNode) { anyValue.setValue(config.toValue.__getValue()); - } else { // ]TODO(macOS GH#774) + } else { + // ]TODO(macOS GH#774) anyValue.setValue(config.toValue); } callback?.({finished: true}); diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 4096db0496..ab62f6040d 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -10,9 +10,6 @@ import * as React from 'react'; -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -import DeprecatedTextInputPropTypes from '../../DeprecatedPropTypes/DeprecatedTextInputPropTypes'; - import Platform from '../../Utilities/Platform'; import StyleSheet, { type TextStyleProp, @@ -1281,8 +1278,7 @@ const ExportedForwardRef: React.AbstractComponent< ); }); -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -ExportedForwardRef.propTypes = DeprecatedTextInputPropTypes; +ExportedForwardRef.propTypes = require('deprecated-react-native-prop-types').TextInputPropTypes; // $FlowFixMe[prop-missing] ExportedForwardRef.State = { diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 5cd45028f3..935064389f 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -8,9 +8,6 @@ * @format */ -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -import DeprecatedImagePropType from '../DeprecatedPropTypes/DeprecatedImagePropType'; - import ImageViewNativeComponent from './ImageViewNativeComponent'; import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -300,8 +297,11 @@ Image.queryCache = queryCache; * comment and run Flow. */ Image.resolveAssetSource = resolveAssetSource; -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -Image.propTypes = DeprecatedImagePropType; +/** + * 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: { diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 891030b5b0..56cc897b53 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -8,9 +8,6 @@ * @format */ -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -import DeprecatedImagePropType from '../DeprecatedPropTypes/DeprecatedImagePropType'; - import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -96,8 +93,6 @@ type ImageComponentStatics = $ReadOnly<{| prefetchWithMetadata: typeof prefetchWithMetadata, queryCache: typeof queryCache, resolveAssetSource: typeof resolveAssetSource, - // TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types - propTypes: typeof DeprecatedImagePropType, |}>; /** @@ -240,8 +235,11 @@ Image.queryCache = queryCache; * delete this comment and run Flow. */ Image.resolveAssetSource = resolveAssetSource; -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -Image.propTypes = DeprecatedImagePropType; +/** + * 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: { diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 4ed6095ddb..22474f0711 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -8,9 +8,6 @@ * @format */ -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -import DeprecatedTextPropTypes from '../DeprecatedPropTypes/DeprecatedTextPropTypes'; - import * as PressabilityDebug from '../Pressability/PressabilityDebug'; import usePressability from '../Pressability/usePressability'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -190,8 +187,11 @@ const Text: React.AbstractComponent< Text.displayName = 'Text'; -// TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -Text.propTypes = DeprecatedTextPropTypes; +/** + * 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 diff --git a/index.js b/index.js index fa643c046b..afa133a18b 100644 --- a/index.js +++ b/index.js @@ -103,14 +103,6 @@ import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; import type {HostComponent as _HostComponentInternal} from './Libraries/Renderer/shims/ReactNativeTypes'; -// Deprecated Prop Types -// [TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types -import typeof DeprecatedColorPropType from './Libraries/DeprecatedPropTypes/DeprecatedColorPropType'; -import typeof DeprecatedEdgeInsetsPropType from './Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'; -import typeof DeprecatedPointPropType from './Libraries/DeprecatedPropTypes/DeprecatedPointPropType'; -import typeof DeprecatedViewPropTypes from './Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes'; -// ]TODO(macOS GH#774) - export type HostComponent = _HostComponentInternal; const invariant = require('invariant'); @@ -488,35 +480,33 @@ module.exports = { ); }, // Deprecated Prop Types - // [TODO(macOS GH#774) - Keep this here because deprecated-react-native-prop-types doesn't support macOS types - // $FlowFixMe[value-as-type] - get ColorPropType(): DeprecatedColorPropType { + get ColorPropType(): $FlowFixMe { console.warn( 'ColorPropType will be removed from React Native. Migrate to ' + "ColorPropType exported from 'deprecated-react-native-prop-types'.", ); - return require('./Libraries/DeprecatedPropTypes/DeprecatedColorPropType'); + return require('deprecated-react-native-prop-types').ColorPropType; }, - get EdgeInsetsPropType(): DeprecatedEdgeInsetsPropType { + get EdgeInsetsPropType(): $FlowFixMe { console.warn( 'EdgeInsetsPropType will be removed from React Native. Migrate to ' + "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.", ); - return require('./Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'); + return require('deprecated-react-native-prop-types').EdgeInsetsPropType; }, - get PointPropType(): DeprecatedPointPropType { + get PointPropType(): $FlowFixMe { console.warn( 'PointPropType will be removed from React Native. Migrate to ' + "PointPropType exported from 'deprecated-react-native-prop-types'.", ); - return require('./Libraries/DeprecatedPropTypes/DeprecatedPointPropType'); + return require('deprecated-react-native-prop-types').PointPropType; }, - get ViewPropTypes(): DeprecatedViewPropTypes { + get ViewPropTypes(): $FlowFixMe { console.warn( 'ViewPropTypes will be removed from React Native. Migrate to ' + "ViewPropTypes exported from 'deprecated-react-native-prop-types'.", ); - return require('./Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes'); + return require('deprecated-react-native-prop-types').ViewPropTypes; }, // ]TODO(macOS GH#774) }; diff --git a/package.json b/package.json index 59fd5879b9..8946077863 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,7 @@ "abort-controller": "^3.0.0", "anser": "^1.4.9", "base64-js": "^1.1.2", + "deprecated-react-native-prop-types": "^2.3.0", "event-target-shim": "^5.0.1", "hermes-engine": "~0.9.0", "invariant": "^2.2.4", diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index 2c162ca43a..009547a8dd 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -562,8 +562,8 @@ SPEC CHECKSUMS: boost-for-react-native: 8f7c9ecfe357664c072ffbe2432569667cbf1f1b CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: ed15e075aa758ac0e4c1f8b830bd4e4d40d669e8 - FBLazyVector: 276eec1fcd2dc0fbbe7a0c45dff5064fea4909bf - FBReactNativeSpec: 426322e85a12b352a5fbf9d445607e5883c7e997 + FBLazyVector: c63512995e1826959137cc42d2af1ffff1940be6 + FBReactNativeSpec: eb46d44abd4a528d9162d56f4b352bb897adf60a Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c @@ -578,36 +578,36 @@ SPEC CHECKSUMS: libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b RCT-Folly: 24c6da766832002a4a2aac5f79ee0ca50fbe8507 - RCTRequired: 73111c431287069e5f055cfd58776d342544d826 - RCTTypeSafety: cafc5f010b65f8d823ba483932f952505f068662 - React: ef1d395c85a60601e73bb653e7c61ab8ba771ec0 - React-callinvoker: a6b6e543dff6c91afd0275628d88fe01dd9e521e + RCTRequired: 2febca4f2f3813b8e9acdfcfd6ba6ef2414da249 + RCTTypeSafety: 8ef970e5a292c3a95234cb654e72a5645fbfb6a8 + React: 1a82f22109c239c016ad4009ef1956ba4ff01d29 + React-callinvoker: f65d0e5f3e5f530a8f63857724729b85582bd5d2 React-Codegen: d38a0a313dea0afe938532389685f81ce1c71d1d - React-Core: b202e5d8d9a95a8ee8f5bd6b84446f9613bae734 - React-CoreModules: 66381d42dbc483f79326bed2d47557b8a01ddece - React-cxxreact: 2ba9c91dcaac9d814dd7acbea52ae83381af621d - React-jsi: d872ef5f22faf7fde0ed30dff5da45e27db5b137 - React-jsiexecutor: f4cefbe536127b30f26cb60a83df935006726b3e - React-jsinspector: 7fd3d3e161c7cfefce9dad93761ff78286272524 - React-logger: 98ba5ce1b4dcab3662207d2f04826fcca58fdfcb - React-perflogger: 43a99852c6d4b003421b1f8b58c6c64155576af2 - React-RCTActionSheet: eb45587ec08fe63d15963e35a3f5bb52a96ae1e6 - React-RCTAnimation: ab98ca437a606f79e75b1c17e0357a6ceedecca5 - React-RCTBlob: 586427d5f5efa74228346e16030295ca2b4900bb - React-RCTImage: 5f7307ba88c623b495f5bf5c2c8d0ea981d7753c - React-RCTLinking: 09992ba742ca863ca641b2441013e46e1d2580a7 - React-RCTNetwork: 0c7136d41ec39605eab9b1a9401652f8b121f8f5 - React-RCTPushNotification: 4e95e489d6ff52068835d6956d1c08597a351d62 - React-RCTSettings: 6e9853c5ffe83bd11d0b52525a59c7a0c469458a - React-RCTTest: 9a94c0f3102d07f3b58bb505d49840fe15122ce3 - React-RCTText: e85bcce4f08ab7ec634b40fbc63217e3dbc71502 - React-RCTVibration: b003dadc62278a38c98795571c0489503c8a04c4 - React-runtimeexecutor: a3a9ae4df85541d74fef98578b2f6fe18c4bb694 + React-Core: 86baceca3a1509ad05ad264abe1fa7af1094851f + React-CoreModules: d4fa9fbc7cd3e1be85bed9c0bda5d186f7dec38e + React-cxxreact: d87d8dbbd3f3040c2044c63d85c8af8b9ae405a4 + React-jsi: 7c0674da6ff828941cd1eae7caa27acc47a4373b + React-jsiexecutor: 865c6feedac42c5d62e9e63b6e505e443207dd5e + React-jsinspector: ad9b1666e2df7607ce77349476788d0353c025eb + React-logger: 23e7eb350bd826d1a05f7b7c2c00a51cdc8664bd + React-perflogger: ad10243ec1f33a0168e465f5a55c95de4c91bb1d + React-RCTActionSheet: 596c01450b85fa16db8e3982515270a0d332896c + React-RCTAnimation: a16c8b13878b38f598137abe93b05e1bd88d71cd + React-RCTBlob: 1ef022fc4cc7f809b81fb17056bd515c1d7aca12 + React-RCTImage: 15e1790bf0ee0161154ac4544d17dac6641e8719 + React-RCTLinking: caee211821e4c43082d6d0e1ef9d5be1ef5e9e77 + React-RCTNetwork: ae9788ac229c1861b0b8fe20d0fb7a6c4b1ced10 + React-RCTPushNotification: c7123d1c82c934099e6aef2362f2dc908d5eac82 + React-RCTSettings: 17b2ad4cfbfeec009c215c7e06fc3b9fc8afbbd8 + React-RCTTest: b112259464b52f9c02f1bdd3082478e3d428aed5 + React-RCTText: 0b5f20d12c5977f303c7d09ddefdedf9257c50ce + React-RCTVibration: d5fa90fe5a68f085b4fb79f3650fb190c010f594 + React-runtimeexecutor: 3bbb66efa83a4c9e5ea85040c33ee8465facced9 React-TurboModuleCxx-RNW: f2e32cbfced49190a61d66c993a8975de79a158a - React-TurboModuleCxx-WinRTPort: b8d9de7360fa32cde885b4165e4da9d7474832aa - ReactCommon: 28b5f479b4e2ac46a7477bfc6e0515c046d288bf + React-TurboModuleCxx-WinRTPort: eca2c4f160a582e9d84ff7919862ed044583e27c + ReactCommon: 3fb86f9fb0a0811624425dadad42da023b4455fc ScreenshotManager: cbed2e311e2b1c414a23c67f16aff04f9c10a2c4 - Yoga: cc3246476edf5ac36b3efe98b2f9c90a9663bf46 + Yoga: 10eb6ba1e7227314e033ef7b71a4d1ef5a06315b YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: 31e2a6da8e5c70c540af7636baf1ae6d7707a1e0 diff --git a/repo-config/package.json b/repo-config/package.json index d413adb83b..8ac9c44451 100644 --- a/repo-config/package.json +++ b/repo-config/package.json @@ -21,6 +21,7 @@ "clang-format": "^1.2.4", "connect": "^3.6.5", "coveralls": "^3.0.2", + "deprecated-react-native-prop-types": "^2.3.0", "detox": "18.10.0", "eslint": "^7.32.0", "eslint-config-fb-strict": "^26.0.0", diff --git a/yarn.lock b/yarn.lock index c06bdbe6e7..5b8d122245 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2972,6 +2972,15 @@ 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@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-2.3.0.tgz#c10c6ee75ff2b6de94bb127f142b814e6e08d9ab" + integrity sha512-pWD0voFtNYxrVqvBMYf5gq3NA2GCpfodS1yNynTPc93AYA/KEMGeWDqqeUB6R2Z9ZofVhks2aeJXiuQqKNpesA== + dependencies: + "@react-native/normalize-color" "*" + invariant "*" + prop-types "*" + destroy@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" @@ -4446,7 +4455,7 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -invariant@^2.2.4: +invariant@*, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -6846,7 +6855,7 @@ prompts@~2.1.0: kleur "^3.0.2" sisteransi "^1.0.0" -prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@*, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==