Repository navigation
Conversation
|
This fix introduced a new crash: I will try to fix it again. |
|
fixed. |
troZee
left a comment
There was a problem hiding this comment.
The fix only works because a private recursion in react-native-screens (startTransitionRecursive) happens to call startViewTransition on this exact view. Other navigators, or a future screens version, won't do that, and the blank-content bug would come back.
Please think more about a general fix instead of fixing something in one place
There was a problem hiding this comment.
🔵 Needs a closer look
Native transition and Compose lifecycle ordering require final Android device-level review.
0 open findings
What changed in this PR
Preserves Android Compose pager content until native-stack screen exit animations finish.
Changes:
- Retains displayed pages while updating React Native’s logical children.
- Defers composition disposal until transition completion, with detachment cleanup.
- Suppresses pager events after the view is dropped.
| File | Description |
|---|---|
| android/src/main/java/com/reactnativepagerview/ComposePagerView.kt | Adds transition-aware page retention, deferred disposal, and event guards. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
I tested your pr, it works. I will close this pr. Thanks for your work! |
Summary
On Android, navigating back from a native-stack screen containing PagerView can make the pager content disappear before the screen's exit animation finishes. The screen background and views outside the pager remain visible while the pager becomes blank.
React Native removes the pager's children and calls
onDropViewInstancewhilereact-native-screensis still retaining the native view hierarchy for the exit transition. Updating the Compose page list and destroying the composition at that point clears the content too early.This change:
startViewTransition, while keeping React Native's logical child list up to date.endViewTransition, with window detachment as a cleanup fallback.This affects only the Android Compose implementation.
Test Plan
Before this fix: https://github.com/user-attachments/assets/3ab80ccc-efda-4c53-a2ee-511e689dd4fe
After this fix: https://github.com/user-attachments/assets/4a8aaa55-cf4d-407f-8621-d6d7c9ab47e9
What's required for testing (prerequisites)?
react-native-pager-viewafter v9.0.3What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist