When i change my mobile theme from light to dark it is affecting the background color of my react native app. I just want it to always remain white but it changes white to black when i change my mobile theme from light to dark. Android version 10 React native version 0.61.5 React version 16.9.0
Add a custom background to the entire container you have at the root and you should be good.
styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
}
})
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.