mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 11:16:06 +08:00
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:
committed by
Facebook Github Bot 8
parent
c3714d7ed7
commit
31250ad150
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user