fix(#1083): animated setPage lands on wrong index - #1102
Open
troZee wants to merge 4 commits into
Open
Conversation
Collaborator
Author
|
@dnedo could you test this fix? I was able to check that fix locally and it works |
There was a problem hiding this comment.
Pull request overview
Fixes an iOS regression where setPage(animated: true) can land on the wrong index when invoked while a native-stack modal is being dismissed (SwiftUI TabView(selection:) animation transaction overlap).
Changes:
- iOS: Defers animated page changes when a modal is presented, waiting for a UIKit transition coordinator before triggering the SwiftUI animation.
- Example app: Adds a dedicated Issue #1083 reproduction flow (home + modal) and wires it into navigation.
- E2E: Adds a Maestro regression test + setup flow to validate correct index after modal dismissal.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ios/PagerViewProvider.swift | Adds modal/presentation-aware deferral for animated page changes using transition coordination. |
| example/src/ModalSetPageExample.tsx | Adds a minimal in-app reproduction for Issue #1083 (pager + native-stack modal). |
| example/src/App.tsx | Registers the repro screen and modal; adjusts testIDs for the issue examples list. |
| .maestro/tests/issue_1083_modal_set_page_repro.yaml | Adds a Maestro regression test for the modal-dismiss + setPage scenario. |
| .maestro/setup/issue_1083_modal_set_page_repro_setup.yaml | Adds a setup flow to navigate to the new repro screen in the example app. |
| .gitignore | Ignores .agent-device. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+183
to
+192
| private func hasPresentedViewController() -> Bool { | ||
| var viewController = window?.rootViewController | ||
| while let current = viewController { | ||
| if current.presentedViewController != nil { | ||
| return true | ||
| } | ||
| viewController = current.parent | ||
| } | ||
| return false | ||
| } |
Comment on lines
184
to
188
| {ghIssues.map((example) => ( | ||
| <TouchableOpacity | ||
| key={example.name} | ||
| testID={example.name} | ||
| testID={example.testID} | ||
| style={styles.exampleTouchable} |
Comment on lines
+127
to
+131
| // Native-stack begins its transition on a following run-loop pass. | ||
| // Waiting briefly lets its transition coordinator become observable. | ||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in | ||
| self?.setPageWhenPresentationTransitionCompletes(index: index) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1083
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md