diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index fc9153f27cb714..cef22cd810fd45 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -35,18 +35,18 @@ export type StrictAnimatedProps = $ReadOnly<{ passthroughAnimatedPropExplicitValues?: ?Props, }>; -export type AnimatedComponentType< - Props: {...}, - +Instance = mixed, -> = React.AbstractComponent, Instance>; +export type AnimatedComponentType = component( + ref: React.RefSetter, + ...AnimatedProps +); export type StrictAnimatedComponentType< Props: {...}, +Instance = mixed, -> = React.AbstractComponent, Instance>; +> = component(ref: React.RefSetter, ...StrictAnimatedProps); export default function createAnimatedComponent( - Component: React.AbstractComponent, + Component: component(ref: React.RefSetter, ...TProps), ): AnimatedComponentType { return unstable_createAnimatedComponentWithAllowlist(Component, null); } @@ -55,7 +55,7 @@ export function unstable_createAnimatedComponentWithAllowlist< TProps: {...}, TInstance, >( - Component: React.AbstractComponent, + Component: component(ref: React.RefSetter, ...TProps), allowlist: ?AnimatedPropsAllowlist, ): StrictAnimatedComponentType { const AnimatedComponent = React.forwardRef< diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index d60e87f4ec7a8e..d83abfe57a2b6e 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -275,12 +275,12 @@ const ScrollViewStickyHeaderWithForwardedRef: component( : null; return ( - /* $FlowFixMe[prop-missing] passthroughAnimatedPropExplicitValues isn't properly - included in the Animated.View flow type. */ { this.props.onPress !== undefined && !this.props.disabled } + // $FlowFixMe[prop-missing] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {this.props.children} diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 92eea6cb3fc7f7..ef9b2572b69cb8 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -291,6 +291,7 @@ class TouchableOpacity extends React.Component { this.props.onPress !== undefined && !this.props.disabled } + // $FlowFixMe[prop-missing] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {this.props.children} diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 2d4318f27da998..788eead2c914ed 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -16,7 +16,7 @@ import type { SectionBase as _SectionBase, VirtualizedSectionListProps, } from '@react-native/virtualized-lists'; -import type {AbstractComponent, ElementRef} from 'react'; +import type {ElementRef} from 'react'; import Platform from '../Utilities/Platform'; import {VirtualizedSectionList} from '@react-native/virtualized-lists'; 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 8e7ddf433140fb..b64fde6390c76e 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 @@ -744,22 +744,22 @@ export type StrictAnimatedProps = $ReadOnly<{ export type AnimatedComponentType< Props: { ... }, +Instance = mixed, -> = React.AbstractComponent, Instance>; +> = component(ref: React.RefSetter, ...AnimatedProps); export type StrictAnimatedComponentType< Props: { ... }, +Instance = mixed, -> = React.AbstractComponent, Instance>; +> = component(ref: React.RefSetter, ...StrictAnimatedProps); declare export default function createAnimatedComponent< TProps: { ... }, TInstance, >( - Component: React.AbstractComponent + Component: component(ref: React.RefSetter, ...TProps) ): AnimatedComponentType; declare export function unstable_createAnimatedComponentWithAllowlist< TProps: { ... }, TInstance, >( - Component: React.AbstractComponent, + Component: component(ref: React.RefSetter, ...TProps), allowlist: ?AnimatedPropsAllowlist ): StrictAnimatedComponentType; "