-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(ios): Better handling for emitting navigation events #10757
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
feat(ios): Better handling for emitting navigation events #10757
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes update the event-handling logic for tab navigation in iOS and its corresponding automated test. On the iOS side, the emission of the Changes
Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
View your CI Pipeline Execution ↗ for commit 378e39b
☁️ Nx Cloud last updated this comment at |
View your CI Pipeline Execution ↗ for commit 9d16c0d.
☁️ 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/core/ui/page/index.ios.ts (1)
284-290
: Correct implementation of deferred event emission.The logic properly checks for the pending flag, cleans it up, and emits the
navigatingFrom
event with the correctisBack
parameter. This addresses the iOS 17 tab lifecycle timing issue.Consider using an undefined assignment instead of the
delete
operator for better performance:- delete this['_isPendingNavigatingFrom']; + this['_isPendingNavigatingFrom'] = undefined;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/automated/src/ui/tab-view/tab-view-root-tests.ts
(2 hunks)packages/core/ui/page/index.ios.ts
(2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/core/ui/page/index.ios.ts
[error] 286-286: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test-android
🔇 Additional comments (6)
apps/automated/src/ui/tab-view/tab-view-root-tests.ts (4)
2-2
: LGTM! Import addition is necessary for event handling.The addition of
EventData
import is required for the new event handler functionality.
143-148
: Good synchronization mechanism for deferred events.The test correctly implements synchronization for the
navigatingFrom
event that is now deferred in the iOS implementation. The boolean flag and event handler pattern ensures the test waits for the event to fire.
154-156
: Proper event listener setup and synchronization.The test correctly attaches the event listener before the tab switch and waits for the event to occur, which aligns with the deferred event emission behavior implemented in the iOS core.
158-158
: Expected events updated to reflect deferred behavior.The expected events array correctly includes the
navigatingFrom
event for the third tab's page, matching the new deferred emission behavior.packages/core/ui/page/index.ios.ts (2)
257-263
: Well-implemented deferral logic for iOS 17 tab issue.The logic correctly identifies tab bar controller scenarios where the
navigatingFrom
event needs to be deferred. The condition checks ensure the deferral only happens when necessary (tab switching scenarios).
272-272
: Good variable naming consistency.Unifying the variable name from
page
toowner
improves consistency with the rest of the method.
PR Checklist
What is the current behavior?
Right now, we have Page navigation events handling inside iOS page ViewController to handle cases like back button navigation or swipe back navigation.
Unfortunately, the handling is quite messy with a couple of hackish solutions resulting in events being emitted when they shouldn't (e.g. @NathanWalker iOS 18 TabView navigation between frame that were already loaded once).
What is the new behavior?
This PR focuses on improving how these events are emitted and decouple TabView from nested Page logic. Navigation events are now safely emitted from page ViewController when needed.
Few things to note:
navigatingTo
event trigger for back button/swipe back navigations