Skip to content

[Skia|Android] ItemsRepeater fails to layout items when navigated back again #11626

Closed

Description

@FrozDark

Current behavior

When navigating to an existing (cached) page with ItemsRepeater it stops layouting items that were out of scope while scrolling

agaga

Android issue happens if you try to manipulate with the collection. When you remove items or clear it doesn't remove items visually but touching it removes. Adding new items doesn't layout new items at all. So if you clear the collection it stays empty visually. Tested on 4.8.15 stable

Expected behavior

Layout items as it should

How to reproduce it (as minimally and precisely as possible)

  1. Run a Skia project in the repro
  2. Click on "Go" button in the toolbars
  3. Wait for navigations done
  4. Scroll up or down

Repro:
ItemsRepeaterIssue.zip

Workaround

Skia: Force layout by changing size of window or refresh ItemsSource

Android: Reset ItemsSource

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

Skia (WPF), Skia (GTK on Linux/macOS/Windows), Skia (Linux Framebuffer), Skia (Tizen)

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

GTK have the same issue as well so I suppose that every Skia project is having that issue

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on Mar 9, 2023
  2. added
    project/items 🧾
    area/items-repeater
    and removed
    triage/untriaged
    on Mar 9, 2023
  3. FrozDark commented on Mar 26, 2023

    @FrozDark
    Author

    Seems like Android have a little different issue with layouting items but might be related to as well

    Android issue happens if you try to manipulate with the collection. When you remove items or clear it doesn't remove items visually but touching it removes. Then adding new items doesn't layout new items at all. So if you clear the collection it stays clear visually. Tested on 4.8.15 stable

  4. changed the title [-][Skia] ItemsRepeater fails to layout outscoped items when navigated back again[/-] [+][Skia|Android] ItemsRepeater fails to layout items when navigated back again[/+] on Mar 26, 2023
  5. added
    project/layout 🧱
    difficulty/medium 🤔
    project/navigation-lifecycle 🧬
    and removed
    difficulty/tbd
    on Sep 11, 2023
  6. changed the title [-][Skia|Android] ItemsRepeater fails to layout items when navigated back again[/-] [+][Skia|Android] `ItemsRepeater` fails to layout items when navigated back again[/+] on Jul 21, 2025
  7. added
    triage/potentially-fixed
    on Apr 8, 2026
  8. MartinZikmund commented on Apr 8, 2026

    @MartinZikmund
    Member

    Repro generator

    Runtime test(s) added in branch dev/mazi/repro/11626:

    • src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Repeater/Given_ItemsRepeater.cs → When_NavigatedBack_ItemsRepeater_Still_Lays_Out_Items

    ⚠️ The test(s) pass on current master — the bug may have been fixed since the issue was filed. The test navigates to a page with a cached ItemsRepeater (NavigationCacheMode=Required), navigates away, navigates back, and verifies items are still laid out and scrollable. The branch is provided as a starting point for further investigation if the issue persists in specific scenarios.

  9. MartinZikmund commented on Nov 7, 2026

    @MartinZikmund
    Member

    This should be resolved: #12101 made ItemsRepeater invalidate its measure on load so it subscribes to EffectiveViewportChanged again, and #25156 (which ships in 7.0) also refreshes the viewport when a cached page re-enters the tree. Master now has a runtime test for navigating back to a cached page:

    public async Task When_CachedPage_NavigatedBack_Then_RealizedItemsFillViewport()
    {
    var frame = new Frame { Width = 300, Height = 500 };
    TestServices.WindowHelper.WindowContent = frame;
    try
    {
    await TestServices.WindowHelper.WaitForLoaded(frame);
    frame.Navigate(typeof(CachedRepeaterPage));
    var page = (CachedRepeaterPage)frame.Content;
    await TestServices.WindowHelper.WaitFor(() => page.Repeater.IsLoaded);
    await TestServices.WindowHelper.WaitForIdle();
    CachedRepeaterPage.RealizedBottom(page).Should().BeGreaterThanOrEqualTo(page.Scroller.ViewportHeight, "items should fill the viewport on first load");
    frame.Navigate(typeof(EmptyPage));
    await TestServices.WindowHelper.WaitFor(() => !page.Repeater.IsLoaded);
    await TestServices.WindowHelper.WaitForIdle();
    frame.GoBack();
    frame.Content.Should().BeSameAs(page);
    await TestServices.WindowHelper.WaitFor(() => page.Repeater.IsLoaded);
    await TestServices.WindowHelper.WaitForIdle();
    CachedRepeaterPage.RealizedBottom(page).Should().BeGreaterThanOrEqualTo(page.Scroller.ViewportHeight, "items should fill the viewport after navigating back");
    }
    finally
    {
    TestServices.WindowHelper.WindowContent = null;
    }
    }
    . The Android collection update part was reported on the native renderer, which 7.0 replaces with Skia. If you still see either problem, please open a new issue with a repro.

    This was checked as part of an AI-assisted backlog review by reading the code, not by running it. If it looks wrong, please reply and we will take another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/items-repeaterdifficulty/medium 🤔has-repro-branchkind/bugproject/items 🧾project/layout 🧱project/navigation-lifecycle 🧬triage/potentially-fixed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions