Skip to content

[iOS] Show the RefreshView indicator when refreshing starts before the view is on screen - #40660

Open
marcelomoresco wants to merge 8 commits into
dotnet:candidate/11.0.1xx-sr3from
marcelomoresco:fix/32244-refreshview-programmatic-indicator-net11
Open

marcelomoresco wants to merge 8 commits into
dotnet:candidate/11.0.1xx-sr3from
marcelomoresco:fix/32244-refreshview-programmatic-indicator-net11

Conversation

@marcelomoresco

@marcelomoresco marcelomoresco commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Target Branch

Targets net11: main now targets .NET 12, which this SDK can't build; MauiRefreshView.cs and the test are identical on both branches.

Description of Change

UIKit drops UIRefreshControl.BeginRefreshing called before the view is in a window, so IsRefreshing=true set in a page constructor, Appearing, or before a push never showed the indicator.

MauiRefreshView now begins refreshing only while in a window; otherwise it starts on the first layout pass once it is, from the stored IsRefreshing value (not a delay like the earlier #33029 approach). The start offset is always captured on that first layout, and it's only restored at completion if it was final or the content had scrolled — this also covers a reattach while scrolled and a deferred start at a top inset.

Adds overrides of existing UIView methods (MovedToWindow, LayoutSubviews), hence the PublicAPI.Unshipped entries for ios/maccatalyst — no new callable member.

Verification

iOS 26.5 simulator, 24 cases before/after: constructor, Appearing, push, empty CollectionView, no NavigationPage, and tab switch all go from "no indicator" to a visible 60pt indicator and restore correctly; a ScrollView under the safe area with the refresh set before entering the screen also now shows the indicator (it stays hidden only when the refresh is set with the view already loaded). All other already-working cases unchanged.

Before
After

Follow-up fix (ad6db23c8) verified on the iOS 26.5 simulator by replicating the device tests' logic in a sample app: the previous head failed at a top inset of 100 and on reattach while scrolled; the new one passes those plus the cancellation-before-attach case. The 24 earlier cases are unchanged except 2 that improved.

Unchanged either way (out of scope, worth noting): no indicator with a large title; RefreshColor doesn't apply on the first refresh.

Not verified: device tests (compile only — Xcode 26.6), physical device, Mac Catalyst, iOS < 26, UI test.

Issues Fixed

Fixes #32244

…e view is on screen

UIKit drops a UIRefreshControl.BeginRefreshing made before the view is in a window, so IsRefreshing=true set in a page constructor, on Appearing or before a push never showed the indicator.

MauiRefreshView now begins refreshing only when it is in a window, and otherwise starts on the first layout pass inside one, from the stored IsRefreshing value rather than after a delay. In that case the control begins before the offset is applied, since the opposite order doubled the offset on the first layout, and the scroll position isn't restored when it ends because it wasn't final yet.

Fixes dotnet#32244
@github-actions

This comment has been minimized.

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Nov 26, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 3 findings

Reviewed commit dbc2c7c.

See inline comments for details.

…arts

The refresh that starts on the first layout pass used the stored start position without capturing it, so a view that left the window and came back scrolled was offset from a stale value. The position is now always captured, and it is restored when the refresh ends if it was final or the content was scrolled.

When the deferred refresh starts with the content resting at a top inset, it is offset from that inset so the whole indicator is revealed.

The device tests now check the revealed extent and the settled offset with and without a top inset, a pending refresh on reattach while scrolled, and a pending refresh cancelled before being in a window.
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 0 findings

Reviewed commit ad6db23.

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests are failing

The deferred start ran on every layout pass while the refresh control
was not refreshing. If UIKit did not keep the control refreshing, each
start changed the content offset, triggered another layout and started
again, which hung the RefreshView UI tests on Mac Catalyst. The start is
now a one-shot that is armed when IsRefreshing turns on outside a window
and cleared when it turns off.

The iOS 26 baseline of Issue30535 is updated: the refresh that begins
while the page is covered now animates when the page returns, instead of
showing a static indicator.
@marcelomoresco

Copy link
Copy Markdown
Contributor Author

Fixed: the deferred start was restarting on every layout pass while the refresh control wasn't refreshing yet, which hung Mac Catalyst. It's now one-shot (new device test PendingRefreshStartsOnlyOnce). Also updated the iOS 26 Issue30535 baseline, since a normal refresh with the view already on screen also animates gray there. Commit de47b8a.

@kubaflo

This comment has been minimized.

@marcelomoresco

Copy link
Copy Markdown
Contributor Author

Thanks, the Mac Catalyst timeouts weren't a layout loop: the app stays responsive while the refresh indicator spins, but the Catalyst Appium session has no waitForIdleTimeout (iOS uses 5s), so a programmatic refresh that never ends keeps every command waiting. Before this PR those refreshes were requested off-window and dropped by UIKit, so nothing spun. Since the issue is iOS-only, a03ef39 keeps the previous behavior on Mac Catalyst and limits the deferred-start tests to iOS. It also updates the iOS 18 baseline of Issue30535, where the indicator now animates like in the iOS 26 one. Could you re-run the tests?

1 similar comment
@marcelomoresco

Copy link
Copy Markdown
Contributor Author

Thanks, the Mac Catalyst timeouts weren't a layout loop: the app stays responsive while the refresh indicator spins, but the Catalyst Appium session has no waitForIdleTimeout (iOS uses 5s), so a programmatic refresh that never ends keeps every command waiting. Before this PR those refreshes were requested off-window and dropped by UIKit, so nothing spun. Since the issue is iOS-only, a03ef39 keeps the previous behavior on Mac Catalyst and limits the deferred-start tests to iOS. It also updates the iOS 18 baseline of Issue30535, where the indicator now animates like in the iOS 26 one. Could you re-run the tests?

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — No more findings

Reviewed commit a03ef39.

@github-actions

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it label Nov 30, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue labels Nov 30, 2026
Merged by MAUI Autopilot to resolve merge conflicts.
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Nov 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 1 finding

Reviewed commit ae44fe7.

See inline comments for details.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 30, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Nov 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — No more findings

Reviewed commit 32977e7.

@github-actions github-actions Bot added s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 30, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOT QUEUED Platforms iOS, MacCatalyst Tests 1 UI, 2 device Commit 32977e75


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ not queued 1 of 77 categories —
Device tests ❌ not queued 2 of 105 units —
🧪 UI tests — RefreshView on iOS, MacCatalyst

❌ Could not queue maui-pr-uitests: Azure Pipelines did not start maui-pr-uitests for the dispatch branch run-tests/pr40660-46538780389 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-uitests for the full suite.

GPT-6.2 Sol: Run RefreshView UI tests on iOS and Mac Catalyst for refresh indicator startup and scroll positioning.
MAI Code 2: iOS RefreshView deferred-start fix; runs RefreshView UI tests on iOS and Mac Catalyst.

🧪 Running — 1 category on iOS, MacCatalyst

Platform Categories
iOS RefreshView
MacCatalyst RefreshView
🧪 Device tests — Controls.RefreshView, Core.RefreshView on iOS, MacCatalyst

❌ Could not queue maui-pr-devicetests: Azure Pipelines did not start maui-pr-devicetests for the dispatch branch run-devicetests/pr40660-46538780389 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-devicetests for the full suite.

GPT-6.2 Sol: Run Core and Controls RefreshView device tests on iOS and Mac Catalyst for native refresh behavior and control integration.
MAI Code 2: iOS-family RefreshView native lifecycle changes; runs Core and Controls RefreshView device tests on iOS and Mac Catalyst.

🧪 Running — 2 categories on iOS, MacCatalyst

Platform Categories
iOS Controls.RefreshView, Core.RefreshView
MacCatalyst Controls.RefreshView, Core.RefreshView
⏭️ Skipped — what neither suite runs

UI tests — 76 categories, 2 platforms

Platforms not run: Android, Windows

Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, Lifecycle, ManualReview, Maps, Navigation, Page, Performance, Picker, ProgressBar, RadioButton, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, Shell1, Shell2, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, Window, WebView, Material3

Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.

Device tests — 103 categories, 2 platforms

Platforms not run: Android, Windows

Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Lifecycle, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Modal, Controls.NavigationPage, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Shell, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.Window, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Graphics, Essentials, BlazorWebView

Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.

🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)

UI tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS RefreshView RefreshView
MacCatalyst RefreshView RefreshView
Windows — —

GPT-6.2 Sol — Run RefreshView UI tests on iOS and Mac Catalyst for refresh indicator startup and scroll positioning.

  • The updated iOS snapshots cover the indicator when a page opens.
  • MauiRefreshView defers startup only on iOS, but its immediate refresh path also runs on Mac Catalyst.
  • No Android, Windows, or unrelated control behavior changed.

MAI Code 2 — iOS RefreshView deferred-start fix; runs RefreshView UI tests on iOS and Mac Catalyst.

  • Platform/iOS/MauiRefreshView.cs changes RefreshView lifecycle, layout, and scroll-offset behavior on iOS and shared iOS/Mac Catalyst compilation.
  • The iOS snapshot updates exercise the existing RefreshView UI scenario.
  • RefreshView is selected on iOS and Mac Catalyst; Android and Windows are deliberately excluded because the changed native implementation is iOS-family specific.
  • No broader categories are included because the change is isolated from other controls and base layout infrastructure.

Device tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS Core.RefreshView, Controls.RefreshView Core.RefreshView, Controls.RefreshView
MacCatalyst Core.RefreshView, Controls.RefreshView Core.RefreshView, Controls.RefreshView
Windows — —

GPT-6.2 Sol — Run Core and Controls RefreshView device tests on iOS and Mac Catalyst for native refresh behavior and control integration.

  • Core.RefreshView covers deferred startup, cancellation, and scroll restoration; the new cases are iOS-only.
  • Keep Core and Controls on Mac Catalyst for the shared immediate path and native layout overrides.
  • No other device units or platforms are affected.

MAI Code 2 — iOS-family RefreshView native lifecycle changes; runs Core and Controls RefreshView device tests on iOS and Mac Catalyst.

  • The Core MauiRefreshView iOS-family handler changes, so both Core.RefreshView handler coverage and Controls.RefreshView behavior coverage are relevant.
  • The added device tests validate deferred start, reattachment, cancellation, and restoration logic; they are iOS-specific while the production file is also compiled for Mac Catalyst.
  • Android and Windows plus unrelated device categories are excluded because no affected code or tests target those platforms or controls.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

@github-actions github-actions Bot added s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review and removed s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Ready for maintainer review

Results
Expert review No more findings on 32977e7
Tests ⚠️ Could not run; re-run /review run-tests when CI is available
Review threads 3 resolved

@kubaflo
kubaflo changed the base branch from net11 to candidate/11.0.1xx-sr3 December 1, 2026 13:49

This branch was previously deployed

1 inactive (outdated) deployment
copilot-pat-pool — dbc2c7c4 Deployed Nov 26, 2026 by marcelomoresco via conclusion #3358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RefreshView refresh indicator not displaying when refreshing is done programatically

2 participants