I have a project with two apps written in React Native. Since I do not currently support a dark theme, users with dark-mode enabled on their devices get bad colors in my app. Therefore I want to disable the dark-mode in my app, until the time I have support for it.
In my first application, I have successfully disabled dark mode. But in my second app, I did the exact same thing, but still dark mode affects my colors. This is how my styles.xml looks like, and I also do not have any styles-night.xml or anything like that.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColor">#000000</item>
<item name="android:forceDarkAllowed">false</item>
</style>
<style name="AppTheme.Launcher">
<item name="android:windowBackground">@drawable/launch</item>
<item name="android:forceDarkAllowed">false</item>
</style>
</resources>
This is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myappname">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:forceDarkAllowed="false"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="secretkey"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/AppTheme.Launcher"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:forceDarkAllowed="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"
tools:targetApi="q">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I have cleaned the build, and rebuilt it again, but still to no effect. Am I missing something? I know there is an option to disable the dark mode in the onCreate function, but that will just recreate the activity and thus slow down the app startup, which I do not want.
It's complicade because you can try many things but if you buy a theme of other developer maybe the code have lines to force the dark mode. I bought a theme a have this lines, like this:
So I change dark to ligth and solved my problem.