Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 11189 [details]
If you subclass WebViewRenderer and set ScalesPageToFit to true then the page should automatically adapt as the size of the web view changes. An app with a full screen web view should then show the web page always fitting the screen, even as the device rotates.
This doesn't work correctly with WebViewRenderer, but it does work with a stock usage of UIWebView. I'm not exactly sure what's wrong, but I am suspicious of this code:
public override void LayoutSubviews()
this.ScrollView.Frame = this.Bounds;
Created attachment 11190 [details]
UIWebView example that behaves correctly
This example shows a normal UIWebView that behaves correctly.
Indeed. Expected rotation fill screen but actually fails to fill screen on iOS. My Android device shows no repro.
I am also experiencing this issue. Will it be looked into?
*** Bug 30297 has been marked as a duplicate of this bug. ***
Just wanted to see if there was an update on this. The status is still set to In Progress but a Xamarin person on the forum thread below said that it had in fact been fixed. Thanks.
The actual post where they said it was fixed is here:
Hi, seems the fix isn't that trivial, and it's still being reviewed before being merged.
We will update with more information here when it would be ready for release.
I made a CustomWebViewRenderer based on ViewRenderer<CustomWebView, UIWebView> as David Dancy described in bug #33500. The main differency is, that the ViewRenderer adds the UIWebView as a subview, it is no UIWebView itself.
This works. ScalesPageToFit works, there are no black areas scrolled in and no horizontal scrolling even after rotation.
But I wouldn't use my solution widely because I needed to write my own CustomWebView (not based on X.F.WebView), CustomWebViewRenderer and CustomWebViewRendererDelegate). In the XF code is so much internal that I couldn't use it. That shouldn't be a problem when you integrate it in XF though.
Michael, can you post the code that has a working CustomWebViewRenderer?
Created attachment 13864 [details]
CustomWebView + -Renderer source
As I said I only got the solution from David Dancy and he didn't want to give me his code because he got it out from Xamarins dlls. But with his description I was able to do the same.
However, now it's been two months since Ruis last comment and it's still not fixed, so I decided to give you my code. If Xamarin feels this violates their rights, then they can just delete the attachment again.
Most of the code was taken from Xamarins dlls using dotPeek with the changes I already explained in comment 8.
Hi @Michael the problem with that approach is it will break the API and people that were using the Renderer.
The only thing it breaks is subclasses of the stock renderer.
However the stock renderer is itself broken (doesn't rotate properly, per this bug). So it has to change anyway.
The new API proposed in Michael's and my work both fixes the rotation issue and makes it easier to subclass the renderer.
What's not to like?
Since this is marked as IN_PROGRESS, does anyone have any time frame or release number we can expect the fix in?
Good afternoon I'm trying to use the ScalesPageToFit to True, but does not work for me , is it because of this bug ? anyone have any predictions or statuz how to walk?
Should be fixed in 2.2.0
This is not fixed, in fact is it worse now than it was before. Do you need more information?
Created attachment 16429 [details]
iOS emulator after rotating
Rotated from horizontal to vertical
Christine what version of XF are you using? I can confirm that this issue was fixed for me. Feel free to jump over to the forums and tag me in @AdamP if you wanted to show your code and work through it.
I am testing with 2.3.0. I explored some more and found that by removing the setting this.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; from the iOS Custom Renderer the webview behaved as expected.