Skip to content

refactor(android): use EventDispatcherListener for screen events#438

Merged
lodev09 merged 2 commits into
mainfrom
refactor/android-screens-event-observer
Jan 16, 2026
Merged

refactor(android): use EventDispatcherListener for screen events#438
lodev09 merged 2 commits into
mainfrom
refactor/android-screens-event-observer

Conversation

@lodev09
Copy link
Copy Markdown
Owner

@lodev09 lodev09 commented Jan 16, 2026

Summary

Replaces the complex RNScreensFragmentObserver (FragmentLifecycleCallbacks-based) with a simpler RNScreensEventObserver that uses React Native's EventDispatcherListener to detect react-native-screens lifecycle events.

Changes

  • Deleted RNScreensFragmentObserver.kt (266 lines) - Complex fragment lifecycle observer with activity lifecycle tracking, pending dismiss/pop runnables, and reflection-based modal detection
  • Added RNScreensEventObserver.kt (65 lines) - Simple EventDispatcherListener that captures the presenter screen's view tag and listens for topWillDisappear/topWillAppear events
  • For stacked sheets, child sheets inherit the parent's presenterScreenTag

Type of Change

  • Refactor (no functional changes)

Test Plan

Tested with react-native-screens navigation (push/pop) and stacked sheets.

Checklist

  • Android
  • iOS (no changes)
  • Web (no changes)

Replace fragment-based observer with event-based approach.
Uses EventDispatcherListener to intercept screen lifecycle events.
Child sheets are rendered inside parent's coordinator layout,
not in the screen hierarchy. Inherit parent's presenter tag.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 16, 2026

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

Project Deployment Review Updated (UTC)
react-native-true-sheet Ready Ready Preview, Comment Jan 16, 2026 6:25pm

Request Review

@lodev09 lodev09 merged commit e06dd4a into main Jan 16, 2026
5 checks passed
@lodev09 lodev09 deleted the refactor/android-screens-event-observer branch January 16, 2026 18:28
@lodev09
Copy link
Copy Markdown
Owner Author

lodev09 commented Jan 18, 2026

🚀 This pull request is included in v3.8.0-beta.0. See Release 3.8.0-beta.0 for release notes.

@lodev09
Copy link
Copy Markdown
Owner Author

lodev09 commented Jan 26, 2026

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