Skip to content

[iOS] SwipeView Closes when Content Changes - fix #29088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Apr 19, 2025

Issues Fixed

Fixes #29086

Before After
Screen.Recording.2025-04-19.at.21.31.37.mov
Screen.Recording.2025-04-19.at.21.30.32.mov

@Copilot Copilot AI review requested due to automatic review settings April 19, 2025 19:55
@kubaflo kubaflo requested a review from a team as a code owner April 19, 2025 19:55
@kubaflo kubaflo self-assigned this Apr 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where the SwipeView unexpectedly closes when its content changes on iOS. It implements a layout adjustment to reapply the swipe state, refactors the animation logic, and adds tests to verify the behavior.

  • Update MauiSwipeView to reapply swipe state during layout.
  • Refactor the swipe animation by extracting the frame-setting logic.
  • Add corresponding UI and automated tests for Issue29086.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/Core/src/Platform/iOS/MauiSwipeView.cs Adjusts layout and swipe animation logic to maintain the open state
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29086.cs Introduces a test case verifying that the SwipeView remains open
src/Controls/tests/TestCases.HostApp/Issues/Issue29086.xaml.cs Adds UI for the test case
Files not reviewed (1)
  • src/Controls/tests/TestCases.HostApp/Issues/Issue29086.xaml: Language not supported
Comments suppressed due to low confidence (2)

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29086.cs:24

  • [nitpick] Consider augmenting the screenshot verification with explicit assertions on the SwipeView state to better capture the intended non-closing behavior.
VerifyScreenshot();

src/Core/src/Platform/iOS/MauiSwipeView.cs:84

  • Calling Swipe(animated: false) from within LayoutSubviews could potentially trigger repeated layout passes. Please verify that this invocation does not lead to unintended recursive layout updates.
if (_isOpen)

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 19, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

App.SwipeLeftToRight("SwipeItem");
App.Click("AddButton");
App.Click("AddButton");
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, just trigger a build. Pending test snapshots in all the platforms.

@darrabam
Copy link

what’s the status of this? will the fix be rolled out in the coming release?

@darrabam
Copy link

@jfversluis could you please spare sometime to review and approve this?

@jfversluis jfversluis added this to the .NET 9 SR9 milestone Jun 23, 2025
@jfversluis
Copy link
Member

/azp run MAUI-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

@darrabam would you be able to test the result of this build following these instructions? https://github.com/dotnet/maui/wiki/Testing-PR-Builds

@darrabam
Copy link

@darrabam would you be able to test the result of this build following these instructions? https://github.com/dotnet/maui/wiki/Testing-PR-Builds

I haven’t tested it since the video above confirms the the fix, but sure I’ll give it a try following the instructions and test it on some edge cases too.

Thanks for pointing out the testing instructions!

@darrabam
Copy link

@kubaflo Thank you very much for the fix, it resolves the issue for Left & Top items, but not for Right & Bottom. I've updated the sample for you to test with:
https://github.com/darrabam/SwipeViewBugMAUI

2025-06-23-17-53-01.mp4

@PureWeen PureWeen changed the base branch from main to inflight/current June 24, 2025 17:21
@PureWeen PureWeen merged commit 90d1827 into dotnet:inflight/current Jun 24, 2025
17 checks passed
@kubaflo
Copy link
Contributor Author

kubaflo commented Jun 25, 2025

@darrabam Thanks for letting me know! You're right. Here's a fix: #30182

PureWeen pushed a commit that referenced this pull request Jun 25, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jun 26, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
PureWeen pushed a commit that referenced this pull request Jun 27, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
PureWeen pushed a commit that referenced this pull request Jun 28, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 1, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
github-actions bot pushed a commit that referenced this pull request Jul 9, 2025
* [iOS] SwipeView Closes when Content Changes - fix

* Added snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SwipeView Closes when Content Changes even with SwipeBehaviorOnInvoked="RemainOpen" (iOS only)
5 participants