mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add ScrollViewBaseProps and small type changes to align Flow with TS (#50374)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50374 This diff breaks down ScrollView props into ScrollViewBaseProps to generate more readable TS types, re-exports AnimatedComponent and sets the default SectionList Item type to `any`. Changelog: [Internal] Reviewed By: huntie Differential Revision: D72061941 fbshipit-source-id: 439fcdb1540288d6e610cd535b1fed82243c3b7c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
522e8e74d5
commit
6fc52b61bb
@@ -38,6 +38,7 @@ export type {default as AnimatedModulo} from './nodes/AnimatedModulo';
|
||||
export type {default as AnimatedMultiplication} from './nodes/AnimatedMultiplication';
|
||||
export type {default as AnimatedSubtraction} from './nodes/AnimatedSubtraction';
|
||||
export type {WithAnimatedValue} from './createAnimatedComponent';
|
||||
export type {AnimatedComponentType as AnimatedComponent} from './createAnimatedComponent';
|
||||
|
||||
export const add = AnimatedImplementation.add;
|
||||
export const attachNativeEvent = AnimatedImplementation.attachNativeEvent;
|
||||
|
||||
@@ -390,11 +390,7 @@ type StickyHeaderComponentType = component(
|
||||
...ScrollViewStickyHeaderProps
|
||||
);
|
||||
|
||||
export type ScrollViewProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
...ScrollViewPropsIOS,
|
||||
...ScrollViewPropsAndroid,
|
||||
|
||||
type ScrollViewBaseProps = $ReadOnly<{
|
||||
/**
|
||||
* These styles will be applied to the scroll view content container which
|
||||
* wraps all of the child views. Example:
|
||||
@@ -672,6 +668,13 @@ export type ScrollViewProps = $ReadOnly<{
|
||||
scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
|
||||
}>;
|
||||
|
||||
export type ScrollViewProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
...ScrollViewPropsIOS,
|
||||
...ScrollViewPropsAndroid,
|
||||
...ScrollViewBaseProps,
|
||||
}>;
|
||||
|
||||
type ScrollViewState = {
|
||||
layoutHeight: ?number,
|
||||
};
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ export type SectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
*
|
||||
*/
|
||||
export default class SectionList<
|
||||
ItemT,
|
||||
ItemT = any,
|
||||
SectionT = DefaultSectionT,
|
||||
> extends React.PureComponent<SectionListProps<ItemT, SectionT>> {
|
||||
props: SectionListProps<ItemT, SectionT>;
|
||||
|
||||
@@ -191,6 +191,7 @@ export type { default as AnimatedModulo } from \\"./nodes/AnimatedModulo\\";
|
||||
export type { default as AnimatedMultiplication } from \\"./nodes/AnimatedMultiplication\\";
|
||||
export type { default as AnimatedSubtraction } from \\"./nodes/AnimatedSubtraction\\";
|
||||
export type { WithAnimatedValue } from \\"./createAnimatedComponent\\";
|
||||
export type { AnimatedComponentType as AnimatedComponent } from \\"./createAnimatedComponent\\";
|
||||
declare export const add: $FlowFixMe;
|
||||
declare export const attachNativeEvent: $FlowFixMe;
|
||||
declare export const createAnimatedComponent: $FlowFixMe;
|
||||
@@ -2020,10 +2021,7 @@ type StickyHeaderComponentType = component(
|
||||
>,
|
||||
...ScrollViewStickyHeaderProps
|
||||
);
|
||||
export type ScrollViewProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
...ScrollViewPropsIOS,
|
||||
...ScrollViewPropsAndroid,
|
||||
type ScrollViewBaseProps = $ReadOnly<{
|
||||
contentContainerStyle?: ?ViewStyleProp,
|
||||
contentOffset?: ?PointProp,
|
||||
disableIntervalMomentum?: ?boolean,
|
||||
@@ -2065,6 +2063,12 @@ export type ScrollViewProps = $ReadOnly<{
|
||||
innerViewRef?: React.RefSetter<InnerViewInstance>,
|
||||
scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
|
||||
}>;
|
||||
export type ScrollViewProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
...ScrollViewPropsIOS,
|
||||
...ScrollViewPropsAndroid,
|
||||
...ScrollViewBaseProps,
|
||||
}>;
|
||||
export type ScrollViewComponentStatics = $ReadOnly<{
|
||||
Context: typeof ScrollViewContext,
|
||||
}>;
|
||||
@@ -5011,8 +5015,10 @@ export type SectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
...RequiredProps<ItemT, SectionT>,
|
||||
...OptionalProps<ItemT, SectionT>,
|
||||
};
|
||||
declare export default class SectionList<ItemT, SectionT = DefaultSectionT>
|
||||
extends React.PureComponent<SectionListProps<ItemT, SectionT>>
|
||||
declare export default class SectionList<
|
||||
ItemT = any,
|
||||
SectionT = DefaultSectionT,
|
||||
> extends React.PureComponent<SectionListProps<ItemT, SectionT>>
|
||||
{
|
||||
props: SectionListProps<ItemT, SectionT>;
|
||||
scrollToLocation(params: ScrollToLocationParamsType): void;
|
||||
|
||||
Reference in New Issue
Block a user