From dd604145781ac07c8db8d9100043bd76f6d6e913 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 25 Jan 2021 21:03:27 -0800 Subject: [PATCH] Change flow types of RefreshControl.size prop Summary: This diff changes the flow types of RefreshControl.size prop from 'int' to string'. For more context see previous diff of the stack. This diff will be landed as soon as the native release containing D25933458 (https://github.com/facebook/react-native/commit/65975dd28de0a7b8b8c4eef6479bf7eee5fcfb93) goes to production. It's important to clarify that there are currently no usages of this prop in production Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large' Reviewed By: JoshuaGross Differential Revision: D25933457 fbshipit-source-id: 2f34566f2f8a097e6d40f63c09ecb3ada2fd8409 --- ...ndroidSwipeRefreshLayoutNativeComponent.js | 2 +- .../RefreshControl/RefreshControl.js | 21 ++----------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js index 48d6ee0ddd7..bc2d26560c7 100644 --- a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js @@ -41,7 +41,7 @@ type NativeProps = $ReadOnly<{| */ progressBackgroundColor?: ?ColorValue, /** - * Size of the refresh indicator, see RefreshControl.SIZE. + * Size of the refresh indicator. */ size?: WithDefault<'default' | 'large', 'default'>, /** diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index a85c820791d..f9eb5381c54 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -22,18 +22,6 @@ import PullToRefreshViewNativeComponent, { Commands as PullToRefreshCommands, } from './PullToRefreshViewNativeComponent'; -let RefreshLayoutConsts: any; -if (Platform.OS === 'android') { - const AndroidSwipeRefreshLayout = require('../../ReactNative/UIManager').getViewManagerConfig( - 'AndroidSwipeRefreshLayout', - ); - RefreshLayoutConsts = AndroidSwipeRefreshLayout - ? AndroidSwipeRefreshLayout.Constants - : {SIZE: {}}; -} else { - RefreshLayoutConsts = {SIZE: {}}; -} - type IOSProps = $ReadOnly<{| /** * The color of the refresh indicator. @@ -63,12 +51,9 @@ type AndroidProps = $ReadOnly<{| */ progressBackgroundColor?: ?ColorValue, /** - * Size of the refresh indicator, see RefreshControl.SIZE. + * Size of the refresh indicator. */ - size?: ?( - | typeof RefreshLayoutConsts.SIZE.DEFAULT - | typeof RefreshLayoutConsts.SIZE.LARGE - ), + size?: ?('default' | 'large'), /** * Progress view top offset */ @@ -137,8 +122,6 @@ export type RefreshControlProps = $ReadOnly<{| * in the `onRefresh` function otherwise the refresh indicator will stop immediately. */ class RefreshControl extends React.Component { - static SIZE: any = RefreshLayoutConsts.SIZE; - _nativeRef: ?React.ElementRef< | typeof PullToRefreshViewNativeComponent | typeof AndroidSwipeRefreshLayoutNativeComponent,