diff --git a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js index 1d7072636a48a8..aa1aecf3d2242c 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js @@ -38,7 +38,7 @@ export type ModuleProps = $ReadOnly<{| |}>; export const Commands = codegenNativeCommands<{ - +hotspotUpdate: (ref: React.Ref<'RCTView'>, x: Int32, y: Int32) => void, + +hotspotUpdate: (ref: React.RefSetter<'RCTView'>, x: Int32, y: Int32) => void, }>({ supportedCommands: ['hotspotUpdate'], }); @@ -69,7 +69,7 @@ import type {ViewProps} from 'ViewPropTypes'; import type {HostComponent} from 'react-native'; interface NativeCommands { - +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + +hotspotUpdate: (viewRef: React.RefSetter<'RCTView'>, x: Int32, y: Int32) => void; } export type ModuleProps = $ReadOnly<{| @@ -148,7 +148,7 @@ import type {ViewProps} from 'ViewPropTypes'; import type {HostComponent} from 'react-native'; interface NativeCommands { - +hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + +hotspotUpdate: (viewRef: ?React.RefSetter<'RCTView'>, x: Int32, y: Int32) => void; } export type ModuleProps = $ReadOnly<{| @@ -186,9 +186,9 @@ import type {ViewProps} from 'ViewPropTypes'; import type {HostComponent} from 'react-native'; interface NativeCommands { - +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + +hotspotUpdate: (viewRef: React.RefSetter<'RCTView'>, x: Int32, y: Int32) => void; +scrollTo: ( - viewRef: React.Ref<'RCTView'>, + viewRef: React.RefSetter<'RCTView'>, y: Int32, animated: boolean, ) => void; @@ -229,9 +229,9 @@ import type {ViewProps} from 'ViewPropTypes'; import type {HostComponent} from 'react-native'; interface NativeCommands { - +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + +hotspotUpdate: (viewRef: React.RefSetter<'RCTView'>, x: Int32, y: Int32) => void; +scrollTo: ( - viewRef: React.Ref<'RCTView'>, + viewRef: React.RefSetter<'RCTView'>, y: Int32, animated: boolean, ) => void; diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index a34a432a55f26c..3987a7ea3e5e37 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -85,7 +85,9 @@ const ProgressBarAndroid = ( animating = true, ...restProps }: ProgressBarAndroidProps, - forwardedRef: ?React.Ref, + forwardedRef: ?React.RefSetter< + React.ElementRef, + >, ) => { return ( , + hostRef: React.RefSetter>, |}>; type State = $ReadOnly<{| diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index 61e9f210110a1d..e59b2954e91a7e 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -44,7 +44,7 @@ type Props = $ReadOnly<{| onHideUnderlay?: ?() => void, testOnly_pressed?: ?boolean, - hostRef: React.Ref, + hostRef: React.RefSetter>, |}>; type ExtraStyles = $ReadOnly<{| @@ -382,7 +382,7 @@ class TouchableHighlight extends React.Component { } const Touchable: React.AbstractComponent< - $ReadOnly<$Diff|}>>, + $ReadOnly<$Diff>, React.ElementRef, > = React.forwardRef((props, hostRef) => ( diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 14ca87aba403cd..f047f91c02012a 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -37,7 +37,7 @@ type Props = $ReadOnly<{| activeOpacity?: ?number, style?: ?ViewStyleProp, - hostRef?: ?React.Ref, + hostRef?: ?React.RefSetter>, |}>; type State = $ReadOnly<{| diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 7fd38d248d6f12..416f975e52d255 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -3647,7 +3647,7 @@ exports[`public API should not change unintentionally Libraries/Components/Touch releaseBounciness?: ?number, releaseVelocity?: ?number, style?: ?ViewStyleProp, - hostRef: React.Ref, + hostRef: React.RefSetter>, |}>; declare module.exports: React.AbstractComponent< $ReadOnly<$Diff>, @@ -3676,10 +3676,10 @@ type Props = $ReadOnly<{| onShowUnderlay?: ?() => void, onHideUnderlay?: ?() => void, testOnly_pressed?: ?boolean, - hostRef: React.Ref, + hostRef: React.RefSetter>, |}>; declare const Touchable: React.AbstractComponent< - $ReadOnly<$Diff |}>>, + $ReadOnly<$Diff>, React.ElementRef, >; declare module.exports: Touchable; @@ -3764,7 +3764,7 @@ type Props = $ReadOnly<{| ...TVProps, activeOpacity?: ?number, style?: ?ViewStyleProp, - hostRef?: ?React.Ref, + hostRef?: ?React.RefSetter>, |}>; declare const Touchable: React.AbstractComponent< Props,