From 65975dd28de0a7b8b8c4eef6479bf7eee5fcfb93 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sun, 17 Jan 2021 02:53:58 -0800 Subject: [PATCH] Change type of SwipeRefreshLayoutManager.size prop from Int to String Summary: This diff changes the type of the SwipeRefreshLayoutManager.size prop from Int to String in Fabric. The current implementation of this prop allows JS developers to use "int" type when fabric is enables and "int or string" types when using Fabric is disabled. Since long term we want to only support "string" type for this prop, I'm changing the type of the prop to be String. After my diff Fabric will start supporting only "string" types, non fabric screens will keep supporting "int or string" values. **Will this break production?** No, because there are no usages of RefreshControl.Size prop in fbsource **What about if someone start using this prop next week?** IMO It's very unlikely because of the nature of this prop, I will be monitoring next week and if there's an usage it will be detected by flow when trying to land D25933457. Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large' Reviewed By: JoshuaGross Differential Revision: D25933458 fbshipit-source-id: 55067d7405b063f1e8d9bb7a5fd7731f5f168960 --- ...ndroidSwipeRefreshLayoutNativeComponent.js | 10 +-------- .../SwipeRefreshLayoutManager.java | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js index 9bd3600eb31..48d6ee0ddd7 100644 --- a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js @@ -42,16 +42,8 @@ type NativeProps = $ReadOnly<{| progressBackgroundColor?: ?ColorValue, /** * Size of the refresh indicator, see RefreshControl.SIZE. - * - * This type isn't currently accurate. It really is specific numbers - * hard coded in the Android platform. - * - * Also, 1 isn't actually a safe default. We are able to set this here - * because native code isn't currently consuming the generated artifact. - * This will end up being - * size?: WithDefault<'default' | 'large', 'default'>, */ - size?: WithDefault, + size?: WithDefault<'default' | 'large', 'default'>, /** * Progress view top offset */ diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java index c8462a138cc..378dc2573f6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java @@ -88,11 +88,21 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager