Bug 55624 - Cells in TableView does show WebView control from other cell after scrolling up/down
Summary: Cells in TableView does show WebView control from other cell after scrolling ...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-04-26 14:54 UTC by code2199
Modified: 2017-07-12 22:50 UTC (History)
4 users (show)

Tags: ios tableview viewcell webview ac
Is this bug a regression?: ---
Last known good build:


Attachments
Screenprint of iOS showing the described problem. (45.35 KB, image/png)
2017-04-26 14:54 UTC, code2199
Details
repro project (159.18 KB, application/x-zip-compressed)
2017-05-02 22:44 UTC, Jimmy [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 55624 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description code2199 2017-04-26 14:54:09 UTC
Created attachment 21808 [details]
Screenprint of iOS showing the described problem.

This problem only exists in iOS; *not* in Android. In Android its working fine.

I have included example code, that demonostrates the problem. It should show a TableView with 20 cells, numbered from 0 to 19. At first, when the app starts and you haven't scrolled, it looks ok. But when you scroll up/down, the problem shows up. The cells shows WebView from other cells. The Label control is still ok.

The attached screenprint shows the result after scrolling in iOS. Again, in Android no problem.

Code:
using Xamarin.Forms;

namespace Test
{
    public partial class TestWebView : ContentPage
    {
        public TestWebView()
        {
            InitializeComponent();

            var table = new TableView()
            {
                Intent = TableIntent.Form,
                HasUnevenRows = true
            };

            var section = new TableSection("Test");
            table.Root.Add(section);

            Content = table;

            for (int i = 0; i < 20; i++)
            {
                var cell = new ViewCell() { Height = 150 };
                var stack = new StackLayout() { Padding = new Thickness(15, 15, 15, 15), Orientation = StackOrientation.Vertical };
                stack.BackgroundColor = Color.Yellow;
                cell.View = stack;

                stack.Children.Add(new Label() { Text = $"Test {i}" });

                var webView = new WebView()
                {
                    Source = new HtmlWebViewSource() { Html = $"Test {i}"},
                    HeightRequest = 100,
                    WidthRequest = 1000
                };
                stack.Children.Add(webView);

                section.Add(cell);
            }

        }
    }
}
Comment 1 Jimmy [MSFT] 2017-05-02 22:44:33 UTC
Created attachment 21916 [details]
repro project

Thank you for filing this report! I created a sample project with the code you provided and I was able to see the issue you described. I am confirming the report so the team can look into this further. 

In the meantime, a possible workaround and better alternative would be to use a ListView instead, especially if the cells will all have the same template. I tested this and it does not experience the same issue. The project I attached also demonstrates this.

Even if the cell are not all uniform, you can still use a ListView along with a DataTemplateSelector: https://blog.xamarin.com/customizing-list-view-cells-xamarin-forms-datatemplateselector/


### Version Tests
2.3.6.91    BAD
2.3.5-pre2  BAD
2.3.4.231   BAD
Comment 2 code2199 2017-05-03 09:07:34 UTC
Hi Jimmy,

Thanks.

As I have several reasons to favor the TableView (eg. cosmetics) over a ListView, I've looked further and found a temporary work-around by saving the HTML value to a temp file and set the Source property with the file path. That seems to work.