GeezerVison is showing github.com — fix(core): appearance APIs before app start, replaceable Android handlers, explicit systemAppearanceChanged() by triniwiz · Pull Request #11537 · NativeScript/NativeScript
Conversation
triniwiz
commented
Oct 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
PR Checklist
What is the current behavior?
- On Android,
Application.systemAppearance(), orientation() and layoutDirection() throw until Application.run() has initialized the module, because they read the configuration from Application.android.context. A theme module imported by the app's entry cannot read the appearance.
Utils.android.setDarkModeHandler() keeps the first handler it is given and ignores later ones. setStatusBarColor() and setNavigationBarColor() never change a color: they assign with ??= onto settings that always start with default colors. All three store the settings under the current activity rather than the one passed in, so refreshEdgeToEdge() on that activity loses them.
Application.systemAppearanceChanged(rootView, appearance) does nothing while setAutoSystemAppearanceChanged(false) is in effect, so an app that turned automatic changes off to choose its own appearance has to turn them back on around each call.
What is the new behavior?
- The Android trait getters read the configuration from the native application when the context is not set yet. The app's code runs from the native application's
onCreate, so it exists by then.
- The setters replace the handler and the colors they are given, keep the colors they are not given, and store the settings under the activity passed in.
autoSystemAppearanceChanged gates only the automatic path, where the system's appearance changes. The event still fires there. An explicit systemAppearanceChanged() call applies the classes.
Tests: application/system-appearance.spec.ts (4) and utils/edge-to-edge.android.spec.ts (3).
Verified with all of these core PRs merged together (#11527–#11537): apps/automated passes on the iOS 26.4 simulator (1830 OK, 0 failed) and on an Android API 36 emulator (1692 OK; the one failure is the network-dependent IMAGE-CACHE.test_ImageCache_ValidUrl timeout, which also passes on reruns).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Application.systemAppearance(), orientation() and layoutDirection() threw
on Android until Application.run() had initialized the module, because
they read the configuration from Application.android.context, which is
only set then. Code that reads the appearance while it loads, such as a
theme module imported by the app's entry, could not use them.
They now read the configuration from the native application when the
context is not set yet. The app's code runs from the native application's
onCreate, so it exists by then.
…lues
Utils.android.setDarkModeHandler() kept the first handler it was given
and ignored later ones, and setStatusBarColor() and
setNavigationBarColor() never changed a color at all: they assigned with
`??=` onto settings that always start with default colors. All three also
stored the settings under the current activity rather than the one passed
in, so refreshEdgeToEdge() on that activity lost them.
The setters now replace the handler and the colors they are given, keep
the colors they are not, and store the settings under the activity they
were given.
This was referenced Oct 15, 2026
nx-cloud
Bot
commented
Oct 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
View your CI Pipeline Execution ↗ for commit 4316bbf
| Command |
Status |
Duration |
Result |
nx test apps-automated -c=android |
✅ Succeeded |
3m 39s |
View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded |
<1s |
View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-15 20:42:35 UTC
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
pkg-pr-new
Bot
commented
Oct 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Open in StackBlitz
npm i https://pkg.pr.new/@nativescript/core@11537
npm i https://pkg.pr.new/@nativescript/vite@11537
npm i https://pkg.pr.new/@nativescript/webpack@11537
commit: 4316bbf
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…e off
Application.systemAppearanceChanged(rootView, appearance) did nothing
while setAutoSystemAppearanceChanged(false) was in effect, so an app that
turned off automatic changes to choose its own appearance had to turn
them back on around each call.
The flag now gates only the automatic path, where the system's appearance
changes; the event still fires there. An explicit call to
systemAppearanceChanged() applies the classes.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|