diff --git a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js index 14d672d97ddb73..7aa92833b67d8b 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js @@ -15,7 +15,9 @@ import type { } from '../createAnimatedComponent'; import RefreshControl from '../../Components/RefreshControl/RefreshControl'; -import ScrollView from '../../Components/ScrollView/ScrollView'; +import ScrollView, { + type ScrollViewProps, +} from '../../Components/ScrollView/ScrollView'; import flattenStyle from '../../StyleSheet/flattenStyle'; import splitLayoutProps from '../../StyleSheet/splitLayoutProps'; import StyleSheet from '../../StyleSheet/StyleSheet'; @@ -26,21 +28,20 @@ import useAnimatedProps from '../useAnimatedProps'; import * as React from 'react'; import {cloneElement, useMemo} from 'react'; -type AnimatedScrollViewProps = React.ElementConfig; type AnimatedScrollViewInstance = React.ElementRef; /** * @see https://github.com/facebook/react-native/commit/b8c8562 */ const AnimatedScrollView: AnimatedComponentType< - AnimatedScrollViewProps, + ScrollViewProps, AnimatedScrollViewInstance, > = function AnimatedScrollViewWithOrWithoutInvertedRefreshControl({ ref: forwardedRef, ...props }: { ref?: React.RefSetter, - ...AnimatedProps, + ...AnimatedProps, }) { // (Android only) When a ScrollView has a RefreshControl and // any `style` property set with an Animated.Value, the CSS @@ -111,7 +112,7 @@ const AnimatedScrollViewWithInvertedRefreshControl = // Handle animated props on `NativeDirectionalScrollView`. const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps< - AnimatedScrollViewProps, + ScrollViewProps, AnimatedScrollViewInstance, >(intermediatePropsForScrollView); const ref = useMergeRefs( diff --git a/packages/react-native/Libraries/Animated/components/AnimatedText.js b/packages/react-native/Libraries/Animated/components/AnimatedText.js index 02679f1a8013a9..d4223e7701922c 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedText.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedText.js @@ -10,13 +10,10 @@ import type {AnimatedComponentType} from '../createAnimatedComponent'; -import Text from '../../Text/Text'; +import Text, {type TextProps} from '../../Text/Text'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; export default (createAnimatedComponent( (Text: $FlowFixMe), -): AnimatedComponentType< - React.ElementConfig, - React.ElementRef, ->); +): AnimatedComponentType>); diff --git a/packages/react-native/Libraries/Animated/components/AnimatedView.js b/packages/react-native/Libraries/Animated/components/AnimatedView.js index 5eca94417e67da..bd2a7875785e41 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedView.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedView.js @@ -8,6 +8,7 @@ * @format */ +import type {ViewProps} from '../../Components/View/ViewPropTypes'; import type {AnimatedComponentType} from '../createAnimatedComponent'; import View from '../../Components/View/View'; @@ -15,6 +16,6 @@ import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; export default (createAnimatedComponent(View): AnimatedComponentType< - React.ElementConfig, + ViewProps, React.ElementRef, >); diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index 062218132a00a0..345c1ac29ab3ea 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -21,7 +21,7 @@ import type AnimatedValue from './nodes/AnimatedValue'; import createAnimatedPropsHook from '../../src/private/animated/createAnimatedPropsHook'; import composeStyles from '../../src/private/styles/composeStyles'; -import View from '../Components/View/View'; +import {type ViewProps} from '../Components/View/ViewPropTypes'; import useMergeRefs from '../Utilities/useMergeRefs'; import * as React from 'react'; import {useMemo} from 'react'; @@ -60,9 +60,7 @@ type NonAnimatedProps = | 'disabled' | 'accessibilityLabel'; type PassThroughProps = $ReadOnly<{ - passthroughAnimatedPropExplicitValues?: React.ElementConfig< - typeof View, - > | null, + passthroughAnimatedPropExplicitValues?: ViewProps | null, }>; export type AnimatedProps = { diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index ec2d1f6f892957..f994e0e929f4bc 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -8,6 +8,7 @@ * @format */ +import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import type { GestureResponderEvent, LayoutChangeEvent, @@ -26,8 +27,6 @@ import useAndroidRippleForView, { import * as React from 'react'; import {memo, useMemo, useRef, useState} from 'react'; -type ViewStyleProp = React.ElementConfig['style']; - export type {PressableAndroidRippleConfig}; export type PressableStateCallbackType = $ReadOnly<{ diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index f3e28fbce8c894..32d3fd20e94f92 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -20,7 +20,9 @@ import type { import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import {type ScrollResponderType} from '../Components/ScrollView/ScrollView'; import View from '../Components/View/View'; -import VirtualizedLists from '@react-native/virtualized-lists'; +import VirtualizedLists, { + type VirtualizedListProps, +} from '@react-native/virtualized-lists'; import memoizeOne from 'memoize-one'; import * as React from 'react'; @@ -181,8 +183,6 @@ type FlatListBaseProps = { ...OptionalProps, }; -type VirtualizedListProps = React.ElementConfig; - export type FlatListProps = { ...Omit< VirtualizedListProps, 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 6243b50bfeff85..d19f364f5e487e 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 @@ -628,10 +628,9 @@ exports[`public API should not change unintentionally Libraries/Animated/compone `; exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedScrollView.js 1`] = ` -"type AnimatedScrollViewProps = React.ElementConfig; -type AnimatedScrollViewInstance = React.ElementRef; +"type AnimatedScrollViewInstance = React.ElementRef; declare const AnimatedScrollView: AnimatedComponentType< - AnimatedScrollViewProps, + ScrollViewProps, AnimatedScrollViewInstance, >; declare export default typeof AnimatedScrollView; @@ -648,7 +647,7 @@ exports[`public API should not change unintentionally Libraries/Animated/compone exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedText.js 1`] = ` "declare export default AnimatedComponentType< - React.ElementConfig, + TextProps, React.ElementRef, >; " @@ -656,7 +655,7 @@ exports[`public API should not change unintentionally Libraries/Animated/compone exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedView.js 1`] = ` "declare export default AnimatedComponentType< - React.ElementConfig, + ViewProps, React.ElementRef, >; " @@ -695,9 +694,7 @@ type NonAnimatedProps = | \\"disabled\\" | \\"accessibilityLabel\\"; type PassThroughProps = $ReadOnly<{ - passthroughAnimatedPropExplicitValues?: React.ElementConfig< - typeof View, - > | null, + passthroughAnimatedPropExplicitValues?: ViewProps | null, }>; export type AnimatedProps = { [K in keyof Props]: K extends NonAnimatedProps @@ -1757,8 +1754,7 @@ declare export default typeof LayoutConformanceNativeComponent; `; exports[`public API should not change unintentionally Libraries/Components/Pressable/Pressable.js 1`] = ` -"type ViewStyleProp = React.ElementConfig[\\"style\\"]; -export type { PressableAndroidRippleConfig }; +"export type { PressableAndroidRippleConfig }; export type PressableStateCallbackType = $ReadOnly<{ pressed: boolean, }>; @@ -4940,8 +4936,7 @@ declare export default typeof FillRateHelper; `; exports[`public API should not change unintentionally Libraries/Lists/FlatList.js 1`] = ` -"declare const VirtualizedList: typeof VirtualizedLists.VirtualizedList; -type RequiredProps = { +"type RequiredProps = { data: ?$ReadOnly<$ArrayLike>, }; type OptionalProps = { @@ -4971,7 +4966,6 @@ type FlatListBaseProps = { ...RequiredProps, ...OptionalProps, }; -type VirtualizedListProps = React.ElementConfig; export type FlatListProps = { ...Omit< VirtualizedListProps,