From 23717c6381a41b1c5f189376bfa5bc73c7a4da87 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Thu, 20 Jan 2022 18:15:29 -0800 Subject: [PATCH] RN: Remove DeprecatedPropTypes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Removes all of the `DeprecatedPropTypes` modules from React Native. Any call sites that were deep-linking to these modules and still requires them can instead import them from the `deprecated-react-native-prop-types` package. Since this also removes the last reference to `prop-types`, this diff also removes the `prop-types` dependency from `react-native`. 🥳 Changelog: [General][Removed] DeprecatedPropTypes (deep-link) modules removed from React Native. Reviewed By: kacieb Differential Revision: D33671645 fbshipit-source-id: 91829a556b272bbd17ee94806fc548af753593db --- BUCK | 1 - .../DeprecatedColorPropType.js | 76 -- .../DeprecatedEdgeInsetsPropType.js | 28 - .../DeprecatedImagePropType.android.js | 131 ---- .../DeprecatedImagePropType.ios.js | 82 --- .../DeprecatedImageSourcePropType.js | 40 - .../DeprecatedImageStylePropTypes.js | 76 -- .../DeprecatedLayoutPropTypes.js | 233 ------ .../DeprecatedPointPropType.js | 24 - .../DeprecatedShadowPropTypesIOS.js | 30 - .../DeprecatedStyleSheetPropType.js | 32 - .../DeprecatedTextInputPropTypes.js | 693 ------------------ .../DeprecatedTextPropTypes.js | 158 ---- .../DeprecatedTextStylePropTypes.js | 157 ---- .../DeprecatedTransformPropTypes.js | 99 --- .../DeprecatedViewAccessibility.js | 46 -- .../DeprecatedViewPropTypes.js | 408 ----------- .../DeprecatedViewStylePropTypes.js | 68 -- .../deprecatedCreateStrictShapeTypeChecker.js | 86 --- flow-typed/npm/prop-types_v15.x.x.js | 42 -- package.json | 1 - 21 files changed, 2511 deletions(-) delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js delete mode 100644 Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js delete mode 100644 flow-typed/npm/prop-types_v15.x.x.js diff --git a/BUCK b/BUCK index 68be1a87d9cfe2..b9d639adff92ee 100644 --- a/BUCK +++ b/BUCK @@ -729,7 +729,6 @@ rn_library( "//xplat/js:node_modules__nullthrows", "//xplat/js:node_modules__pretty_19format", "//xplat/js:node_modules__promise", - "//xplat/js:node_modules__prop_19types", "//xplat/js:node_modules__react_19devtools_19core", "//xplat/js:node_modules__react_19refresh", "//xplat/js:node_modules__react_19shallow_19renderer", diff --git a/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js deleted file mode 100644 index 8765a9b622d1a8..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const normalizeColor = require('../StyleSheet/normalizeColor'); - -const colorPropType = function ( - isRequired, - props, - propName, - componentName, - location, - propFullName, -) { - const color = props[propName]; - if (color === undefined || color === null) { - if (isRequired) { - return new Error( - 'Required ' + - location + - ' `' + - (propFullName || propName) + - '` was not specified in `' + - componentName + - '`.', - ); - } - return; - } - - if (typeof color === 'number') { - // Developers should not use a number, but we are using the prop type - // both for user provided colors and for transformed ones. This isn't ideal - // and should be fixed but will do for now... - return; - } - - if (normalizeColor(color) === null) { - return new Error( - 'Invalid ' + - location + - ' `' + - (propFullName || propName) + - '` supplied to `' + - componentName + - '`: ' + - color + - '\n' + - `Valid color formats are - - '#f0f' (#rgb) - - '#f0fc' (#rgba) - - '#ff00ff' (#rrggbb) - - '#ff00ff00' (#rrggbbaa) - - 'rgb(255, 255, 255)' - - 'rgba(255, 255, 255, 1.0)' - - 'hsl(360, 100%, 100%)' - - 'hsla(360, 100%, 100%, 1.0)' - - 'transparent' - - 'red' - - 0xff00ff00 (0xrrggbbaa) -`, - ); - } -}; - -const ColorPropType = colorPropType.bind(null, false /* isRequired */); -ColorPropType.isRequired = colorPropType.bind(null, true /* isRequired */); - -module.exports = ColorPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js deleted file mode 100644 index 02132c1ceaf360..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const DeprecatedEdgeInsetsPropType: React$PropType$Primitive<{ - bottom?: number, - left?: number, - right?: number, - top?: number, - ... -}> = PropTypes.shape({ - top: PropTypes.number, - left: PropTypes.number, - bottom: PropTypes.number, - right: PropTypes.number, -}); - -module.exports = DeprecatedEdgeInsetsPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js deleted file mode 100644 index ee25992a68bcb7..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedImageStylePropTypes = require('./DeprecatedImageStylePropTypes'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes'); -const PropTypes = require('prop-types'); - -const DeprecatedImagePropType = { - ...DeprecatedViewPropTypes, - style: (DeprecatedStyleSheetPropType( - DeprecatedImageStylePropTypes, - ): ReactPropsCheckType), - /** - * See https://reactnative.dev/docs/image#source - */ - source: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string), - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf( - PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number, - headers: PropTypes.objectOf(PropTypes.string), - }), - ), - ]): React$PropType$Primitive< - | { - headers?: {[string]: string, ...}, - uri?: string, - ... - } - | number - | Array<{ - headers?: {[string]: string, ...}, - height?: number, - uri?: string, - width?: number, - ... - }>, - >), - /** - * blurRadius: the blur radius of the blur filter added to the image - * - * See https://reactnative.dev/docs/image#blurradius - */ - blurRadius: PropTypes.number, - /** - * See https://reactnative.dev/docs/image#defaultsource - */ - defaultSource: PropTypes.number, - /** - * See https://reactnative.dev/docs/image#loadingindicatorsource - */ - loadingIndicatorSource: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - ]): React$PropType$Primitive<{uri?: string, ...} | number>), - progressiveRenderingEnabled: PropTypes.bool, - fadeDuration: PropTypes.number, - /** - * Analytics Tag used by this Image - */ - internal_analyticTag: PropTypes.string, - /** - * Invoked on load start - */ - onLoadStart: PropTypes.func, - /** - * Invoked on load error - */ - onError: PropTypes.func, - /** - * Invoked when load completes successfully - */ - onLoad: PropTypes.func, - /** - * Invoked when load either succeeds or fails - */ - onLoadEnd: PropTypes.func, - /** - * Used to locate this view in end-to-end tests. - */ - testID: PropTypes.string, - /** - * The mechanism that should be used to resize the image when the image's dimensions - * differ from the image view's dimensions. Defaults to `auto`. - * - * See https://reactnative.dev/docs/image#resizemethod - */ - resizeMethod: (PropTypes.oneOf([ - 'auto', - 'resize', - 'scale', - ]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>), - /** - * Determines how to resize the image when the frame doesn't match the raw - * image dimensions. - * - * See https://reactnative.dev/docs/image#resizemode - */ - resizeMode: (PropTypes.oneOf([ - 'cover', - 'contain', - 'stretch', - 'repeat', - 'center', - ]): React$PropType$Primitive< - 'cover' | 'contain' | 'stretch' | 'repeat' | 'center', - >), -}; - -module.exports = DeprecatedImagePropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js deleted file mode 100644 index 4b420c1a94c639..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedImageSourcePropType = require('./DeprecatedImageSourcePropType'); -const DeprecatedImageStylePropTypes = require('./DeprecatedImageStylePropTypes'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const PropTypes = require('prop-types'); - -module.exports = { - style: (DeprecatedStyleSheetPropType( - DeprecatedImageStylePropTypes, - ): ReactPropsCheckType), - source: DeprecatedImageSourcePropType, - defaultSource: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number, - scale: PropTypes.number, - }), - PropTypes.number, - ]): React$PropType$Primitive< - | { - height?: number, - scale?: number, - uri?: string, - width?: number, - ... - } - | number, - >), - - accessible: PropTypes.bool, - - accessibilityLabel: PropTypes.node, - - blurRadius: PropTypes.number, - - capInsets: DeprecatedEdgeInsetsPropType, - - resizeMethod: (PropTypes.oneOf([ - 'auto', - 'resize', - 'scale', - ]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>), - - resizeMode: (PropTypes.oneOf([ - 'cover', - 'contain', - 'stretch', - 'repeat', - 'center', - ]): React$PropType$Primitive< - 'cover' | 'contain' | 'stretch' | 'repeat' | 'center', - >), - - testID: PropTypes.string, - - onLayout: PropTypes.func, - - onLoadStart: PropTypes.func, - - onProgress: PropTypes.func, - - onError: PropTypes.func, - - onPartialLoad: PropTypes.func, - - onLoad: PropTypes.func, - - onLoadEnd: PropTypes.func, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js b/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js deleted file mode 100644 index 67df4a78ba885e..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @no-flow - * @format - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const ImageURISourcePropType = PropTypes.shape({ - uri: PropTypes.string, - bundle: PropTypes.string, - method: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string), - body: PropTypes.string, - cache: PropTypes.oneOf([ - 'default', - 'reload', - 'force-cache', - 'only-if-cached', - ]), - width: PropTypes.number, - height: PropTypes.number, - scale: PropTypes.number, -}); - -const ImageSourcePropType = PropTypes.oneOfType([ - ImageURISourcePropType, - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf(ImageURISourcePropType), -]); - -module.exports = ImageSourcePropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js deleted file mode 100644 index c393ded197062e..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); -const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); -const ReactPropTypes = require('prop-types'); - -const ImageStylePropTypes = { - ...DeprecatedLayoutPropTypes, - ...DeprecatedShadowPropTypesIOS, - ...DeprecatedTransformPropTypes, - resizeMode: (ReactPropTypes.oneOf([ - 'center', - 'contain', - 'cover', - 'repeat', - 'stretch', - ]): React$PropType$Primitive< - 'center' | 'contain' | 'cover' | 'repeat' | 'stretch', - >), - backfaceVisibility: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - backgroundColor: DeprecatedColorPropType, - borderColor: DeprecatedColorPropType, - borderWidth: ReactPropTypes.number, - borderRadius: ReactPropTypes.number, - overflow: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - - /** - * Changes the color of all the non-transparent pixels to the tintColor. - */ - tintColor: DeprecatedColorPropType, - opacity: ReactPropTypes.number, - /** - * When the image has rounded corners, specifying an overlayColor will - * cause the remaining space in the corners to be filled with a solid color. - * This is useful in cases which are not supported by the Android - * implementation of rounded corners: - * - Certain resize modes, such as 'contain' - * - Animated GIFs - * - * A typical way to use this prop is with images displayed on a solid - * background and setting the `overlayColor` to the same color - * as the background. - * - * For details of how this works under the hood, see - * http://frescolib.org/docs/rounded-corners-and-circles.html - * - * @platform android - */ - overlayColor: ReactPropTypes.string, - - // Android-Specific styles - borderTopLeftRadius: ReactPropTypes.number, - borderTopRightRadius: ReactPropTypes.number, - borderBottomLeftRadius: ReactPropTypes.number, - borderBottomRightRadius: ReactPropTypes.number, -}; - -module.exports = ImageStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js deleted file mode 100644 index 3e357fd4545650..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const ReactPropTypes = require('prop-types'); - -const LayoutPropTypes = { - display: (ReactPropTypes.oneOf(['none', 'flex']): React$PropType$Primitive< - 'none' | 'flex', - >), - width: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - height: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - start: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - end: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - top: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - left: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - right: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - bottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - minWidth: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - maxWidth: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - minHeight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - maxHeight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - margin: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginVertical: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginHorizontal: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginTop: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginBottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginLeft: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginRight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginStart: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginEnd: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - padding: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingVertical: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingHorizontal: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingTop: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingBottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingLeft: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingRight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingStart: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingEnd: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - borderWidth: ReactPropTypes.number, - borderTopWidth: ReactPropTypes.number, - borderStartWidth: ReactPropTypes.number, - borderEndWidth: ReactPropTypes.number, - borderRightWidth: ReactPropTypes.number, - borderBottomWidth: ReactPropTypes.number, - borderLeftWidth: ReactPropTypes.number, - position: (ReactPropTypes.oneOf([ - 'absolute', - 'relative', - ]): React$PropType$Primitive<'absolute' | 'relative'>), - flexDirection: (ReactPropTypes.oneOf([ - 'row', - 'row-reverse', - 'column', - 'column-reverse', - ]): React$PropType$Primitive< - 'row' | 'row-reverse' | 'column' | 'column-reverse', - >), - flexWrap: (ReactPropTypes.oneOf([ - 'wrap', - 'nowrap', - 'wrap-reverse', - ]): React$PropType$Primitive<'wrap' | 'nowrap' | 'wrap-reverse'>), - justifyContent: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'space-between', - 'space-around', - 'space-evenly', - ]): React$PropType$Primitive< - | 'flex-start' - | 'flex-end' - | 'center' - | 'space-between' - | 'space-around' - | 'space-evenly', - >), - alignItems: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'baseline', - ]): React$PropType$Primitive< - 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', - >), - alignSelf: (ReactPropTypes.oneOf([ - 'auto', - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'baseline', - ]): React$PropType$Primitive< - 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', - >), - alignContent: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'space-between', - 'space-around', - ]): React$PropType$Primitive< - | 'flex-start' - | 'flex-end' - | 'center' - | 'stretch' - | 'space-between' - | 'space-around', - >), - overflow: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - 'scroll', - ]): React$PropType$Primitive<'visible' | 'hidden' | 'scroll'>), - flex: ReactPropTypes.number, - flexGrow: ReactPropTypes.number, - flexShrink: ReactPropTypes.number, - flexBasis: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - aspectRatio: ReactPropTypes.number, - zIndex: ReactPropTypes.number, - direction: (ReactPropTypes.oneOf([ - 'inherit', - 'ltr', - 'rtl', - ]): React$PropType$Primitive<'inherit' | 'ltr' | 'rtl'>), -}; - -module.exports = LayoutPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js deleted file mode 100644 index c180131271a9b4..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const PointPropType: React$PropType$Primitive<{ - x?: number, - y?: number, - ... -}> = PropTypes.shape({ - x: PropTypes.number, - y: PropTypes.number, -}); - -module.exports = PointPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js deleted file mode 100644 index 35891835e3ae61..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const ReactPropTypes = require('prop-types'); - -const DeprecatedShadowPropTypesIOS = { - shadowColor: DeprecatedColorPropType, - shadowOffset: (ReactPropTypes.shape({ - width: ReactPropTypes.number, - height: ReactPropTypes.number, - }): React$PropType$Primitive<{ - height?: number, - width?: number, - ... - }>), - shadowOpacity: ReactPropTypes.number, - shadowRadius: ReactPropTypes.number, -}; - -module.exports = DeprecatedShadowPropTypesIOS; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js deleted file mode 100644 index 0c7accf5af832e..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const deprecatedCreateStrictShapeTypeChecker = require('./deprecatedCreateStrictShapeTypeChecker'); -const flattenStyle = require('../StyleSheet/flattenStyle'); - -function DeprecatedStyleSheetPropType(shape: { - [key: string]: ReactPropsCheckType, - ... -}): ReactPropsCheckType { - const shapePropType = deprecatedCreateStrictShapeTypeChecker(shape); - return function (props, propName, componentName, location?, ...rest) { - let newProps = props; - if (props[propName]) { - // Just make a dummy prop object with only the flattened style - newProps = {}; - newProps[propName] = flattenStyle(props[propName]); - } - return shapePropType(newProps, propName, componentName, location, ...rest); - }; -} - -module.exports = DeprecatedStyleSheetPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js deleted file mode 100644 index efabb7f1ba814d..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +++ /dev/null @@ -1,693 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedTextPropTypes = require('./DeprecatedTextPropTypes'); -const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes'); -const PropTypes = require('prop-types'); - -const DataDetectorTypes = [ - 'phoneNumber', - 'link', - 'address', - 'calendarEvent', - 'none', - 'all', -]; - -module.exports = { - ...DeprecatedViewPropTypes, - /** - * Can tell `TextInput` to automatically capitalize certain characters. - * - * - `characters`: all characters. - * - `words`: first letter of each word. - * - `sentences`: first letter of each sentence (*default*). - * - `none`: don't auto capitalize anything. - */ - autoCapitalize: (PropTypes.oneOf([ - 'none', - 'sentences', - 'words', - 'characters', - ]): React$PropType$Primitive<'none' | 'sentences' | 'words' | 'characters'>), - /** - * Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content. - * To disable autocomplete, set `autoComplete` to `off`. - * - * *Android Only* - * - * Possible values for `autoComplete` are: - * - * - `birthdate-day` - * - `birthdate-full` - * - `birthdate-month` - * - `birthdate-year` - * - `cc-csc` - * - `cc-exp` - * - `cc-exp-day` - * - `cc-exp-month` - * - `cc-exp-year` - * - `cc-number` - * - `email` - * - `gender` - * - `name` - * - `name-family` - * - `name-given` - * - `name-middle` - * - `name-middle-initial` - * - `name-prefix` - * - `name-suffix` - * - `password` - * - `password-new` - * - `postal-address` - * - `postal-address-country` - * - `postal-address-extended` - * - `postal-address-extended-postal-code` - * - `postal-address-locality` - * - `postal-address-region` - * - `postal-code` - * - `street-address` - * - `sms-otp` - * - `tel` - * - `tel-country-code` - * - `tel-national` - * - `tel-device` - * - `username` - * - `username-new` - * - `off` - * - * @platform android - */ - autoComplete: (PropTypes.oneOf([ - 'birthdate-day', - 'birthdate-full', - 'birthdate-month', - 'birthdate-year', - 'cc-csc', - 'cc-exp', - 'cc-exp-day', - 'cc-exp-month', - 'cc-exp-year', - 'cc-number', - 'email', - 'gender', - 'name', - 'name-family', - 'name-given', - 'name-middle', - 'name-middle-initial', - 'name-prefix', - 'name-suffix', - 'password', - 'password-new', - 'postal-address', - 'postal-address-country', - 'postal-address-extended', - 'postal-address-extended-postal-code', - 'postal-address-locality', - 'postal-address-region', - 'postal-code', - 'street-address', - 'sms-otp', - 'tel', - 'tel-country-code', - 'tel-national', - 'tel-device', - 'username', - 'username-new', - 'off', - ]): React$PropType$Primitive< - | 'birthdate-day' - | 'birthdate-full' - | 'birthdate-month' - | 'birthdate-year' - | 'cc-csc' - | 'cc-exp' - | 'cc-exp-day' - | 'cc-exp-month' - | 'cc-exp-year' - | 'cc-number' - | 'email' - | 'gender' - | 'name' - | 'name-family' - | 'name-given' - | 'name-middle' - | 'name-middle-initial' - | 'name-prefix' - | 'name-suffix' - | 'password' - | 'password-new' - | 'postal-address' - | 'postal-address-country' - | 'postal-address-extended' - | 'postal-address-extended-postal-code' - | 'postal-address-locality' - | 'postal-address-region' - | 'postal-code' - | 'street-address' - | 'sms-otp' - | 'tel' - | 'tel-country-code' - | 'tel-national' - | 'tel-device' - | 'username' - | 'username-new' - | 'off', - >), - /** - * If `false`, disables auto-correct. The default value is `true`. - */ - autoCorrect: PropTypes.bool, - /** - * If `false`, disables spell-check style (i.e. red underlines). - * The default value is inherited from `autoCorrect`. - * @platform ios - */ - spellCheck: PropTypes.bool, - /** - * If `true`, focuses the input on `componentDidMount`. - * The default value is `false`. - */ - autoFocus: PropTypes.bool, - /** - * Specifies whether fonts should scale to respect Text Size accessibility settings. The - * default is `true`. - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * If `false`, text is not editable. The default value is `true`. - */ - editable: PropTypes.bool, - /** - * Determines which keyboard to open, e.g.`numeric`. - * - * The following values work across platforms: - * - * - `default` - * - `numeric` - * - `number-pad` - * - `decimal-pad` - * - `email-address` - * - `phone-pad` - * - `url` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `ascii-capable` - * - `numbers-and-punctuation` - * - `name-phone-pad` - * - `twitter` - * - `web-search` - * - `ascii-capable-number-pad` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `visible-password` - */ - keyboardType: (PropTypes.oneOf([ - // Cross-platform - 'default', - 'email-address', - 'numeric', - 'phone-pad', - 'number-pad', - 'url', - // iOS-only - 'ascii-capable', - 'numbers-and-punctuation', - 'name-phone-pad', - 'decimal-pad', - 'twitter', - 'web-search', - // iOS 10+ only - 'ascii-capable-number-pad', - // Android-only - 'visible-password', - ]): React$PropType$Primitive< - | 'default' - | 'email-address' - | 'numeric' - | 'phone-pad' - | 'number-pad' - | 'ascii-capable' - | 'numbers-and-punctuation' - | 'url' - | 'name-phone-pad' - | 'decimal-pad' - | 'twitter' - | 'web-search' - | 'ascii-capable-number-pad' - | 'visible-password', - >), - /** - * Determines the color of the keyboard. - * @platform ios - */ - keyboardAppearance: (PropTypes.oneOf([ - 'default', - 'light', - 'dark', - ]): React$PropType$Primitive<'default' | 'light' | 'dark'>), - /** - * Determines how the return key should look. On Android you can also use - * `returnKeyLabel`. - * - * *Cross platform* - * - * The following values work across platforms: - * - * - `done` - * - `go` - * - `next` - * - `search` - * - `send` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `none` - * - `previous` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `default` - * - `emergency-call` - * - `google` - * - `join` - * - `route` - * - `yahoo` - */ - returnKeyType: (PropTypes.oneOf([ - // Cross-platform - 'done', - 'go', - 'next', - 'search', - 'send', - // Android-only - 'none', - 'previous', - // iOS-only - 'default', - 'emergency-call', - 'google', - 'join', - 'route', - 'yahoo', - ]): React$PropType$Primitive< - | 'done' - | 'go' - | 'next' - | 'search' - | 'send' - | 'none' - | 'previous' - | 'default' - | 'emergency-call' - | 'google' - | 'join' - | 'route' - | 'yahoo', - >), - /** - * Sets the return key to the label. Use it instead of `returnKeyType`. - * @platform android - */ - returnKeyLabel: PropTypes.string, - /** - * Limits the maximum number of characters that can be entered. Use this - * instead of implementing the logic in JS to avoid flicker. - */ - maxLength: PropTypes.number, - /** - * Sets the number of lines for a `TextInput`. Use it with multiline set to - * `true` to be able to fill the lines. - * @platform android - */ - numberOfLines: PropTypes.number, - /** - * When `false`, if there is a small amount of space available around a text input - * (e.g. landscape orientation on a phone), the OS may choose to have the user edit - * the text inside of a full screen text input mode. When `true`, this feature is - * disabled and users will always edit the text directly inside of the text input. - * Defaults to `false`. - * @platform android - */ - disableFullscreenUI: PropTypes.bool, - /** - * If `true`, the keyboard disables the return key when there is no text and - * automatically enables it when there is text. The default value is `false`. - * @platform ios - */ - enablesReturnKeyAutomatically: PropTypes.bool, - /** - * If `true`, the text input can be multiple lines. - * The default value is `false`. - */ - multiline: PropTypes.bool, - /** - * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` - * The default value is `simple`. - * @platform android - */ - textBreakStrategy: (PropTypes.oneOf([ - 'simple', - 'highQuality', - 'balanced', - ]): React$PropType$Primitive<'simple' | 'highQuality' | 'balanced'>), - /** - * Callback that is called when the text input is blurred. - */ - onBlur: PropTypes.func, - /** - * Callback that is called when the text input is focused. - */ - onFocus: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - */ - onChange: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - * Changed text is passed as an argument to the callback handler. - */ - onChangeText: PropTypes.func, - /** - * Callback that is called when the text input's content size changes. - * This will be called with - * `{ nativeEvent: { contentSize: { width, height } } }`. - * - * Only called for multiline text inputs. - */ - onContentSizeChange: PropTypes.func, - onTextInput: PropTypes.func, - /** - * Callback that is called when text input ends. - */ - onEndEditing: PropTypes.func, - /** - * Callback that is called when the text input selection is changed. - * This will be called with - * `{ nativeEvent: { selection: { start, end } } }`. - */ - onSelectionChange: PropTypes.func, - /** - * Callback that is called when the text input's submit button is pressed. - * Invalid if `multiline={true}` is specified. - */ - onSubmitEditing: PropTypes.func, - /** - * Callback that is called when a key is pressed. - * This will be called with `{ nativeEvent: { key: keyValue } }` - * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and - * the typed-in character otherwise including `' '` for space. - * Fires before `onChange` callbacks. - */ - onKeyPress: PropTypes.func, - /** - * Invoked on mount and layout changes with `{x, y, width, height}`. - */ - onLayout: PropTypes.func, - /** - * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. - * May also contain other properties from ScrollEvent but on Android contentSize - * is not provided for performance reasons. - */ - onScroll: PropTypes.func, - /** - * The string that will be rendered before text input has been entered. - */ - placeholder: PropTypes.string, - /** - * The text color of the placeholder string. - */ - placeholderTextColor: DeprecatedColorPropType, - /** - * If `false`, scrolling of the text view will be disabled. - * The default value is `true`. Does only work with 'multiline={true}'. - * @platform ios - */ - scrollEnabled: PropTypes.bool, - /** - * If `true`, the text input obscures the text entered so that sensitive text - * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. - */ - secureTextEntry: PropTypes.bool, - /** - * The highlight and cursor color of the text input. - */ - selectionColor: DeprecatedColorPropType, - /** - * The start and end of the text input's selection. Set start and end to - * the same value to position the cursor. - */ - selection: (PropTypes.shape({ - start: PropTypes.number.isRequired, - end: PropTypes.number, - }): React$PropType$Primitive<{ - end?: number, - start: number, - ... - }>), - /** - * The value to show for the text input. `TextInput` is a controlled - * component, which means the native value will be forced to match this - * value prop if provided. For most uses, this works great, but in some - * cases this may cause flickering - one common cause is preventing edits - * by keeping value the same. In addition to simply setting the same value, - * either set `editable={false}`, or set/update `maxLength` to prevent - * unwanted edits without flicker. - */ - value: PropTypes.string, - /** - * Provides an initial value that will change when the user starts typing. - * Useful for simple use-cases where you do not want to deal with listening - * to events and updating the value prop to keep the controlled state in sync. - */ - defaultValue: PropTypes.string, - /** - * When the clear button should appear on the right side of the text view. - * This property is supported only for single-line TextInput component. - * @platform ios - */ - clearButtonMode: (PropTypes.oneOf([ - 'never', - 'while-editing', - 'unless-editing', - 'always', - ]): React$PropType$Primitive< - 'never' | 'while-editing' | 'unless-editing' | 'always', - >), - /** - * If `true`, clears the text field automatically when editing begins. - * @platform ios - */ - clearTextOnFocus: PropTypes.bool, - /** - * If `true`, all text will automatically be selected on focus. - */ - selectTextOnFocus: PropTypes.bool, - /** - * If `true`, the text field will blur when submitted. - * The default value is true for single-line fields and false for - * multiline fields. Note that for multiline fields, setting `blurOnSubmit` - * to `true` means that pressing return will blur the field and trigger the - * `onSubmitEditing` event instead of inserting a newline into the field. - */ - blurOnSubmit: PropTypes.bool, - /** - * Note that not all Text styles are supported, an incomplete list of what is not supported includes: - * - * - `borderLeftWidth` - * - `borderTopWidth` - * - `borderRightWidth` - * - `borderBottomWidth` - * - `borderTopLeftRadius` - * - `borderTopRightRadius` - * - `borderBottomRightRadius` - * - `borderBottomLeftRadius` - * - * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) - * for more detail. - * - * [Styles](docs/style.html) - */ - style: DeprecatedTextPropTypes.style, - /** - * The color of the `TextInput` underline. - * @platform android - */ - underlineColorAndroid: DeprecatedColorPropType, - - /** - * If defined, the provided image resource will be rendered on the left. - * The image resource must be inside `/android/app/src/main/res/drawable` and referenced - * like - * ``` - * - * ``` - * @platform android - */ - inlineImageLeft: PropTypes.string, - - /** - * Padding between the inline image, if any, and the text input itself. - * @platform android - */ - inlineImagePadding: PropTypes.number, - - /** - * If `true`, allows TextInput to pass touch events to the parent component. - * This allows components such as SwipeableListView to be swipeable from the TextInput on iOS, - * as is the case on Android by default. - * If `false`, TextInput always asks to handle the input (except when disabled). - * @platform ios - */ - rejectResponderTermination: PropTypes.bool, - - /** - * Determines the types of data converted to clickable URLs in the text input. - * Only valid if `multiline={true}` and `editable={false}`. - * By default no data types are detected. - * - * You can provide one type or an array of many types. - * - * Possible values for `dataDetectorTypes` are: - * - * - `'phoneNumber'` - * - `'link'` - * - `'address'` - * - `'calendarEvent'` - * - `'none'` - * - `'all'` - * - * @platform ios - */ - dataDetectorTypes: (PropTypes.oneOfType([ - PropTypes.oneOf(DataDetectorTypes), - PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), - ]): React$PropType$Primitive< - | 'phoneNumber' - | 'link' - | 'address' - | 'calendarEvent' - | 'none' - | 'all' - | Array< - 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all', - >, - >), - /** - * If `true`, caret is hidden. The default value is `false`. - * This property is supported only for single-line TextInput component on iOS. - */ - caretHidden: PropTypes.bool, - /* - * If `true`, contextMenuHidden is hidden. The default value is `false`. - */ - contextMenuHidden: PropTypes.bool, - /** - * An optional identifier which links a custom InputAccessoryView to - * this text input. The InputAccessoryView is rendered above the - * keyboard when this text input is focused. - * @platform ios - */ - inputAccessoryViewID: PropTypes.string, - /** - * Give the keyboard and the system information about the - * expected semantic meaning for the content that users enter. - * @platform ios - */ - textContentType: (PropTypes.oneOf([ - 'none', - 'URL', - 'addressCity', - 'addressCityAndState', - 'addressState', - 'countryName', - 'creditCardNumber', - 'emailAddress', - 'familyName', - 'fullStreetAddress', - 'givenName', - 'jobTitle', - 'location', - 'middleName', - 'name', - 'namePrefix', - 'nameSuffix', - 'nickname', - 'organizationName', - 'postalCode', - 'streetAddressLine1', - 'streetAddressLine2', - 'sublocality', - 'telephoneNumber', - 'username', - 'password', - 'newPassword', - 'oneTimeCode', - ]): React$PropType$Primitive< - | 'none' - | 'URL' - | 'addressCity' - | 'addressCityAndState' - | 'addressState' - | 'countryName' - | 'creditCardNumber' - | 'emailAddress' - | 'familyName' - | 'fullStreetAddress' - | 'givenName' - | 'jobTitle' - | 'location' - | 'middleName' - | 'name' - | 'namePrefix' - | 'nameSuffix' - | 'nickname' - | 'organizationName' - | 'postalCode' - | 'streetAddressLine1' - | 'streetAddressLine2' - | 'sublocality' - | 'telephoneNumber' - | 'username' - | 'password' - | 'newPassword' - | 'oneTimeCode', - >), - /** - * When `false`, it will prevent the soft keyboard from showing when the field is focused. - * Defaults to `true`. - */ - showSoftInputOnFocus: PropTypes.bool, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js deleted file mode 100644 index fa7d01c68b795a..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const PropTypes = require('prop-types'); -const DeprecatedTextStylePropTypes = require('./DeprecatedTextStylePropTypes'); - -const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( - DeprecatedTextStylePropTypes, -); - -const DataDetectorTypes = ['phoneNumber', 'link', 'email', 'none', 'all']; - -module.exports = { - /** - * When `numberOfLines` is set, this prop defines how text will be - * truncated. - * - * See https://reactnative.dev/docs/text#ellipsizemode - */ - ellipsizeMode: (PropTypes.oneOf([ - 'head', - 'middle', - 'tail', - 'clip', - ]): React$PropType$Primitive<'head' | 'middle' | 'tail' | 'clip'>), - /** - * Used to truncate the text with an ellipsis. - * - * See https://reactnative.dev/docs/text#numberoflines - */ - numberOfLines: PropTypes.number, - /** - * Set text break strategy on Android. - * - * See https://reactnative.dev/docs/text#textbreakstrategy - */ - textBreakStrategy: (PropTypes.oneOf([ - 'simple', - 'highQuality', - 'balanced', - ]): React$PropType$Primitive<'simple' | 'highQuality' | 'balanced'>), - /** - * Invoked on mount and layout changes. - * - * See https://reactnative.dev/docs/text#onlayout - */ - onLayout: PropTypes.func, - /** - * This function is called on press. - * - * See https://reactnative.dev/docs/text#onpress - */ - onPress: PropTypes.func, - /** - * This function is called on long press. - * - * See https://reactnative.dev/docs/text#onlongpress - */ - onLongPress: PropTypes.func, - /** - * Defines how far your touch may move off of the button, before - * deactivating the button. - * - * See https://reactnative.dev/docs/text#pressretentionoffset - */ - pressRetentionOffset: DeprecatedEdgeInsetsPropType, - /** - * Lets the user select text. - * - * See https://reactnative.dev/docs/text#selectable - */ - selectable: PropTypes.bool, - /** - * The highlight color of the text. - * - * See https://reactnative.dev/docs/text#selectioncolor - */ - selectionColor: DeprecatedColorPropType, - /** - * When `true`, no visual change is made when text is pressed down. - * - * See https://reactnative.dev/docs/text#supperhighlighting - */ - suppressHighlighting: PropTypes.bool, - style: stylePropType, - /** - * Used to locate this view in end-to-end tests. - * - * See https://reactnative.dev/docs/text#testid - */ - testID: PropTypes.string, - /** - * Used to locate this view from native code. - * - * See https://reactnative.dev/docs/text#nativeid - */ - nativeID: PropTypes.string, - /** - * Whether fonts should scale to respect Text Size accessibility settings. - * - * See https://reactnative.dev/docs/text#allowfontscaling - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * Indicates whether the view is an accessibility element. - * - * See https://reactnative.dev/docs/text#accessible - */ - accessible: PropTypes.bool, - /** - * Whether font should be scaled down automatically. - * - * See https://reactnative.dev/docs/text#adjustsfontsizetofit - */ - adjustsFontSizeToFit: PropTypes.bool, - /** - * Smallest possible scale a font can reach. - * - * See https://reactnative.dev/docs/text#minimumfontscale - */ - minimumFontScale: PropTypes.number, - /** - * Specifies the disabled state of the text view for testing purposes. - * - * See https://reactnative.dev/docs/text#disabled - */ - disabled: PropTypes.bool, - /** - * Determines the types of data converted to clickable URLs in text. - * - * See https://reactnative.dev/docs/text#dataDetectorType - */ - dataDetectorType: (PropTypes.oneOf( - DataDetectorTypes, - ): React$PropType$Primitive< - 'phoneNumber' | 'link' | 'email' | 'none' | 'all', - >), -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js deleted file mode 100644 index 51e3ddb1d6f0c3..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); -const ReactPropTypes = require('prop-types'); - -const DeprecatedTextStylePropTypes = { - ...DeprecatedViewStylePropTypes, - - color: DeprecatedColorPropType, - fontFamily: ReactPropTypes.string, - fontSize: ReactPropTypes.number, - fontStyle: (ReactPropTypes.oneOf([ - 'normal', - 'italic', - ]): React$PropType$Primitive<'normal' | 'italic'>), - /** - * Specifies font weight. The values 'normal' and 'bold' are supported for - * most fonts. Not all fonts have a variant for each of the numeric values, - * in that case the closest one is chosen. - */ - fontWeight: (ReactPropTypes.oneOf([ - 'normal' /*default*/, - 'bold', - '100', - '200', - '300', - '400', - '500', - '600', - '700', - '800', - '900', - ]): React$PropType$Primitive< - | 'normal' - | 'bold' - | '100' - | '200' - | '300' - | '400' - | '500' - | '600' - | '700' - | '800' - | '900', - >), - fontVariant: (ReactPropTypes.arrayOf( - ReactPropTypes.oneOf([ - 'small-caps', - 'oldstyle-nums', - 'lining-nums', - 'tabular-nums', - 'proportional-nums', - ]), - ): React$PropType$Primitive< - Array< - | 'small-caps' - | 'oldstyle-nums' - | 'lining-nums' - | 'tabular-nums' - | 'proportional-nums', - >, - >), - textShadowOffset: (ReactPropTypes.shape({ - width: ReactPropTypes.number, - height: ReactPropTypes.number, - }): React$PropType$Primitive<{ - height?: number, - width?: number, - ... - }>), - textShadowRadius: ReactPropTypes.number, - textShadowColor: DeprecatedColorPropType, - /** - * @platform ios - */ - letterSpacing: ReactPropTypes.number, - lineHeight: ReactPropTypes.number, - /** - * Specifies text alignment. The value 'justify' is only supported on iOS and - * fallbacks to `left` on Android. - */ - textAlign: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'left', - 'right', - 'center', - 'justify', - ]): React$PropType$Primitive< - 'auto' | 'left' | 'right' | 'center' | 'justify', - >), - /** - * @platform android - */ - textAlignVertical: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'top', - 'bottom', - 'center', - ]): React$PropType$Primitive<'auto' | 'top' | 'bottom' | 'center'>), - /** - * Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders. - * With some fonts, this padding can make text look slightly misaligned when centered vertically. - * For best results also set `textAlignVertical` to `center`. Default is true. - * @platform android - */ - includeFontPadding: ReactPropTypes.bool, - textDecorationLine: (ReactPropTypes.oneOf([ - 'none' /*default*/, - 'underline', - 'line-through', - 'underline line-through', - ]): React$PropType$Primitive< - 'none' | 'underline' | 'line-through' | 'underline line-through', - >), - /** - * @platform ios - */ - textDecorationStyle: (ReactPropTypes.oneOf([ - 'solid' /*default*/, - 'double', - 'dotted', - 'dashed', - ]): React$PropType$Primitive<'solid' | 'double' | 'dotted' | 'dashed'>), - /** - * @platform ios - */ - textDecorationColor: DeprecatedColorPropType, - textTransform: (ReactPropTypes.oneOf([ - 'none' /*default*/, - 'capitalize', - 'uppercase', - 'lowercase', - ]): React$PropType$Primitive< - 'none' | 'capitalize' | 'uppercase' | 'lowercase', - >), - /** - * @platform ios - */ - writingDirection: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'ltr', - 'rtl', - ]): React$PropType$Primitive<'auto' | 'ltr' | 'rtl'>), -}; - -module.exports = DeprecatedTextStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js deleted file mode 100644 index 1782a25fa12950..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const ReactPropTypes = require('prop-types'); - -const deprecatedPropType = require('../Utilities/deprecatedPropType'); - -const TransformMatrixPropType = function ( - props: Object, - propName: string, - componentName: string, -): ?Error { - if (props[propName]) { - return new Error( - 'The transformMatrix style property is deprecated. ' + - 'Use `transform: [{ matrix: ... }]` instead.', - ); - } -}; - -const DecomposedMatrixPropType = function ( - props: Object, - propName: string, - componentName: string, -): ?Error { - if (props[propName]) { - return new Error( - 'The decomposedMatrix style property is deprecated. ' + - 'Use `transform: [...]` instead.', - ); - } -}; - -const DeprecatedTransformPropTypes = { - transform: (ReactPropTypes.arrayOf( - ReactPropTypes.oneOfType([ - ReactPropTypes.shape({perspective: ReactPropTypes.number}), - ReactPropTypes.shape({rotate: ReactPropTypes.string}), - ReactPropTypes.shape({rotateX: ReactPropTypes.string}), - ReactPropTypes.shape({rotateY: ReactPropTypes.string}), - ReactPropTypes.shape({rotateZ: ReactPropTypes.string}), - ReactPropTypes.shape({scale: ReactPropTypes.number}), - ReactPropTypes.shape({scaleX: ReactPropTypes.number}), - ReactPropTypes.shape({scaleY: ReactPropTypes.number}), - ReactPropTypes.shape({translateX: ReactPropTypes.number}), - ReactPropTypes.shape({translateY: ReactPropTypes.number}), - ReactPropTypes.shape({skewX: ReactPropTypes.string}), - ReactPropTypes.shape({skewY: ReactPropTypes.string}), - ]), - ): React$PropType$Primitive< - Array< - | {perspective?: number, ...} - | {rotate?: string, ...} - | {rotateX?: string, ...} - | {rotateY?: string, ...} - | {rotateZ?: string, ...} - | {scale?: number, ...} - | {scaleX?: number, ...} - | {scaleY?: number, ...} - | {translateX?: number, ...} - | {translateY?: number, ...} - | {skewX?: string, ...} - | {skewY?: string, ...}, - >, - >), - transformMatrix: TransformMatrixPropType, - decomposedMatrix: DecomposedMatrixPropType, - scaleX: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - scaleY: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - rotation: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - translateX: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - translateY: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), -}; - -module.exports = DeprecatedTransformPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js b/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js deleted file mode 100644 index 743d3765e01cc0..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -module.exports = { - // This must be kept in sync with the AccessibilityRolesMask in RCTViewManager.m - DeprecatedAccessibilityRoles: [ - 'none', - 'button', - 'togglebutton', - 'link', - 'search', - 'image', - 'keyboardkey', - 'text', - 'adjustable', - 'imagebutton', - 'header', - 'summary', - 'alert', - 'checkbox', - 'combobox', - 'menu', - 'menubar', - 'menuitem', - 'progressbar', - 'radio', - 'radiogroup', - 'scrollbar', - 'spinbutton', - 'switch', - 'tab', - 'tablist', - 'timer', - 'list', - 'toolbar', - ], -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js deleted file mode 100644 index 69b4d07dba3521..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +++ /dev/null @@ -1,408 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); -const PropTypes = require('prop-types'); - -const {DeprecatedAccessibilityRoles} = require('./DeprecatedViewAccessibility'); - -const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( - DeprecatedViewStylePropTypes, -); - -module.exports = { - /** - * When `true`, indicates that the view is an accessibility element. - * By default, all the touchable elements are accessible. - * - * See https://reactnative.dev/docs/view#accessible - */ - accessible: PropTypes.bool, - - /** - * Overrides the text that's read by the screen reader when the user interacts - * with the element. By default, the label is constructed by traversing all - * the children and accumulating all the `Text` nodes separated by space. - * - * See https://reactnative.dev/docs/view#accessibilitylabel - */ - accessibilityLabel: PropTypes.node, - - /** - * An accessibility hint helps users understand what will happen when they perform - * an action on the accessibility element when that result is not obvious from the - * accessibility label. - * - * - * See https://reactnative.dev/docs/view#accessibilityHint - */ - accessibilityHint: PropTypes.string, - - /** - * Provides an array of custom actions available for accessibility. - * - * @platform ios - */ - accessibilityActions: (PropTypes.arrayOf( - PropTypes.string, - ): React$PropType$Primitive>), - - /** - * Prevents view from being inverted if set to true and color inversion is turned on. - * - * @platform ios - */ - accessibilityIgnoresInvertColors: PropTypes.bool, - - /** - * Indicates to accessibility services to treat UI component like a specific role. - */ - accessibilityRole: (PropTypes.oneOf( - DeprecatedAccessibilityRoles, - ): React$PropType$Primitive< - | 'none' - | 'button' - | 'link' - | 'search' - | 'image' - | 'keyboardkey' - | 'text' - | 'adjustable' - | 'imagebutton' - | 'header' - | 'summary' - | 'alert' - | 'checkbox' - | 'combobox' - | 'menu' - | 'menubar' - | 'menuitem' - | 'progressbar' - | 'radio' - | 'radiogroup' - | 'scrollbar' - | 'spinbutton' - | 'switch' - | 'tab' - | 'tablist' - | 'timer' - | 'toolbar', - >), - - accessibilityState: PropTypes.object, - accessibilityValue: PropTypes.object, - /** - * Indicates to accessibility services whether the user should be notified - * when this view changes. Works for Android API >= 19 only. - * - * @platform android - * - * See https://reactnative.dev/docs/view#accessibilityliveregion - */ - accessibilityLiveRegion: (PropTypes.oneOf([ - 'none', - 'polite', - 'assertive', - ]): React$PropType$Primitive<'none' | 'polite' | 'assertive'>), - - /** - * Controls how view is important for accessibility which is if it - * fires accessibility events and if it is reported to accessibility services - * that query the screen. Works for Android only. - * - * @platform android - * - * See https://reactnative.dev/docs/view#importantforaccessibility - */ - importantForAccessibility: (PropTypes.oneOf([ - 'auto', - 'yes', - 'no', - 'no-hide-descendants', - ]): React$PropType$Primitive<'auto' | 'yes' | 'no' | 'no-hide-descendants'>), - - /** - * A value indicating whether VoiceOver should ignore the elements - * within views that are siblings of the receiver. - * Default is `false`. - * - * @platform ios - * - * See https://reactnative.dev/docs/view#accessibilityviewismodal - */ - accessibilityViewIsModal: PropTypes.bool, - - /** - * A value indicating whether the accessibility elements contained within - * this accessibility element are hidden. - * - * @platform ios - * - * See https://reactnative.dev/docs/view#accessibilityElementsHidden - */ - accessibilityElementsHidden: PropTypes.bool, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs an accessibility custom action. - * - * @platform ios - */ - onAccessibilityAction: PropTypes.func, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs accessibility tap gesture. - * - * See https://reactnative.dev/docs/view#onaccessibilitytap - */ - onAccessibilityTap: PropTypes.func, - - /** - * When `accessible` is `true`, the system will invoke this function when the - * user performs the magic tap gesture. - * - * See https://reactnative.dev/docs/view#onmagictap - */ - onMagicTap: PropTypes.func, - - /** - * Used to locate this view in end-to-end tests. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See https://reactnative.dev/docs/view#testid - */ - testID: PropTypes.string, - - /** - * Used to locate this view from native classes. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See https://reactnative.dev/docs/view#nativeid - */ - nativeID: PropTypes.string, - - /** - * For most touch interactions, you'll simply want to wrap your component in - * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, - * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. - */ - - /** - * The View is now responding for touch events. This is the time to highlight - * and show the user what is happening. - * - * `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See https://reactnative.dev/docs/view#onrespondergrant - */ - onResponderGrant: PropTypes.func, - - /** - * The user is moving their finger. - * - * `View.props.onResponderMove: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See https://reactnative.dev/docs/view#onrespondermove - */ - onResponderMove: PropTypes.func, - - /** - * Another responder is already active and will not release it to that `View` - * asking to be the responder. - * - * `View.props.onResponderReject: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onresponderreject - */ - onResponderReject: PropTypes.func, - - /** - * Fired at the end of the touch. - * - * `View.props.onResponderRelease: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onresponderrelease - */ - onResponderRelease: PropTypes.func, - - /** - * The responder has been taken from the `View`. Might be taken by other - * views after a call to `onResponderTerminationRequest`, or might be taken - * by the OS without asking (e.g., happens with control center/ notification - * center on iOS) - * - * `View.props.onResponderTerminate: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onresponderterminate - */ - onResponderTerminate: PropTypes.func, - - /** - * Some other `View` wants to become responder and is asking this `View` to - * release its responder. Returning `true` allows its release. - * - * `View.props.onResponderTerminationRequest: (event) => {}`, where `event` - * is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onresponderterminationrequest - */ - onResponderTerminationRequest: PropTypes.func, - - /** - * Does this view want to become responder on the start of a touch? - * - * `View.props.onStartShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onstartshouldsetresponder - */ - onStartShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a touch start, it should have this handler which returns `true`. - * - * `View.props.onStartShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture - */ - onStartShouldSetResponderCapture: PropTypes.func, - - /** - * Does this view want to "claim" touch responsiveness? This is called for - * every touch move on the `View` when it is not the responder. - * - * `View.props.onMoveShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onmoveshouldsetresponder - */ - onMoveShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a move, it should have this handler which returns `true`. - * - * `View.props.onMoveShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view#onMoveShouldsetrespondercapture - */ - onMoveShouldSetResponderCapture: PropTypes.func, - - /** - * This defines how far a touch event can start away from the view. - * Typical interface guidelines recommend touch targets that are at least - * 30 - 40 points/density-independent pixels. - * - * > The touch area never extends past the parent view bounds and the Z-index - * > of sibling views always takes precedence if a touch hits two overlapping - * > views. - * - * See https://reactnative.dev/docs/view#hitslop - */ - hitSlop: DeprecatedEdgeInsetsPropType, - - /** - * Invoked on mount and layout changes with: - * - * `{nativeEvent: { layout: {x, y, width, height}}}` - * - * This event is fired immediately once the layout has been calculated, but - * the new layout may not yet be reflected on the screen at the time the - * event is received, especially if a layout animation is in progress. - * - * See https://reactnative.dev/docs/view#onlayout - */ - onLayout: PropTypes.func, - - /** - * Controls whether the `View` can be the target of touch events. - * - * See https://reactnative.dev/docs/view#pointerevents - */ - pointerEvents: (PropTypes.oneOf([ - 'box-none', - 'none', - 'box-only', - 'auto', - ]): React$PropType$Primitive<'box-none' | 'none' | 'box-only' | 'auto'>), - - /** - * See https://reactnative.dev/docs/style - */ - style: stylePropType, - - /** - * This is a special performance property exposed by `RCTView` and is useful - * for scrolling content when there are many subviews, most of which are - * offscreen. For this property to be effective, it must be applied to a - * view that contains many subviews that extend outside its bound. The - * subviews must also have `overflow: hidden`, as should the containing view - * (or one of its superviews). - * - * See https://reactnative.dev/docs/view#removeclippedsubviews - */ - removeClippedSubviews: PropTypes.bool, - - /** - * Whether this `View` should render itself (and all of its children) into a - * single hardware texture on the GPU. - * - * @platform android - * - * See https://reactnative.dev/docs/view#rendertohardwaretextureandroid - */ - renderToHardwareTextureAndroid: PropTypes.bool, - - /** - * Whether this `View` should be rendered as a bitmap before compositing. - * - * @platform ios - * - * See https://reactnative.dev/docs/view#shouldrasterizeios - */ - shouldRasterizeIOS: PropTypes.bool, - - /** - * Views that are only used to layout their children or otherwise don't draw - * anything may be automatically removed from the native hierarchy as an - * optimization. Set this property to `false` to disable this optimization and - * ensure that this `View` exists in the native view hierarchy. - * - * @platform android - * - * See https://reactnative.dev/docs/view#collapsable - */ - collapsable: PropTypes.bool, - - /** - * Whether this `View` needs to rendered offscreen and composited with an - * alpha in order to preserve 100% correct colors and blending behavior. - * - * @platform android - * - * See https://reactnative.dev/docs/view#needsoffscreenalphacompositing - */ - needsOffscreenAlphaCompositing: PropTypes.bool, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js deleted file mode 100644 index 9e3ac51510feb8..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); -const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); -const ReactPropTypes = require('prop-types'); - -/** - * Warning: Some of these properties may not be supported in all releases. - */ -const DeprecatedViewStylePropTypes = { - ...DeprecatedLayoutPropTypes, - ...DeprecatedShadowPropTypesIOS, - ...DeprecatedTransformPropTypes, - backfaceVisibility: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - backgroundColor: DeprecatedColorPropType, - borderColor: DeprecatedColorPropType, - borderTopColor: DeprecatedColorPropType, - borderRightColor: DeprecatedColorPropType, - borderBottomColor: DeprecatedColorPropType, - borderLeftColor: DeprecatedColorPropType, - borderStartColor: DeprecatedColorPropType, - borderEndColor: DeprecatedColorPropType, - borderRadius: ReactPropTypes.number, - borderTopLeftRadius: ReactPropTypes.number, - borderTopRightRadius: ReactPropTypes.number, - borderTopStartRadius: ReactPropTypes.number, - borderTopEndRadius: ReactPropTypes.number, - borderBottomLeftRadius: ReactPropTypes.number, - borderBottomRightRadius: ReactPropTypes.number, - borderBottomStartRadius: ReactPropTypes.number, - borderBottomEndRadius: ReactPropTypes.number, - borderStyle: (ReactPropTypes.oneOf([ - 'solid', - 'dotted', - 'dashed', - ]): React$PropType$Primitive<'solid' | 'dotted' | 'dashed'>), - borderWidth: ReactPropTypes.number, - borderTopWidth: ReactPropTypes.number, - borderRightWidth: ReactPropTypes.number, - borderBottomWidth: ReactPropTypes.number, - borderLeftWidth: ReactPropTypes.number, - opacity: ReactPropTypes.number, - /** - * (Android-only) Sets the elevation of a view, using Android's underlying - * [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation). - * This adds a drop shadow to the item and affects z-order for overlapping views. - * Only supported on Android 5.0+, has no effect on earlier versions. - * @platform android - */ - elevation: ReactPropTypes.number, -}; - -module.exports = DeprecatedViewStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js b/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js deleted file mode 100644 index 384db2db80c1a1..00000000000000 --- a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const invariant = require('invariant'); - -function deprecatedCreateStrictShapeTypeChecker(shapeTypes: { - [key: string]: ReactPropsCheckType, - ... -}): ReactPropsChainableTypeChecker { - function checkType( - isRequired, - props, - propName, - componentName, - location?, - ...rest - ) { - if (!props[propName]) { - if (isRequired) { - invariant( - false, - `Required object \`${propName}\` was not specified in ` + - `\`${componentName}\`.`, - ); - } - return; - } - const propValue = props[propName]; - const propType = typeof propValue; - const locationName = location || '(unknown)'; - if (propType !== 'object') { - invariant( - false, - `Invalid ${locationName} \`${propName}\` of type \`${propType}\` ` + - `supplied to \`${componentName}\`, expected \`object\`.`, - ); - } - // We need to check all keys in case some are required but missing from - // props. - const allKeys = {...props[propName], ...shapeTypes}; - for (const key in allKeys) { - const checker = shapeTypes[key]; - if (!checker) { - invariant( - false, - `Invalid props.${propName} key \`${key}\` supplied to \`${componentName}\`.` + - '\nBad object: ' + - JSON.stringify(props[propName], null, ' ') + - '\nValid keys: ' + - JSON.stringify(Object.keys(shapeTypes), null, ' '), - ); - } - const error = checker(propValue, key, componentName, location, ...rest); - if (error) { - invariant( - false, - error.message + - '\nBad object: ' + - JSON.stringify(props[propName], null, ' '), - ); - } - } - } - function chainedCheckType( - props: {[key: string]: any, ...}, - propName: string, - componentName: string, - location?: string, - ...rest - ): ?Error { - return checkType(false, props, propName, componentName, location, ...rest); - } - chainedCheckType.isRequired = checkType.bind(null, true); - return chainedCheckType; -} - -module.exports = deprecatedCreateStrictShapeTypeChecker; diff --git a/flow-typed/npm/prop-types_v15.x.x.js b/flow-typed/npm/prop-types_v15.x.x.js deleted file mode 100644 index f5f6dba9e23852..00000000000000 --- a/flow-typed/npm/prop-types_v15.x.x.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @flow strict - * @nolint - * @format - */ - -// flow-typed signature: d9a983bb1ac458a256c31c139047bdbb -// flow-typed version: 927687984d/prop-types_v15.x.x/flow_>=v0.41.x - -type $npm$propTypes$ReactPropsCheckType = ( - props: any, - propName: string, - componentName: string, - href?: string, -) => ?Error; - -declare module 'prop-types' { - declare var array: React$PropType$Primitive>; - declare var bool: React$PropType$Primitive; - declare var func: React$PropType$Primitive; - declare var number: React$PropType$Primitive; - declare var object: React$PropType$Primitive; - declare var string: React$PropType$Primitive; - declare var symbol: React$PropType$Primitive; - declare var any: React$PropType$Primitive; - declare var arrayOf: React$PropType$ArrayOf; - declare var element: React$PropType$Primitive; /* TODO */ - declare var instanceOf: React$PropType$InstanceOf; - declare var node: React$PropType$Primitive; /* TODO */ - declare var objectOf: React$PropType$ObjectOf; - declare var oneOf: React$PropType$OneOf; - declare var oneOfType: React$PropType$OneOfType; - declare var shape: React$PropType$Shape; - - declare function checkPropTypes( - propTypes: {[_: $Keys]: $npm$propTypes$ReactPropsCheckType, ...}, - values: V, - location: string, - componentName: string, - getStack: ?() => ?string, - ): void; -} diff --git a/package.json b/package.json index 0e5b3257b36ee5..371ba14518cdc9 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,6 @@ "nullthrows": "^1.1.1", "pretty-format": "^26.5.2", "promise": "^8.0.3", - "prop-types": "^15.7.2", "react-devtools-core": "4.22.1", "react-refresh": "^0.4.0", "react-shallow-renderer": "16.14.1",