From 88a98455f6ba354dfa951c21a8b1a5309c8f5ec5 Mon Sep 17 00:00:00 2001 From: Tomas Reimers Date: Wed, 26 Jul 2017 07:06:36 -0700 Subject: [PATCH] Simplifying conditional logic. Summary: This should be functionally identical, but avoids unnecessary conditionals in the code. Closes https://github.com/facebook/react-native/pull/15147 Differential Revision: D5497883 Pulled By: javache fbshipit-source-id: a4b182084ffce87adac56013a178fbc5a7a5d1bb --- .../react/views/scroll/ReactHorizontalScrollView.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java index e9544926c..b8f6dfabd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java @@ -284,22 +284,18 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements mActivelyScrolling = false; ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY); } else { - boolean doneWithAllScrolling = true; if (mPagingEnabled && !mSnappingToPage) { // Only if we have pagingEnabled and we have not snapped to the page do we // need to continue checking for the scroll. And we cause that scroll by asking for it mSnappingToPage = true; smoothScrollToPage(0); - doneWithAllScrolling = false; - } - if (doneWithAllScrolling) { + ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY); + } else { if (mSendMomentumEvents) { ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactHorizontalScrollView.this); } ReactHorizontalScrollView.this.mPostTouchRunnable = null; disableFpsListener(); - } else { - ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY); } } }