NativeScript / NativeScript/angular
Issue with APP_INITIALIZER and NativeScript Theme: Core V2
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 55
- Forks
- 13
- Merge medio
- 16 min
- PR fusionados (30 d)
- 1
Descripción
Environment
- Node.js: v16
- Android SDK: 30
- JDK 11
- Xcode: 13.3.1
- CocoaPods 1.11.2
- CLI: latest
nativescript@8.2.2 - Cross-platform modules:
@nativescript/core@8.1.5 - Android Runtime:
@nativescript/android@8.1.1 - iOS Runtime:
@nativescript/ios@6.5.5(JSC!) - Angular:
@angular/core@13.2.5 - Plugin(s):
├── @nativescript/theme@3.0.2
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 androidornpm 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?
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza ejecutando el proyecto de ejemplo enlazado con npm run android o npm run ios y, a continuación, compara el comportamiento con y sin el proveedor APP_INITIALIZER en app.module.ts. Inspecciona la configuración del tema referenciada en AppComponent y verifica que Theme.setMode() conserve el modo seleccionado y el valor correcto de Application.systemAppearance() después de reiniciar la aplicación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend, mobile-dev
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100