don't setup webview if running as designer (#6592)

This commit is contained in:
Shane Neuville 2019-06-19 17:52:31 -06:00 коммит произвёл Samantha Houts
Родитель 578d0f92a4
Коммит 3a5614bead
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -17,14 +17,14 @@ namespace Xamarin.Forms.Platform.Android
WebViewClient _webViewClient;
FormsWebChromeClient _webChromeClient;
bool _isDisposed = false;
protected internal IWebViewController ElementController => Element;
protected internal bool IgnoreSourceChanges { get; set; }
protected internal string UrlCanceled { get; set; }
public WebViewRenderer(Context context) : base(context)
{
AutoPackage = false;
AutoPackage = false;
}
[Obsolete("This constructor is obsolete as of version 2.5. Please use WebViewRenderer(Context) instead.")]
@ -62,6 +62,10 @@ namespace Xamarin.Forms.Platform.Android
protected override void Dispose(bool disposing)
{
if (_isDisposed)
return;
_isDisposed = true;
if (disposing)
{
if (Element != null)
@ -119,6 +123,12 @@ namespace Xamarin.Forms.Platform.Android
_webChromeClient.SetContext(Context);
webView.SetWebChromeClient(_webChromeClient);
if(Context.IsDesignerContext())
{
SetNativeControl(webView);
return;
}
webView.Settings.JavaScriptEnabled = true;
webView.Settings.DomStorageEnabled = true;
SetNativeControl(webView);