-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Cannot scroll webpage in WebView element on Xamarin Shell #5205
Comments
Reproducible by modifying a Shell template in VS2019 preview. |
Hello, The problem also occurs in my project with WebView and Maps (Xamarin.Forms.GoogleMaps). See below... Shared-Project: Create a custom ContentView: In Xaml add the WebView to this ContentView:
Android-Project:
In my case it works as expected. |
I have this issue as well. Please fix. |
Hello, Having the same issue in 4.0.0 pre 9. Will this be fixed soon ? |
The problem is still there. Tested with preview 9. |
As a workaround, you can create a custom renderer for your public override bool DispatchTouchEvent(MotionEvent e)
{
Parent.RequestDisallowInterceptTouchEvent(true);
return base.DispatchTouchEvent(e);
} |
It works for me. |
Could you please explain how can I do this? |
You have to create a custom renderer for the webview (Android, iOS)
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace MyNamespace
{
public class MyWebView : WebView
{
}
}
using Android.Content;
using Android.Views;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using MyNamespace;
using MyNamespace.Droid;
[assembly: ExportRenderer(typeof(MyWebView), typeof(MyWebViewRenderer))]
namespace MyNamespace.Droid
{
class MyWebViewRenderer : WebViewRenderer
{
public MyWebViewRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
}
public override bool DispatchTouchEvent(MotionEvent e)
{
Parent.RequestDisallowInterceptTouchEvent(true);
return base.DispatchTouchEvent(e);
}
}
} |
This is still not working for me. I get the same "no scrolling" behavior in standard WebView and when using Xam.Plugin.Web. This seems like a pretty big bug since webviews are common. Help :) ? |
I can confirm that the workaround works (at least for Android). Even though I would prefer it to work out of the box... |
closed by #7032 |
@philousb - you sir deserve a medal. Works perfect. Ty! |
I have tried philousb custom webview renderer on a contentpage with a scrollview inside the scrollview a grid and in the grid at the 3 Row a webview. Without the custom renderer scrolling works only in landscape mode. With the custom renderer it works only when it is not in landscape mode. When i remove the scrollview it works with standard webview in both modes. Tested on a Huawei p20 pro with android 9 |
Hey there - my name is Maurice. Weirdly this whole thing doesn't seem to work for me. I am also using an instance of WebView with a CustomRenderer linked to it as mentioned in this thread before. Inside the Custom Renderer for Android I have the following code to fix the scrolling bug:
the problem is: scrolling still does not work. Sometimes although, when using two fingers and scrolling fast it zooms a little and scrolls a bit. I really don't know what I could do about that. Which is quite frustrating. Thanks for any help |
I was able to fix the issue by using Xamarin.Forms 5.0 and the newest prerelease of pdfjs. Thanks anyway ^^ |
Did you have an iOS version of this custom renderer? I don't think iOS handles touch events like this. |
Description
Steps to Reproduce
https://github.com/davidortinau/Gastropods.git
MainPage.xaml
page with single WebView element<WebView Source="https://www.youtube.com/" ></WebView>
Expected Behavior
YouTube webpage should be scrolled.
Actual Behavior
Nothing happened after scrolling.
Basic Information
Parent: Xamarin.Forms.Shell Spec #2415
The text was updated successfully, but these errors were encountered: