thecodingmachine / react-native-boilerplate

A React Native template for building solid applications πŸ™, using JavaScript πŸ’› or Typescript πŸ’™ (you choose).
https://thecodingmachine.github.io/react-native-boilerplate/
MIT License
4.75k stars 864 forks source link

[BUG]: Can't turn off dark mode on android #345

Closed zhenguet closed 1 year ago

zhenguet commented 1 year ago

react-native environment setup

Description

I have tried many ways to turn off dark mode on Android.

It's working well on some apps I have written.

But now it's not working on my project, which uses React-native boilerplate

    "react": "18.0.0",
    "react-native": "0.69.3",

I follow this to turn off darkmode.

in styles.xml

<!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="android:textColor">#4d4d4d</item>
    <item name="android:forceDarkAllowed">false</item>
  </style>

in AndroidMainfest.xml

<application
    android:name=".MainApplication"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:allowBackup="false"
    android:theme="@style/AppTheme"
    android:screenOrientation="portrait"
    android:forceDarkAllowed="false"
  >
...
</application>

Have any other places affected this? Question on stack overflow

Version

v3.5.1

On which OS this issue appear on?

Desktop OS

Window

JeremyDolle commented 1 year ago

I don't really understand what you are trying to do. You want to block, by a native way, the darkMode UI of the app ?

zhenguet commented 1 year ago

@JeremyDolle yes. can understand as you say. I have check some version and know that it's android problem. sorry for that. but you have solution, can you share to me? thank you so much.