Skip to content

Commit 4368368

Browse files
cipolleschifacebook-github-bot
authored andcommittedDec 16, 2024··
Fix some peer dependencies on React types (#48292)
Summary: Pull Request resolved: #48292 These dependencies are making the CI on main to fail. ## Changelog: [General][Fixed] - Fix peer dependencies on React types Reviewed By: javache, hoxyq Differential Revision: D67283609 fbshipit-source-id: b325246f5de654a9ccbf7f96eec24434047a38ee
1 parent b662b1f commit 4368368

File tree

9 files changed

+23
-29
lines changed

9 files changed

+23
-29
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@react-native/metro-babel-transformer": "0.77.0-main",
5353
"@react-native/metro-config": "0.77.0-main",
5454
"@tsconfig/node18": "1.0.1",
55-
"@types/react": "^18.2.6",
55+
"@types/react": "^19.0.0",
5656
"@typescript-eslint/parser": "^7.1.1",
5757
"ansi-styles": "^4.2.1",
5858
"babel-plugin-minify-dead-code-elimination": "^0.5.2",

‎packages/eslint-config-react-native/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ module.exports = {
315315
'react/no-string-refs': 2,
316316
'react/no-unknown-property': 0,
317317
'react/no-unstable-nested-components': 1,
318-
'react/prop-types': 0,
319318
'react/react-in-jsx-scope': 1,
320319
'react/self-closing-comp': 1,
321320
'react/wrap-multilines': 0,

‎packages/react-native-popup-menu-android/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@react-native/codegen": "0.77.0-main"
2121
},
2222
"peerDependencies": {
23-
"@types/react": "^18.2.6",
23+
"@types/react": "^19.0.0",
2424
"react": "*",
2525
"react-native": "*"
2626
},

‎packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export interface DrawerLayoutAndroidProps extends ViewProps {
105105
* The navigation view that will be rendered to the side of the
106106
* screen and can be pulled in.
107107
*/
108-
renderNavigationView: () => JSX.Element;
108+
renderNavigationView: () => React.JSX.Element;
109109

110110
/**
111111
* Make the drawer take the entire screen and draw the background of

‎packages/react-native/Libraries/Lists/FlatList.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export abstract class FlatListComponent<
222222
/**
223223
* Provides a handle to the underlying scroll responder.
224224
*/
225-
getScrollResponder: () => JSX.Element | null | undefined;
225+
getScrollResponder: () => React.JSX.Element | null | undefined;
226226

227227
/**
228228
* Provides a reference to the underlying host component

‎packages/react-native/types/__typetests__/index.tsx

+12-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ The content of index.io.js could be something like
2020
For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer
2121
*/
2222

23-
import * as PropTypes from 'prop-types';
2423
import * as React from 'react';
2524
import {
2625
AccessibilityInfo,
@@ -625,7 +624,7 @@ export class TouchableNativeFeedbackTest extends React.Component {
625624

626625
// PressableTest
627626
export class PressableTest extends React.Component<{}> {
628-
private readonly myRef: React.RefObject<View> = React.createRef();
627+
private readonly myRef: React.RefObject<View | null> = React.createRef();
629628

630629
onPressButton = (e: GestureResponderEvent) => {
631630
e.persist();
@@ -806,7 +805,9 @@ export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
806805
render() {
807806
return (
808807
<FlatList
809-
ref={list => (this.list = list)}
808+
ref={list => {
809+
this.list = list;
810+
}}
810811
data={[1, 2, 3, 4, 5]}
811812
renderItem={this._renderItem}
812813
ItemSeparatorComponent={this._renderSeparator}
@@ -846,7 +847,7 @@ export class SectionListTest extends React.Component<
846847
SectionListProps<string>,
847848
{}
848849
> {
849-
myList: React.RefObject<SectionList<string>>;
850+
myList: React.RefObject<SectionList<string> | null>;
850851

851852
constructor(props: SectionListProps<string>) {
852853
super(props);
@@ -920,7 +921,7 @@ export class SectionListTypedSectionTest extends React.Component<
920921
SectionListProps<string, SectionT>,
921922
{}
922923
> {
923-
myList: React.RefObject<SectionList<string, SectionT>>;
924+
myList: React.RefObject<SectionList<string, SectionT> | null>;
924925

925926
constructor(props: SectionListProps<string, SectionT>) {
926927
super(props);
@@ -1248,7 +1249,9 @@ class TextInputTest extends React.Component<{}, {username: string}> {
12481249
</Text>
12491250

12501251
<TextInput
1251-
ref={input => (this.username = input)}
1252+
ref={input => {
1253+
this.username = input;
1254+
}}
12521255
textContentType="username"
12531256
autoComplete="username"
12541257
value={this.state.username}
@@ -1535,10 +1538,6 @@ const NativeBridgedComponent = requireNativeComponent<{nativeProp: string}>(
15351538
);
15361539

15371540
class BridgedComponentTest extends React.Component {
1538-
static propTypes = {
1539-
jsProp: PropTypes.string.isRequired,
1540-
};
1541-
15421541
nativeComponentRef: React.ElementRef<typeof NativeBridgedComponent> | null;
15431542

15441543
callNativeMethod = () => {
@@ -1563,7 +1562,9 @@ class BridgedComponentTest extends React.Component {
15631562
<NativeBridgedComponent
15641563
{...this.props}
15651564
nativeProp="test"
1566-
ref={ref => (this.nativeComponentRef = ref)}
1565+
ref={ref => {
1566+
this.nativeComponentRef = ref;
1567+
}}
15671568
/>
15681569
);
15691570
}

‎packages/virtualized-lists/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"react-test-renderer": "19.0.0"
2828
},
2929
"peerDependencies": {
30-
"@types/react": "^18.2.6",
30+
"@types/react": "^19.0.0",
3131
"react": "*",
3232
"react-native": "*"
3333
},

‎scripts/releases/__tests__/__fixtures__/set-version/packages/react-native/template/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"devDependencies": {
1010
"@monorepo/pkg-a": "0.0.1",
1111
"@monorepo/pkg-c": "0.0.0",
12-
"@types/react": "^18.2.6",
13-
"@types/react-test-renderer": "^18.0.0"
12+
"@types/react": "^19.0.0",
13+
"@types/react-test-renderer": "^19.0.0"
1414
}
1515
}

‎yarn.lock

+4-10
Original file line numberDiff line numberDiff line change
@@ -2093,17 +2093,11 @@
20932093
resolved "https://registry.yarnpkg.com/@types/parsimmon/-/parsimmon-1.10.9.tgz#14e60db223c1d213fea0e15985d480b5cfe1789a"
20942094
integrity sha512-O2M2x1w+m7gWLen8i5DOy6tWRnbRcsW6Pke3j3HAsJUrPb4g0MgjksIUm2aqUtCYxy7Qjr3CzjjwQBzhiGn46A==
20952095

2096-
"@types/prop-types@*":
2097-
version "15.7.12"
2098-
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6"
2099-
integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==
2100-
2101-
"@types/react@^18.2.6":
2102-
version "18.3.5"
2103-
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.5.tgz#5f524c2ad2089c0ff372bbdabc77ca2c4dbadf8f"
2104-
integrity sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==
2096+
"@types/react@^19.0.0":
2097+
version "19.0.1"
2098+
resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.1.tgz#a000d5b78f473732a08cecbead0f3751e550b3df"
2099+
integrity sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ==
21052100
dependencies:
2106-
"@types/prop-types" "*"
21072101
csstype "^3.0.2"
21082102

21092103
"@types/responselike@^1.0.0":

0 commit comments

Comments
 (0)
Please sign in to comment.