I was trying to resize the text in a webView in Xamarin.iOS with a webView-renderer. It works, but my problem is that the dark mode does not work anymore. I have already changed the background of the web view, so it is shown right, but I don't know how to do it with the text.
public class NavigationDelegat : WKNavigationDelegate
{
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
{
string Size = "300%";
string text = String.Format(@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '{0}'", Size);
WKJavascriptEvaluationResult handler = (NSObject result, NSError err) => {
if (err != null)
{
System.Console.WriteLine(err);
}
if (result != null)
{
System.Console.WriteLine(result);
}
};
webView.EvaluateJavaScript(text, handler);
webView.Opaque = false;
webView.BackgroundColor = UIColor.Clear;
}
}
How to do it? The text is always black, also when darkMode is activated.
Read more here: https://stackoverflow.com/questions/66320105/how-to-activate-darkmode-for-the-text-changed-in-wkwebviewrenderer
Content Attribution
This content was originally published by M_B at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.