Closed codeBasePlusPlus closed 4 years ago
Try with the latest @next version (2.3.0-2020-01-13-101337-01) and let me know if it helps.
Try with the latest @next version (2.3.0-2020-01-13-101337-01) and let me know if it helps.
ok:
tns update next
deleted sample project, created new one, then package.json
"@nativescript/theme": "2.3.0-2020-01-13-101337-01"
npm install
npm list @nativescript/theme
Result:
└── @nativescript/theme@2.3.0-2020-01-13-101337-01
So we are good to go, same problem.
After a lot of fiddling it worked as such (upgrade to 2.3.0 is required didn't work before): for Android: v29->styles:
<item name="android:forceDarkAllowed">false</item>
app.js:
template: `
<Frame class="ns-light">
<Home />
</Frame>`,
This is enough for iOS if you have the key but android no, if the device is in dark mode the app will be dark even though it thinks it is light, I tested this with Theme.getMode() and it returns ns-light. So you need to force it with JS, I did this in app.js for global scope but you can do this in your components if you want.
import Theme from "@nativescript/theme";
mounted() {
Theme.setMode(Theme.Light);
}
for iOS:
info.plist
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<Frame class="ns-light">
is enough for it behave however you want, but I guess a global force light wouldn't hurt on it either.
Thanks a bunch @bundyo big boss you can close this issue now. ♥
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug
tns create AppName --vue --appid com.something.app
info.plist
v29 -> style.xml
<item name="android:forceDarkAllowed">false</item>
app.js
Result:
To test the issue I did the javascript part by:
As a mounted on Home.vue, can confirm it switches the iOS view to dark mode but not android.
Basically everything works perfectly on iOS, but on android if the device is in dark mode nothing I do it seems to be able to force it to light mode.
Android docs has this thing, but I don't know how to mirror it to Nativescript. https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate.html#MODE_NIGHT_NO
Stuff: app.scss
Home.vue
Thank you,