From 09fe15910e896fcfa5565514b3c359fbbf4b35a4 Mon Sep 17 00:00:00 2001 From: Eli White Date: Thu, 20 Jun 2019 10:54:30 -0700 Subject: [PATCH] Android SwipeRefreshLayout now supports strings for size Summary: Previously SwipeRefreshLayout (RefreshControl on Android) required taking an int as the size. This required a complex dance of pulling these constant values off of the native view config. As we are going to stop sending view configs from native and instead hardcode them in JS we can't do that anymore. We will change the type of size from: ``` size?: ?( | typeof RefreshLayoutConsts.SIZE.DEFAULT | typeof RefreshLayoutConsts.SIZE.LARGE ), ``` to: ``` size?: ?('default' | 'large') ``` In this commit we are supporting the old style as well as the new style. The old way of specifying the sizes will go away in a future release. Changelog: [Android] [Added] - RefreshControl now supports strings and not just numbers for size. Reviewed By: mdvacca Differential Revision: D15909582 fbshipit-source-id: 1849edc980e1698de147e88d710e0f28d0fdc8d8 --- .../SwipeRefreshLayoutManager.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 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 54bda8db223..be8d7959d59 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 @@ -12,7 +12,9 @@ import static com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager.RE import android.graphics.Color; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener; +import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableType; import com.facebook.react.common.MapBuilder; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.ThemedReactContext; @@ -66,9 +68,27 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager