Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -26,21 +28,20 @@ import useAnimatedProps from '../useAnimatedProps';
import * as React from 'react';
import {cloneElement, useMemo} from 'react';

type AnimatedScrollViewProps = React.ElementConfig<typeof ScrollView>;
type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;

/**
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
const AnimatedScrollView: AnimatedComponentType<
AnimatedScrollViewProps,
ScrollViewProps,
AnimatedScrollViewInstance,
> = function AnimatedScrollViewWithOrWithoutInvertedRefreshControl({
ref: forwardedRef,
...props
}: {
ref?: React.RefSetter<AnimatedScrollViewInstance>,
...AnimatedProps<AnimatedScrollViewProps>,
...AnimatedProps<ScrollViewProps>,
}) {
// (Android only) When a ScrollView has a RefreshControl and
// any `style` property set with an Animated.Value, the CSS
Expand Down Expand Up @@ -111,7 +112,7 @@ const AnimatedScrollViewWithInvertedRefreshControl =

// Handle animated props on `NativeDirectionalScrollView`.
const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
AnimatedScrollViewProps,
ScrollViewProps,
AnimatedScrollViewInstance,
>(intermediatePropsForScrollView);
const ref = useMergeRefs<AnimatedScrollViewInstance>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof Text>,
React.ElementRef<typeof Text>,
>);
): AnimatedComponentType<TextProps, React.ElementRef<typeof Text>>);
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
* @format
*/

import type {ViewProps} from '../../Components/View/ViewPropTypes';
import type {AnimatedComponentType} from '../createAnimatedComponent';

import View from '../../Components/View/View';
import createAnimatedComponent from '../createAnimatedComponent';
import * as React from 'react';

export default (createAnimatedComponent(View): AnimatedComponentType<
React.ElementConfig<typeof View>,
ViewProps,
React.ElementRef<typeof View>,
>);
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -60,9 +60,7 @@ type NonAnimatedProps =
| 'disabled'
| 'accessibilityLabel';
type PassThroughProps = $ReadOnly<{
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
typeof View,
> | null,
passthroughAnimatedPropExplicitValues?: ViewProps | null,
}>;

export type AnimatedProps<Props: {...}> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @format
*/

import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {
GestureResponderEvent,
LayoutChangeEvent,
Expand All @@ -26,8 +27,6 @@ import useAndroidRippleForView, {
import * as React from 'react';
import {memo, useMemo, useRef, useState} from 'react';

type ViewStyleProp = React.ElementConfig<typeof View>['style'];

export type {PressableAndroidRippleConfig};

export type PressableStateCallbackType = $ReadOnly<{
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native/Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -181,8 +183,6 @@ type FlatListBaseProps<ItemT> = {
...OptionalProps<ItemT>,
};

type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;

export type FlatListProps<ItemT> = {
...Omit<
VirtualizedListProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ScrollView>;
type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
"type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
declare const AnimatedScrollView: AnimatedComponentType<
AnimatedScrollViewProps,
ScrollViewProps,
AnimatedScrollViewInstance,
>;
declare export default typeof AnimatedScrollView;
Expand All @@ -648,15 +647,15 @@ 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<typeof Text>,
TextProps,
React.ElementRef<typeof Text>,
>;
"
`;

exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedView.js 1`] = `
"declare export default AnimatedComponentType<
React.ElementConfig<typeof View>,
ViewProps,
React.ElementRef<typeof View>,
>;
"
Expand Down Expand Up @@ -695,9 +694,7 @@ type NonAnimatedProps =
| \\"disabled\\"
| \\"accessibilityLabel\\";
type PassThroughProps = $ReadOnly<{
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
typeof View,
> | null,
passthroughAnimatedPropExplicitValues?: ViewProps | null,
}>;
export type AnimatedProps<Props: { ... }> = {
[K in keyof Props]: K extends NonAnimatedProps
Expand Down Expand Up @@ -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<typeof View>[\\"style\\"];
export type { PressableAndroidRippleConfig };
"export type { PressableAndroidRippleConfig };
export type PressableStateCallbackType = $ReadOnly<{
pressed: boolean,
}>;
Expand Down Expand Up @@ -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<ItemT> = {
"type RequiredProps<ItemT> = {
data: ?$ReadOnly<$ArrayLike<ItemT>>,
};
type OptionalProps<ItemT> = {
Expand Down Expand Up @@ -4971,7 +4966,6 @@ type FlatListBaseProps<ItemT> = {
...RequiredProps<ItemT>,
...OptionalProps<ItemT>,
};
type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;
export type FlatListProps<ItemT> = {
...Omit<
VirtualizedListProps,
Expand Down
Loading