Hello,
I have Shell Page and this page includes a FlyoutItem.
<FlyoutItem> <Tab title="Profile" ...> <views:Profile/> <Tab title="Web" ...> <views:WebBrowserPage/> **<< Includes a Custom WebView** ....
I'm selecting the Web tab and webView looks as expected. Then I visit a category page.
After that, I'm selecting the Profile tab.
and If I tap the Web tab again, it creates a new instance of webView. For that reason, all web content is resetting.
How to prevent creating an instance of the WebView after the tab bar selection? I need to see the web page where I left it (in category page, same scroll position).
Answers
Hi @Erdogan , I didn't have the exact answer, but I asked a similar question. Maybe this can help you.
https://forums.xamarin.com/discussion/175459/tabbar-constantly-throws-the-item-in-the-browser#latest
WebView has a
Reload
method that can be used to reload the current content.Tutorial: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#reloading-content
Thanks, Hamit! But I guess, seems different issues.
Hi @Jarvan
My page is already reloading/creating when the Web tab opened.
When the Web tab tapped, is it normal creating a new webview each time inside the tab?
That's the problem as I mentioned.
When I tap the Web tab, I need to see the WebView with the last visited page, with the last scroll position. Please, kindly check my question again.
Navigating to the webview page in a tab doesn't reload the webview.
The OnElementChanged fires every tap in the custom renderer.
Repo;
https://github.com/Erdogan34/XamAppWebViewRenderer
I opened an bug report for this issue;
https://github.com/xamarin/Xamarin.Forms/issues/9073
Thanks for sharing the link and we'll help to track the progress on github.
@Erdogan
How did you finally managed the WebView reload after the tab tap?
Sorry for late answer. I gave up to use the Shell page. My github issue is still waiting as unsolved.