I'm trying to set a background color of a view. I set everything in here:
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
export default class Login extends Component{
render(){
return(
<View style={styles.container}>
<Text>
Hello.
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container:{
flex: 1,
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'rgba(79, 81, 140, 1.0)',
}
});
The problem is that the view is staying with white color. I tried to add text to the view to see if it's background color is changing and it does. How can I set the background color of the view to be a color I choose? I searched the net but couldn't find anything..
Remove flex:1 from the container style, it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With