Skip to content

Theme.getMode() returns 'ns-light' while device is in dark mode (ios and android) #232

Open

Description

@nickolanack

before setting the theme, ( using .setMode(...) or .toggleMode())
I would expect .getMode() to return 'ns-dark' if the device (system appearance) was in dark mode however .getMode() initially always returns 'ns-light'

Im not totally sure if this is a bug - I'm now just using application.systemAppearance() instead but thought that I would post this issue just in case.
"nativescript-theme-core": "^2.0.24",

✔ Component nativescript has 6.2.1 version and is up to date.
✔ Component tns-core-modules has 6.2.1 version and is up to date.
✔ Component tns-android has 6.2.0 version and is up to date.
✔ Component tns-ios has 6.2.0 version and is up to date.

Activity

  1. bundyo commented on Nov 26, 2019

    @bundyo
    Contributor

    More like an enhancement, as this functionality wasn't updated after {N} 6.2 got released.

  2. self-assigned this
    on Nov 26, 2019
  3. DevPlus31 commented on Nov 30, 2019

    @DevPlus31

    Same issue getting ns-light instead of ns-dark

  4. rushairer commented on Dec 13, 2019

    @rushairer

    Same issue
    but always getting ns-dark

  5. bundyo commented on Jan 13, 2020

    @bundyo
    Contributor

    With the @next version (2.3.0+) getMode should now return Theme.Auto ("auto"), after which you can call application.systemAppearance() to get the system mode. Can you try it out?

    Also @next introduces hard mode setting - setting a mode will override the system mode until you call Theme.setMode(Theme.Auto).

  6. erjdriver commented on Mar 28, 2020

    @erjdriver

    I'm using 2.3.3 and this feature is not working!

    getMode() returns ns-light.

    not sure why these issues are being closed without being fixed.

  7. bundyo commented on Mar 29, 2020

    @bundyo
    Contributor

    The hard mode change is not yet merged, there were some objections against it from the team. I'll re-discuss it with them tomorrow.

  8. reopened this on Mar 29, 2020
  9. erjdriver commented on Mar 29, 2020

    @erjdriver

    Also, when the app is open and then you go to phone settings to change the system theme (the NS app goes to background) - and then re-open the NS app - the new change is not reflected.

    I do receive the callback in the app that a new theme has been selected - but the page is not refreshed with the new theme.

    Is this something I have to do - and if so how can I call it from the callback - w/ no reference to the current displayed page.

    Thanks.

  10. bundyo commented on Mar 30, 2020

    @bundyo
    Contributor

    Can you provide a Playground demo what exactly are you doing? Thanks in advance.

  11. erjdriver commented on May 24, 2020

    @erjdriver

    The phone is in dark mode.

    I open the nativescript app - and it's in dark mode.

    I do a theme.getMode() and it returns ns-light.

    That's the bug!

  12. bundyo commented on May 30, 2020

    @bundyo
    Contributor

    Can you check if this works with the latest @next version?

  13. dev-buildableworks commented on Jul 22, 2020

    @dev-buildableworks

    This is issue is still current on the latest version of native script (tns version 6.7.8)

  14. iamabs2001 commented on Jan 6, 2021

    @iamabs2001

    everything is fine just disable force dark mode in App Resource and disable always night mode from developer options.

    Screenshot_20210106-194519.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions