diff --git a/package.json b/package.json index a4c6f294a4295e..81387374f9c1c9 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@react-native/metro-babel-transformer": "0.77.0-main", "@react-native/metro-config": "0.77.0-main", "@tsconfig/node18": "1.0.1", - "@types/react": "^18.2.6", + "@types/react": "^19.0.0", "@typescript-eslint/parser": "^7.1.1", "ansi-styles": "^4.2.1", "babel-plugin-minify-dead-code-elimination": "^0.5.2", diff --git a/packages/eslint-config-react-native/index.js b/packages/eslint-config-react-native/index.js index 97c4e93a25f16d..241bbfa09f2c61 100644 --- a/packages/eslint-config-react-native/index.js +++ b/packages/eslint-config-react-native/index.js @@ -315,7 +315,6 @@ module.exports = { 'react/no-string-refs': 2, 'react/no-unknown-property': 0, 'react/no-unstable-nested-components': 1, - 'react/prop-types': 0, 'react/react-in-jsx-scope': 1, 'react/self-closing-comp': 1, 'react/wrap-multilines': 0, diff --git a/packages/react-native-popup-menu-android/package.json b/packages/react-native-popup-menu-android/package.json index 30cb2a1ed2be1e..c07e3fd1ad9fd0 100644 --- a/packages/react-native-popup-menu-android/package.json +++ b/packages/react-native-popup-menu-android/package.json @@ -20,7 +20,7 @@ "@react-native/codegen": "0.77.0-main" }, "peerDependencies": { - "@types/react": "^18.2.6", + "@types/react": "^19.0.0", "react": "*", "react-native": "*" }, diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts index 9f90951c884425..e6756ffadaae0b 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts @@ -105,7 +105,7 @@ export interface DrawerLayoutAndroidProps extends ViewProps { * The navigation view that will be rendered to the side of the * screen and can be pulled in. */ - renderNavigationView: () => JSX.Element; + renderNavigationView: () => React.JSX.Element; /** * Make the drawer take the entire screen and draw the background of diff --git a/packages/react-native/Libraries/Lists/FlatList.d.ts b/packages/react-native/Libraries/Lists/FlatList.d.ts index 7ab68d876621ec..3f0d764a67b077 100644 --- a/packages/react-native/Libraries/Lists/FlatList.d.ts +++ b/packages/react-native/Libraries/Lists/FlatList.d.ts @@ -222,7 +222,7 @@ export abstract class FlatListComponent< /** * Provides a handle to the underlying scroll responder. */ - getScrollResponder: () => JSX.Element | null | undefined; + getScrollResponder: () => React.JSX.Element | null | undefined; /** * Provides a reference to the underlying host component diff --git a/packages/react-native/types/__typetests__/index.tsx b/packages/react-native/types/__typetests__/index.tsx index 96ef6126d89a53..40f0f4523eb6a3 100644 --- a/packages/react-native/types/__typetests__/index.tsx +++ b/packages/react-native/types/__typetests__/index.tsx @@ -20,7 +20,6 @@ The content of index.io.js could be something like For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer */ -import * as PropTypes from 'prop-types'; import * as React from 'react'; import { AccessibilityInfo, @@ -625,7 +624,7 @@ export class TouchableNativeFeedbackTest extends React.Component { // PressableTest export class PressableTest extends React.Component<{}> { - private readonly myRef: React.RefObject = React.createRef(); + private readonly myRef: React.RefObject = React.createRef(); onPressButton = (e: GestureResponderEvent) => { e.persist(); @@ -806,7 +805,9 @@ export class FlatListTest extends React.Component, {}> { render() { return ( (this.list = list)} + ref={list => { + this.list = list; + }} data={[1, 2, 3, 4, 5]} renderItem={this._renderItem} ItemSeparatorComponent={this._renderSeparator} @@ -846,7 +847,7 @@ export class SectionListTest extends React.Component< SectionListProps, {} > { - myList: React.RefObject>; + myList: React.RefObject | null>; constructor(props: SectionListProps) { super(props); @@ -920,7 +921,7 @@ export class SectionListTypedSectionTest extends React.Component< SectionListProps, {} > { - myList: React.RefObject>; + myList: React.RefObject | null>; constructor(props: SectionListProps) { super(props); @@ -1248,7 +1249,9 @@ class TextInputTest extends React.Component<{}, {username: string}> { (this.username = input)} + ref={input => { + this.username = input; + }} textContentType="username" autoComplete="username" value={this.state.username} @@ -1535,10 +1538,6 @@ const NativeBridgedComponent = requireNativeComponent<{nativeProp: string}>( ); class BridgedComponentTest extends React.Component { - static propTypes = { - jsProp: PropTypes.string.isRequired, - }; - nativeComponentRef: React.ElementRef | null; callNativeMethod = () => { @@ -1563,7 +1562,9 @@ class BridgedComponentTest extends React.Component { (this.nativeComponentRef = ref)} + ref={ref => { + this.nativeComponentRef = ref; + }} /> ); } diff --git a/packages/virtualized-lists/package.json b/packages/virtualized-lists/package.json index 6dcce2e175c86f..d292128acb634b 100644 --- a/packages/virtualized-lists/package.json +++ b/packages/virtualized-lists/package.json @@ -27,7 +27,7 @@ "react-test-renderer": "19.0.0" }, "peerDependencies": { - "@types/react": "^18.2.6", + "@types/react": "^19.0.0", "react": "*", "react-native": "*" }, diff --git a/scripts/releases/__tests__/__fixtures__/set-version/packages/react-native/template/package.json b/scripts/releases/__tests__/__fixtures__/set-version/packages/react-native/template/package.json index 5472402ec93fa6..137db322263e8a 100644 --- a/scripts/releases/__tests__/__fixtures__/set-version/packages/react-native/template/package.json +++ b/scripts/releases/__tests__/__fixtures__/set-version/packages/react-native/template/package.json @@ -9,7 +9,7 @@ "devDependencies": { "@monorepo/pkg-a": "0.0.1", "@monorepo/pkg-c": "0.0.0", - "@types/react": "^18.2.6", - "@types/react-test-renderer": "^18.0.0" + "@types/react": "^19.0.0", + "@types/react-test-renderer": "^19.0.0" } } diff --git a/yarn.lock b/yarn.lock index 5b437f5031825f..33c459b9148863 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2093,17 +2093,11 @@ resolved "https://registry.yarnpkg.com/@types/parsimmon/-/parsimmon-1.10.9.tgz#14e60db223c1d213fea0e15985d480b5cfe1789a" integrity sha512-O2M2x1w+m7gWLen8i5DOy6tWRnbRcsW6Pke3j3HAsJUrPb4g0MgjksIUm2aqUtCYxy7Qjr3CzjjwQBzhiGn46A== -"@types/prop-types@*": - version "15.7.12" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6" - integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== - -"@types/react@^18.2.6": - version "18.3.5" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.5.tgz#5f524c2ad2089c0ff372bbdabc77ca2c4dbadf8f" - integrity sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA== +"@types/react@^19.0.0": + version "19.0.1" + resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.1.tgz#a000d5b78f473732a08cecbead0f3751e550b3df" + integrity sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ== dependencies: - "@types/prop-types" "*" csstype "^3.0.2" "@types/responselike@^1.0.0":