Fix element targeting for native dialog windows on Android#226
Conversation
findTopMost used findViewById(android.R.id.content) which misses dialog windows that don't have that view. Replaced with ContextWrapper unwrap + isDecorView() check, matching the fix in appcues-android-sdk. Also added a native Modal to the example app Events screen for testing overlay layering with dialog windows on Android. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces two independent changes: a refactoring of Android Activity decor view selection logic and a new modal demo feature in the example app. The Android change updates how 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
findTopMost()usedfindViewById(android.R.id.content) != nullto filter window roots, but dialog windows often don't haveandroid.R.id.content, so the SDK falls back to the Activity's DecorView and misses views inside the dialogChanges
ReactNativeElementTargeting.kt— ReplacefindViewById(android.R.id.content)filter withisOwnedBy(activity) && isDecorView(). UsesContextWrapperunwrap to match dialog DecorViews whose context is wrapped inContextThemeWrapper. Aligns with the same fix inappcues-android-sdk.EventsScreen.tsx— Added native Modal to example app Events screen for testing overlay layering with dialog windows.Test plan
Made with Cursor
Summary by CodeRabbit
Release Notes
New Features
Refactor