Open
Description
Environment
- Node.js: v16
- Android SDK: 30
- JDK 11
- Xcode: 13.3.1
- CocoaPods 1.11.2
- CLI: latest
[email protected]
- Cross-platform modules:
@nativescript/[email protected]
- Android Runtime:
@nativescript/[email protected]
- iOS Runtime:
@nativescript/[email protected]
(JSC!) - Angular:
@angular/[email protected]
- Plugin(s):
├── @nativescript/[email protected]
Describe the bug
The Theme.setMode() from the NativeScript Theme plugin stops working when an async APP_INITIALIZER is used.
To Reproduce
Steps to reproduce:
- Clone the sample project
- run
npm run android
ornpm run ios
(the home component will show some theme/system appearance details) - tap "Change app theme" and choose the opposite theme to your current device setting, the theme changes correctly for now, but
Problem 1: as you can see Application.systemAppearance() now shows a wrong value (e.g. "dark", even if the device is in light mode) - Close the app (not only put it to background)
- Restart the app ...
Problem 2: The app theme is back to auto, although it is set to a specific mode in the AppComponent
But if you disable the APP_INITIALIZER by removing the APP_INITIALIZER from the providers array in app.module.ts everything is working just fine.
Expected behavior
Theme.setMode() is working despite the use of APP_INITIALIZER.
Sample project
https://github.com/jessorlisa/demo-issues-nativescript-ng/tree/issue/set-theme
Additional context
My first suspicion was that something was amiss with the theme but then I could narrow it down to the APP_INITIALIZER.
Any thoughts? Help?
Metadata
Metadata
Assignees
Labels
No labels