Skip to content

Problem when trying to disable dark mode on Android. #29387

@RBalconi

Description

@RBalconi

Hello people,
I'm learning react / react native and along, making an app to practice. What is happening is that when the device's darkmode is active it implies the colors chosen in the application (an example below). I do not intend to invest time in and do darkmode now, I would like to learn more about React, make the whole app, and then go to the more "superficial" parts and make darkmode within the config of the app itself.

Would it be possible to inhibit / prevent the device's Dark Mode from interfering with the colors of the app?

It's done with my app design 😥

I'm testing the app on a Xiaomi Mi 9T Pro, I also tested it on the S10 + and it didn't happen, it seems that MiUI forces DarkMode ...
Thank you.

React Native version:

"react": "16.11.0",
"react-native": "0.62.2",

Possible solutions that I was unable to make work.

I found the following code below talking to put in the onCreate method of MainActivity.java, however it does not have this method there. I don't know where and how I can do it.
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)

107943046_3977108782364325_148255309064123217_n

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidAndroid applications.Resolution: For Stack OverflowA question for Stack Overflow. Applying this label will cause issue to be closed.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions