diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java index 728def66f7940b..f458c0ab06b914 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java @@ -20,27 +20,10 @@ */ public class ReactSwipeRefreshLayout extends SwipeRefreshLayout { - private boolean mRefreshing = false; - public ReactSwipeRefreshLayout(ReactContext reactContext) { super(reactContext); } - @Override - public void setRefreshing(boolean refreshing) { - if (mRefreshing != refreshing) { - mRefreshing = refreshing; - // Use `post` otherwise the control won't start refreshing if refreshing is true when - // the component gets mounted. - post(new Runnable() { - @Override - public void run() { - ReactSwipeRefreshLayout.super.setRefreshing(mRefreshing); - } - }); - } - } - @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (super.onInterceptTouchEvent(ev)) { 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 e66132ff735d90..5db04a1a77f39c 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 @@ -74,8 +74,15 @@ public void setSize(ReactSwipeRefreshLayout view, int size) { } @ReactProp(name = "refreshing") - public void setRefreshing(ReactSwipeRefreshLayout view, boolean refreshing) { - view.setRefreshing(refreshing); + public void setRefreshing(final ReactSwipeRefreshLayout view, final boolean refreshing) { + // Use `post` otherwise the control won't start refreshing if refreshing is true when + // the component gets mounted. + view.post(new Runnable() { + @Override + public void run() { + view.setRefreshing(refreshing); + } + }); } @ReactProp(name = "progressViewOffset", defaultFloat = 0)