BÀI 18 - IMAGE BACKGROUND TRONG REACT NATIVE
BÀI 18 - IMAGE BACKGROUND TRONG REACT NATIVE
import { StyleSheet, Text, View, ImageBackground } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<ImageBackground style={styles.background} source={require('../Lenovo-WorkSpace/assets/image/background_main_activity.jpg')}>
<View>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
</ImageBackground>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
background: {
flex: 1,
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
resizeMode: 'cover'
}
});