fix(ios): learn detent offset before present transition emits positions#731
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
🚀 This pull request is included in v3.11.6. See Release 3.11.6 for release notes. |
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
onPositionChangeemitted a slightly fractionalindex(e.g.~0.07instead of0) during the present transition, then snapped to the exact detent index right afterdidPresent— visible as a small jump on anything animated withindex(e.g. a footer translated via reanimated).Cause: the resolver-vs-actual detent offset (bottom safe area etc.) is only learned in
viewDidAppear, drag end, and detent change — so the interpolation during the present animation ran against uncorrected detent heights, and the first correct emit happened after present.Fix: learn the offset at the start of the present transition in
setupTransitionTracker, before the display link emits positions. The presented frame is already final there (the same assumptionpresentedFramecapture relies on), and theresolverHeight > 0guard keeps it a no-op if the detent resolver hasn't run (including iOS < 16).Type of Change
Test Plan
Reproduced in a consumer app with
['peek', <fraction>]detents and a footer animated offonPositionChangeindex: footer nudged right after present. With this change the index lands exactly at the target detent and the footer stays put. Regression-checked present → drag between detents → dismiss.Checklist