Revert "Fix RefreshControl race condition"
Summary:
This reverts commit 8fbce3099d
.
Reverts https://github.com/facebook/react-native/pull/7317 because it breaks instrumentation tests https://circleci.com/gh/facebook/react-native/6521
Closes https://github.com/facebook/react-native/pull/7529
Differential Revision: D3292461
fbshipit-source-id: 7dcde05adefe41e6b3c28697fccfa232a45f0742
This commit is contained in:
parent
1b5b5d9c5b
commit
428c563c75
|
@ -20,27 +20,10 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
|
|||
*/
|
||||
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)) {
|
||||
|
|
|
@ -74,8 +74,15 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefres
|
|||
}
|
||||
|
||||
@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)
|
||||
|
|
Loading…
Reference in New Issue