Skip to content

Commit 92e2168

Browse files
coadofacebook-github-bot
authored andcommitted
Add RefreshControl to buildTypes and align Flow with TS types (#49564)
Summary: Pull Request resolved: #49564 Changelog: [Internal] - Added RefreshControl to buildTypes and aligned Flow with TS types Reviewed By: huntie Differential Revision: D69924368 fbshipit-source-id: 1a01ede28f9d0729c483036f8d3f9c9eced58286
1 parent 5c1e01f commit 92e2168

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import React from 'react';
2121

2222
const Platform = require('../../Utilities/Platform').default;
2323

24-
type IOSProps = $ReadOnly<{
24+
export type RefreshControlPropsIOS = $ReadOnly<{
2525
/**
2626
* The color of the refresh indicator.
2727
*/
@@ -36,7 +36,7 @@ type IOSProps = $ReadOnly<{
3636
title?: ?string,
3737
}>;
3838

39-
type AndroidProps = $ReadOnly<{
39+
export type RefreshControlPropsAndroid = $ReadOnly<{
4040
/**
4141
* Whether the pull to refresh functionality is enabled.
4242
*/
@@ -55,11 +55,7 @@ type AndroidProps = $ReadOnly<{
5555
size?: ?('default' | 'large'),
5656
}>;
5757

58-
export type RefreshControlProps = $ReadOnly<{
59-
...ViewProps,
60-
...IOSProps,
61-
...AndroidProps,
62-
58+
type RefreshControlBaseProps = $ReadOnly<{
6359
/**
6460
* Called when the view starts refreshing.
6561
*/
@@ -76,6 +72,13 @@ export type RefreshControlProps = $ReadOnly<{
7672
progressViewOffset?: ?number,
7773
}>;
7874

75+
export type RefreshControlProps = $ReadOnly<{
76+
...ViewProps,
77+
...RefreshControlPropsIOS,
78+
...RefreshControlPropsAndroid,
79+
...RefreshControlBaseProps,
80+
}>;
81+
7982
/**
8083
* This component is used inside a ScrollView or ListView to add pull to refresh
8184
* functionality. When the ScrollView is at `scrollY: 0`, swiping down

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,25 +1692,28 @@ declare export default typeof PullToRefreshViewNativeComponent;
16921692
`;
16931693

16941694
exports[`public API should not change unintentionally Libraries/Components/RefreshControl/RefreshControl.js 1`] = `
1695-
"type IOSProps = $ReadOnly<{
1695+
"export type RefreshControlPropsIOS = $ReadOnly<{
16961696
tintColor?: ?ColorValue,
16971697
titleColor?: ?ColorValue,
16981698
title?: ?string,
16991699
}>;
1700-
type AndroidProps = $ReadOnly<{
1700+
export type RefreshControlPropsAndroid = $ReadOnly<{
17011701
enabled?: ?boolean,
17021702
colors?: ?$ReadOnlyArray<ColorValue>,
17031703
progressBackgroundColor?: ?ColorValue,
17041704
size?: ?(\\"default\\" | \\"large\\"),
17051705
}>;
1706-
export type RefreshControlProps = $ReadOnly<{
1707-
...ViewProps,
1708-
...IOSProps,
1709-
...AndroidProps,
1706+
type RefreshControlBaseProps = $ReadOnly<{
17101707
onRefresh?: ?() => void | Promise<void>,
17111708
refreshing: boolean,
17121709
progressViewOffset?: ?number,
17131710
}>;
1711+
export type RefreshControlProps = $ReadOnly<{
1712+
...ViewProps,
1713+
...RefreshControlPropsIOS,
1714+
...RefreshControlPropsAndroid,
1715+
...RefreshControlBaseProps,
1716+
}>;
17141717
declare class RefreshControl extends React.Component<RefreshControlProps> {
17151718
componentDidMount(): void;
17161719
componentDidUpdate(prevProps: RefreshControlProps): void;

scripts/build/build-types/buildTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const ENTRY_POINTS = [
7575
'packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js',
7676
'packages/react-native/Libraries/Components/Switch/Switch.js',
7777
'packages/react-native/Libraries/Components/StatusBar/StatusBar.js',
78+
'packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js',
7879
];
7980

8081
/**

0 commit comments

Comments
 (0)