Ability to disable/lock the android ViewPager scroll from props

Summary:
This is a nice feature to have.

I've tested this by copying and renaming the ViewPager java and javascript files from the react-native repo and including them in a project. Whats the best way to test this directly from the repo?
Closes https://github.com/facebook/react-native/pull/5968

Differential Revision: D3240651

Pulled By: mkonicek

fbshipit-source-id: 5f1d157216df4f3314915496188a92aec1b85e91
This commit is contained in:
Kevin Johnson
2016-05-11 16:50:12 -07:00
committed by Facebook Github Bot 8
parent c3714d7ed7
commit 31250ad150
3 changed files with 16 additions and 2 deletions

View File

@@ -142,7 +142,11 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (mScrollEnabled && super.onInterceptTouchEvent(ev)) {
if (!mScrollEnabled) {
return false;
}
if (super.onInterceptTouchEvent(ev)) {
NativeGestureUtil.notifyNativeGestureStarted(this, ev);
return true;
}
@@ -154,6 +158,7 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
if (!mScrollEnabled) {
return false;
}
return super.onTouchEvent(ev);
}