Skip to content

fix(android): emit didFocus after parent translate animation#666

Merged
lodev09 merged 2 commits intomainfrom
fix/android-did-focus-after-translate
Apr 26, 2026
Merged

fix(android): emit didFocus after parent translate animation#666
lodev09 merged 2 commits intomainfrom
fix/android-did-focus-after-translate

Conversation

@lodev09
Copy link
Copy Markdown
Owner

@lodev09 lodev09 commented Apr 26, 2026

Summary

On Android, when a child sheet is dismissed in a stack, the parent's onDidFocus was firing immediately at the end of the child's dismiss animation — before the parent's translate-up animation began. It now fires after the parent's translate animation completes, so JS sees the focus event when the parent has visually settled back into place.

Refactored the dismiss flow so event orchestration lives in TrueSheetView.viewControllerDidDismiss instead of leaking into resetTranslation:

  • translateSheet accepts an optional onEnd callback wired through withEndAction
  • resetTranslation stays pure — translate + cascade only
  • StackManager.unregisterSheet is just a registry op (no return value)
  • The actual parent reference is passed through the delegate (was hadParent: Boolean), so cross-container scenarios target the correct sheet for both translation and the focus event
  • Guarded with isPresented && !isBeingDismissed so cascade dismiss (parent dismissing while child dismisses on top of it) doesn't fire focus on a dying parent

Type of Change

  • Bug fix

Test Plan

  • Stacked sheet dismiss → parent's onDidFocus fires after parent slides back up
  • Single sheet dismiss → no onDidFocus event (unchanged)
  • dismissAll cascade → no spurious onDidFocus on dying parents

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

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 Apr 26, 2026 1:19am

Request Review

@lodev09 lodev09 merged commit f2f2549 into main Apr 26, 2026
6 checks passed
@lodev09 lodev09 deleted the fix/android-did-focus-after-translate branch April 26, 2026 01:22
@lodev09
Copy link
Copy Markdown
Owner Author

lodev09 commented Apr 26, 2026

🚀 This pull request is included in v3.10.1. See Release 3.10.1 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