fix(android): Allow scrolling inside ScrollView (#281)

This commit is contained in:
masako-yamada 2019-09-18 12:33:08 +03:00 committed by Thibault Malbranche
parent 7d0c4a798e
commit a5cb7ba65c
1 changed files with 19 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import android.os.Environment;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@ -363,7 +364,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
public void setMessagingEnabled(WebView view, boolean enabled) {
((RNCWebView) view).setMessagingEnabled(enabled);
}
@ReactProp(name = "incognito")
public void setIncognito(WebView view, boolean enabled) {
// Remove all previous cookies
@ -910,6 +911,23 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
this.hasScrollEvent = hasScrollEvent;
}
@Override
public boolean onTouchEvent(MotionEvent event){
// Allow scrolling inside ScrollView
if (event.findPointerIndex(0) == -1) {
return super.onTouchEvent(event);
}
if (event.getPointerCount() >= 1) {
requestDisallowInterceptTouchEvent(true);
} else {
requestDisallowInterceptTouchEvent(false);
}
return super.onTouchEvent(event);
}
@Override
public void onHostResume() {
// do nothing