fix(android): Allow scrolling inside ScrollView (#281)
This commit is contained in:
parent
7d0c4a798e
commit
a5cb7ba65c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue