Skip to content

fix(ios): learn detent offset before present transition emits positions#731

Merged
lodev09 merged 4 commits into
mainfrom
fix/present-detent-offset
Jul 12, 2026
Merged

fix(ios): learn detent offset before present transition emits positions#731
lodev09 merged 4 commits into
mainfrom
fix/present-detent-offset

Conversation

@lodev09

@lodev09 lodev09 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

onPositionChange emitted a slightly fractional index (e.g. ~0.07 instead of 0) during the present transition, then snapped to the exact detent index right after didPresent — visible as a small jump on anything animated with index (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 assumption presentedFrame capture relies on), and the resolverHeight > 0 guard keeps it a no-op if the detent resolver hasn't run (including iOS < 16).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

Reproduced in a consumer app with ['peek', <fraction>] detents and a footer animated off onPositionChange index: 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

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)
  • I added a changelog entry (if needed)

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-true-sheet Ready Ready Preview, Comment Jul 12, 2026 3:32pm

Request Review

@lodev09 lodev09 merged commit 734cdee into main Jul 12, 2026
6 checks passed
@lodev09 lodev09 deleted the fix/present-detent-offset branch July 12, 2026 15:33
@lodev09

lodev09 commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

🚀 This pull request is included in v3.11.6. See Release 3.11.6 for release notes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant