Skip to content

Commit 228cb80

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Remove Deprecated Prop Types (#42019)
Summary: Pull Request resolved: #42019 Removes the following deprecated properties from React Native: - `Image.propTypes` - `Text.propTypes` - `TextInput.propTypes` - `ColorPropType` - `EdgeInsetsPropType` - `PointPropType` - `ViewPropTypes` The deprecation history for these prop types is not super obvious, so here is a summary: - `[email protected]` extracted `prop-types` into a separate package to reflect that not everybody uses them. - `[email protected]` added a deprecation warning to built-in prop types. (3f62904) - `[email protected]` removed built-in prop types. (3e229f2) - `[email protected]` restored built-in prop types, along with bug fixes to isolate deprecated usage. (b966d29) We believe that by the next public release, enough time will have passed for the community to be able to upgrade without patching React Native or otherwise working around the removal of these deprecated prop types. **If anyone has trouble identifying the source of a deleted prop types usage, please file an issue so we can help track it down with you.** Changelog: [General][Removed] - Removed deprecated prop types Reviewed By: lunaleaps, NickGerleman Differential Revision: D52337762 fbshipit-source-id: 9731f7e1dec29f3df535ab75cc50bed001fdfa0b
1 parent 2b63b9b commit 228cb80

File tree

8 files changed

+0
-86
lines changed

8 files changed

+0
-86
lines changed

.circleci/verdaccio.yml

-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ uplinks:
1515
maxSockets: 40
1616
maxFreeSockets: 10
1717
packages:
18-
# Get @react-native/normalize-colors from npm registry, since its used in deprecated-react-native-prop-types package
19-
'@react-native/normalize-colors':
20-
access: $all
21-
publish: $authenticated
22-
proxy: npmjs
2318
# Group and isolate all local packages, avoid being proxy from outside
2419
'@react-native/*':
2520
access: $all

packages/react-native/Libraries/Components/TextInput/TextInput.js

-7
Original file line numberDiff line numberDiff line change
@@ -1752,13 +1752,6 @@ const ExportedForwardRef: React.AbstractComponent<
17521752

17531753
ExportedForwardRef.displayName = 'TextInput';
17541754

1755-
/**
1756-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
1757-
* releases. This is deprecated and will be removed in the future.
1758-
*/
1759-
ExportedForwardRef.propTypes =
1760-
require('deprecated-react-native-prop-types').TextInputPropTypes;
1761-
17621755
// $FlowFixMe[prop-missing]
17631756
ExportedForwardRef.State = {
17641757
currentlyFocusedInput: TextInputState.currentlyFocusedInput,

packages/react-native/Libraries/Image/Image.android.js

-6
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,6 @@ Image.queryCache = queryCache;
312312
// $FlowFixMe[incompatible-use] This property isn't writable but we're actually defining it here for the first time.
313313
Image.resolveAssetSource = resolveAssetSource;
314314

315-
/**
316-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
317-
* releases. This is deprecated and will be removed in the future.
318-
*/
319-
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
320-
321315
const styles = StyleSheet.create({
322316
base: {
323317
overflow: 'hidden',

packages/react-native/Libraries/Image/Image.ios.js

-6
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,6 @@ Image.queryCache = queryCache;
246246
// $FlowFixMe[incompatible-use] This property isn't writable but we're actually defining it here for the first time.
247247
Image.resolveAssetSource = resolveAssetSource;
248248

249-
/**
250-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
251-
* releases. This is deprecated and will be removed in the future.
252-
*/
253-
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
254-
255249
const styles = StyleSheet.create({
256250
base: {
257251
overflow: 'hidden',

packages/react-native/Libraries/Text/Text.js

-6
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ const Text: React.AbstractComponent<
286286

287287
Text.displayName = 'Text';
288288

289-
/**
290-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
291-
* releases. This is deprecated and will be removed in the future.
292-
*/
293-
Text.propTypes = require('deprecated-react-native-prop-types').TextPropTypes;
294-
295289
/**
296290
* Returns false until the first time `newValue` is true, after which this will
297291
* always return true. This is necessary to lazily initialize `Pressability` so

packages/react-native/index.js

-41
Original file line numberDiff line numberDiff line change
@@ -375,47 +375,6 @@ module.exports = {
375375
'LogBox is enabled by default so there is no need to call unstable_enableLogBox() anymore. This is a no op and will be removed in the next version.',
376376
);
377377
},
378-
// Deprecated Prop Types
379-
get ColorPropType(): $FlowFixMe {
380-
console.error(
381-
'ColorPropType will be removed from React Native, along with all ' +
382-
'other PropTypes. We recommend that you migrate away from PropTypes ' +
383-
'and switch to a type system like TypeScript. If you need to ' +
384-
'continue using ColorPropType, migrate to the ' +
385-
"'deprecated-react-native-prop-types' package.",
386-
);
387-
return require('deprecated-react-native-prop-types').ColorPropType;
388-
},
389-
get EdgeInsetsPropType(): $FlowFixMe {
390-
console.error(
391-
'EdgeInsetsPropType will be removed from React Native, along with all ' +
392-
'other PropTypes. We recommend that you migrate away from PropTypes ' +
393-
'and switch to a type system like TypeScript. If you need to ' +
394-
'continue using EdgeInsetsPropType, migrate to the ' +
395-
"'deprecated-react-native-prop-types' package.",
396-
);
397-
return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
398-
},
399-
get PointPropType(): $FlowFixMe {
400-
console.error(
401-
'PointPropType will be removed from React Native, along with all ' +
402-
'other PropTypes. We recommend that you migrate away from PropTypes ' +
403-
'and switch to a type system like TypeScript. If you need to ' +
404-
'continue using PointPropType, migrate to the ' +
405-
"'deprecated-react-native-prop-types' package.",
406-
);
407-
return require('deprecated-react-native-prop-types').PointPropType;
408-
},
409-
get ViewPropTypes(): $FlowFixMe {
410-
console.error(
411-
'ViewPropTypes will be removed from React Native, along with all ' +
412-
'other PropTypes. We recommend that you migrate away from PropTypes ' +
413-
'and switch to a type system like TypeScript. If you need to ' +
414-
'continue using ViewPropTypes, migrate to the ' +
415-
"'deprecated-react-native-prop-types' package.",
416-
);
417-
return require('deprecated-react-native-prop-types').ViewPropTypes;
418-
},
419378
};
420379

421380
if (__DEV__) {

packages/react-native/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"anser": "^1.4.9",
110110
"ansi-regex": "^5.0.0",
111111
"base64-js": "^1.5.1",
112-
"deprecated-react-native-prop-types": "^5.0.0",
113112
"event-target-shim": "^5.0.1",
114113
"flow-enums-runtime": "^0.0.6",
115114
"invariant": "^2.2.4",

yarn.lock

-14
Original file line numberDiff line numberDiff line change
@@ -2537,11 +2537,6 @@
25372537
prompts "^2.4.2"
25382538
semver "^7.5.2"
25392539

2540-
"@react-native/normalize-colors@^0.73.0":
2541-
version "0.73.2"
2542-
resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.73.2.tgz#cc8e48fbae2bbfff53e12f209369e8d2e4cf34ec"
2543-
integrity sha512-bRBcb2T+I88aG74LMVHaKms2p/T8aQd8+BZ7LuuzXlRfog1bMWWn/C5i0HVuvW4RPtXQYgIlGiXVDy9Ir1So/w==
2544-
25452540
"@rnx-kit/chromium-edge-launcher@^1.0.0":
25462541
version "1.0.0"
25472542
resolved "https://registry.yarnpkg.com/@rnx-kit/chromium-edge-launcher/-/chromium-edge-launcher-1.0.0.tgz#c0df8ea00a902c7a417cd9655aab06de398b939c"
@@ -4333,15 +4328,6 @@ [email protected]:
43334328
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
43344329
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
43354330

4336-
deprecated-react-native-prop-types@^5.0.0:
4337-
version "5.0.0"
4338-
resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-5.0.0.tgz#02a12f090da7bd9e8c3ac53c31cf786a1315d302"
4339-
integrity sha512-cIK8KYiiGVOFsKdPMmm1L3tA/Gl+JopXL6F5+C7x39MyPsQYnP57Im/D6bNUzcborD7fcMwiwZqcBdBXXZucYQ==
4340-
dependencies:
4341-
"@react-native/normalize-colors" "^0.73.0"
4342-
invariant "^2.2.4"
4343-
prop-types "^15.8.1"
4344-
43454331
deprecation@^2.0.0, deprecation@^2.3.1:
43464332
version "2.3.1"
43474333
resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919"

0 commit comments

Comments
 (0)