I made one app in react-naive using
"react-native": "0.62.0",
"react": "16.11.0",
as I put my android device in dark mode, my UI designs get disturbed so i want to make it disable for now.
please help.
I made one app in react-naive using
"react-native": "0.62.0",
"react": "16.11.0",
as I put my android device in dark mode, my UI designs get disturbed so i want to make it disable for now.
please help.
You can disable force dark mode in android by adding this line in your styles.xml
in your android folder
<item name="android:forceDarkAllowed">false</item>
Like this
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:forceDarkAllowed">false</item>
<item name="android:textColor">#000000</item>
</style>
</resources>
You need to run the app again after doing these changes since these changes are native level.
File path: android/app/src/main/res/values/styles.xml
change
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
to
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
For IOS change your info.plist
<key>UIUserInterfaceStyle</key>
<string>Light</string>
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:
export const useTheme = () => {
const isDarkMode = useColorScheme() === 'dark';
const forceDark = useSelector(state => state.application.force_dark);
const themeStorage = useSelector(state => state.application.theme);
const listTheme = ThemeSupport.filter(item => item.theme == themeStorage);
const theme = listTheme.length > 0 ? listTheme[0] : DefaultTheme;
if (forceDark) {
return {theme: theme.dark, colors: theme.dark.colors}; <--- change here
}
if (forceDark === false) {
return {theme: theme.light, colors: theme.light.colors};
}
return isDarkMode
? {theme: theme.dark, colors: theme.dark.colors} <----- change here
: {theme: theme.light, colors: theme.light.colors};
};
So I change dark to ligth and solved my problem.