Skip to content

Conversation

@vardhan30016
Copy link

@vardhan30016 vardhan30016 commented Nov 24, 2025

PR Checklist

What is the current behavior?

On newer Android versions (API 29+), especially Android 14–16 (edge-to-edge navigation),
the ActionBar is rendered under the status bar.
This causes the ActionBar title, menu items, and navigation button to overlap with the system status bar.

This is due to Toolbar not applying WindowInsets top padding on newer Android layouts.

Related issue: #10856

What is the new behavior?

During createNativeView() on Android:

  • The Toolbar now enables setFitsSystemWindows(true) for correct inset handling.
  • A OnApplyWindowInsetsListener is attached to read the top system inset.
  • The inset value is applied as top padding to the ActionBar.
  • Logic is wrapped in try/catch for safety and backward compatibility.

This ensures the ActionBar is correctly positioned below the status bar on all Android versions.

Fixes #10856.

BREAKING CHANGES

None.

This patch does not modify public APIs or change behavior for older Android versions.
It only resolves layout misalignment under edge-to-edge mode on Android 10+.

@CatchABus
Copy link
Contributor

@vardhan30016 Could you explain how this fixes #10856;

@vardhan30016
Copy link
Author

@vardhan30016 Could you explain how this fixes #10856;

@CatchABus Thanks for the question! Here is how this PR fixes #10856:

The root issue in #10856 appears visually as “data not passed through route”, but the real underlying problem is that the ActionBar was being positioned underneath the Android system status bar on newer Android versions (API 29+, especially Android 13–16 with edge-to-edge mode enabled).

Because the ActionBar overlapped with the status bar, the system insets were not applied correctly, causing several side-effects—including cases where ActionBar-attached components (such as routed components using withComponentInputBinding()) appeared to have missing or non-applied data during initial render.

Why this happens

On modern Android versions:

Toolbar no longer automatically applies top inset padding.

NativeScript’s ActionBar uses a Toolbar.

Without padding, the ActionBar is drawn under the status bar.

This breaks layout measurement and affects the initial binding cycle for routed components.

In short: when the ActionBar layout is wrong, component inputs from routing can appear missing or not applied.

How this PR fixes it

This PR ensures correct inset handling on Android 10+:

Enables setFitsSystemWindows(true) on the Toolbar.

Adds an OnApplyWindowInsetsListener to read system bar insets.

Applies the top inset as padding to the ActionBar’s native view.

Wraps logic in try/catch for backward compatibility.

Result

Once the correct insets are applied:

The ActionBar renders below the status bar.

Routed components receive proper layout and binding timing.

withComponentInputBinding() gets the correct input props on first render.

The issue described in #10856 no longer occurs.

This patch doesn’t change any public API—it simply restores correct layout behavior under the newer Android edge-to-edge system.

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.

data not passed through route when using withComponentInputBinding()

2 participants