Simplifying conditional logic.

Summary:
This should be functionally identical, but avoids unnecessary conditionals in the code.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15147

Differential Revision: D5497883

Pulled By: javache

fbshipit-source-id: a4b182084ffce87adac56013a178fbc5a7a5d1bb
This commit is contained in:
Tomas Reimers 2017-07-26 07:06:36 -07:00 committed by Facebook Github Bot
parent 4d55ce3ac1
commit 88a98455f6
1 changed files with 2 additions and 6 deletions

View File

@ -284,22 +284,18 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
mActivelyScrolling = false; mActivelyScrolling = false;
ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY); ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY);
} else { } else {
boolean doneWithAllScrolling = true;
if (mPagingEnabled && !mSnappingToPage) { if (mPagingEnabled && !mSnappingToPage) {
// Only if we have pagingEnabled and we have not snapped to the page do we // 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 // need to continue checking for the scroll. And we cause that scroll by asking for it
mSnappingToPage = true; mSnappingToPage = true;
smoothScrollToPage(0); smoothScrollToPage(0);
doneWithAllScrolling = false; ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY);
} } else {
if (doneWithAllScrolling) {
if (mSendMomentumEvents) { if (mSendMomentumEvents) {
ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactHorizontalScrollView.this); ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactHorizontalScrollView.this);
} }
ReactHorizontalScrollView.this.mPostTouchRunnable = null; ReactHorizontalScrollView.this.mPostTouchRunnable = null;
disableFpsListener(); disableFpsListener();
} else {
ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY);
} }
} }
} }