fix(ios): TabView does not emit page navigatingFrom in iOS 17 by CatchABus · Pull Request #10757 · NativeScript/NativeScript · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

fix(ios): TabView does not emit page navigatingFrom in iOS 17 #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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CatchABus
Copy link
Contributor

@CatchABus CatchABus commented Jul 2, 2025

PR Checklist

What is the current behavior?

On iOS 17, the navigatingFrom event was not triggered for pages inside TabView tabs.
The lifecycle of tabs changed on iOS 18, resulting in also breaking automated tests.

What is the new behavior?

This PR adds a workaround to emit the navigatingFrom for TabView Pages even on versions that seem faulty.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of tab navigation events, ensuring the correct sequence and timing of navigation events when switching between tabs, particularly on iOS devices.
    • Enhanced test coverage to explicitly capture and synchronize navigation events during tab changes.

Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

The changes update the event-handling logic for tab navigation in iOS and its corresponding automated test. On the iOS side, the emission of the navigatingFrom event is deferred in specific tab bar scenarios to improve accuracy. The test is updated to explicitly listen for and synchronize with this event, ensuring correct sequencing.

Changes

File(s) Change Summary
apps/automated/src/ui/tab-view/tab-view-root-tests.ts Updated test to explicitly listen for and await the navigatingFrom event on the third tab's page; revised expected event arrays.
packages/core/ui/page/index.ios.ts Modified UIViewControllerImpl to defer navigatingFrom event emission in tab bar scenarios; unified variable naming.

Poem

In the warren of tabs, events hop with care,
A rabbit ensures each leap’s truly fair.
With iOS paws, we now wait and see—
NavigatingFrom fires, as synced as can be.
Tests now listen, tails held high,
For every event that hops right by! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-07-02T02_17_39_426Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

nx-cloud bot commented Jul 2, 2025

View your CI Pipeline Execution ↗ for commit 9d16c0d.

Command Status Duration Result
nx test apps-automated -c=ios ✅ Succeeded 2m 13s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-02 02:17:46 UTC

Copy link

nx-cloud bot commented Jul 2, 2025

View your CI Pipeline Execution ↗ for commit 9d16c0d.

Command Status Duration Result
nx run-many --target=test --configuration=ci --... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-02 02:11:30 UTC

@CatchABus CatchABus marked this pull request as ready for review July 2, 2025 02:15
@CatchABus CatchABus changed the title fix(ios): TabView does not emit navigatingFrom in iOS 17 fix(ios): TabView does not emit page navigatingFrom in iOS 17 Jul 2, 2025
Copy link

@coderabbitai coderabbitai bot left a 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 correct isBack 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

📥 Commits

Reviewing files that changed from the base of the PR and between 32f2dd1 and 9d16c0d.

📒 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 to owner improves consistency with the rest of the method.

@CatchABus CatchABus marked this pull request as draft July 2, 2025 02:23
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

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.