Closed benjaminbecker closed 3 years ago
+1
+1
+1!
Have you upgraded to the latest theme? This issue should have been fixed a while ago.
To add more context @NathanaelA, I started a clean project and I am using "@nativescript/theme": "~3.0.1"
I have dark mode set on my phone, (Pixel 5, Android 11)
During the initial load (I am using @nativescript/angular) it displays correctly, however on subsequent webpack hot reloads it will then apply the dark theme.
I have tried the following,
<item name="android:forceDarkAllowed">false</item>
in styles.xml (values-v29 / values-v21)class="ns-light"
on <page-router-outlet>
Theme.setMode(Theme.Light);
manually on ngOnInit in the app component and main.tsif (android) {
on(launchEvent, (args: ApplicationEventData) => {
androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode(androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO);
});
}
It will still appear in dark mode regardless on webpack reloads, not sure if this will be an issue when I go to production or not.
So only during HMR it starts failing? But toggling it in settings won't cause it to fail?
That's correct.
When you say "toggling it in settings" I did not turn dark mode on/off while the app was running, dark mode was set to on the entire time I was testing. Turning it off completely bypasses the issue but that's not a solution.
Well this issue is for if you turn off
and then on
dark mode in settings. You end up with Dark mode theme activate, that issue should be fixed.
Your issue is HMR is somehow resetting back into dark mode which is a completely different issue... So that is why I was trying to find out if it also still occurs when you toggle it off, then on.
If your only issue is in HMR, I would recommend you create a new issue as it is not actually this issue.
Created #289
Environment
Describe the bug This is a bug that shows during runtime. I performed the tests on Android_API 30.
To reproduce the bugs I need the following steps.
go to Android settings and enable "Dark Theme"
start my app (relevant code can be found below)
My app forces the use of the light theme. This works at this time.
go to Android settings and disable "Dark Theme"
Still, everything is OK in my app.
Android settings and enable "Dark Theme"
Maybe you have to repeat steps 3 and 4.
Now my app uses the dark theme, although I force it to use the light theme.
Sample project My main component (
App.vue
) looks like this: