-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(ios): Allow creating missing view controllers on reused views #10941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
View your CI Pipeline Execution ↗ for commit 5ed501c
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances view controller lifecycle management on iOS by adding defensive null checks and supporting view controller recreation scenarios. The changes ensure that view controllers can be safely recreated after disposal, preventing potential crashes when native views are accessed after disposal.
Key changes:
- Added
createNativeViewmethods that recreate view controllers if they've been disposed - Added null safety checks throughout view controller access points
- Changed
_iosproperties from public to private across Frame, Page, and TabView components
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/ui/tab-view/index.ios.ts | Adds view controller recreation in createNativeView, adds null checks for _ios property access, updates method signatures to accept tab bar controller parameter for safer navigation |
| packages/core/ui/page/index.ios.ts | Adds view controller recreation in createNativeView and null check for viewController property |
| packages/core/ui/frame/index.ios.ts | Changes _ios to private, adds view controller recreation in createNativeView, removes obsolete tslint comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
PR Checklist
What is the current behavior?
Right now, if one removes a view like Frame from the view-tree and decides to re-add it there, the view controller will have already been disposed and there's no handling for creating it anew.
What is the new behavior?
Create view controller during
createNativeViewstep if missing.We keep the view controller initialization inside constructors because it's needed for special cases and tests.
Also, there are a couple of small improvements that help TabView tab transition animation work even if view was disposed in the meantime and let tests pass.
This might also be a solution to the problem described in #10940