Skip to content

Commit

Permalink
Revert "Fix RefreshControl race condition"
Browse files Browse the repository at this point in the history
Summary:
This reverts commit 8fbce30.
Reverts facebook#7317 because it breaks instrumentation tests https://circleci.com/gh/facebook/react-native/6521
Closes facebook#7529

Differential Revision: D3292461

fbshipit-source-id: 7dcde05adefe41e6b3c28697fccfa232a45f0742
  • Loading branch information
bestander authored and Morgan Pretty committed Aug 24, 2016
1 parent 3172ac9 commit 4f59b93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4f59b93

Please sign in to comment.