6

I tried to add

<key>UIUserInterfaceStyle</key>
   <string>Light</string>

to App_Resources/iOS/Info.plist

But the app still is with dark mode, even after rebuilding it and deleting hooks, node_modules and platforms.

I'm using tns preview --bundle.

Gabriel S.
  • 167
  • 2
  • 10
  • With {N} theme you can switch between modes easily. – Manoj Jan 08 '20 at 16:11
  • Maybe a dumb question, but is this supposed to reverse all the colors for me automatically or do I still have to code out all the dark mode styles by hand? – Jim Sep 28 '20 at 19:39

3 Answers3

11

Not sure what can be happening with your code but it is really supposed to work. I have been using it until last update (when we finally had time to handle dark mode).

You should also be able to force light mode with

import Theme from "@nativescript/theme";

Theme.setMode(Theme.Light);

Source: https://github.com/NativeScript/theme

Doud
  • 186
  • 9
1

In addition to the plist I did (with Nativescript theme installed)

Page class="ns-light"

Worked for me on iOS 13.1

  • I need to add this in each Page of my app? – Gabriel S. Jan 28 '20 at 22:55
  • no you can do it on frame, `template: ' ' ` please refer to my discussion about this on the theme page here: https://github.com/NativeScript/theme/issues/244 And please if this worked for you mark the answer with a checkmark :) – codeBasePlusPlus Jan 30 '20 at 13:47
  • I wish it worked for me. But it didn't. :( I really don't know what is happenning. Maybe I'll need to refactor the Nativescript-Theme of this app to try to fix this. – Gabriel S. Jan 31 '20 at 14:25
  • Can you edit your original question to include: tns doctor app.scss package.json Information, I'm suspecting either your theme or ios tools or something is not updated to the certain version this stopped being a bug. – codeBasePlusPlus Jan 31 '20 at 18:19
0

put into AppDelegate

self.window?.backgroundColor = .white
            if #available(iOS 13.0, *) {
                self.window?.overrideUserInterfaceStyle = .light
            }
kartik patel
  • 496
  • 1
  • 4
  • 15