Reputation: 88
I have tried textAlign="center" but it only aligns the text in the center but I want to align the whole text in the center including the last line
<Text
style={{
marginTop: 16,
alignSelf: 'center',
fontSize: 15,
width: '75%',
textAlignVertical: 'center',
justifyContent: 'center',
}}>
Making a luxurious lifestyle accessible for a generous group of
women is our daily drive.
</Text>
Upvotes: 2
Views: 72
Reputation: 6434
Here is the full example. please read about textAlign property.
import React, {useState} from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
const App = () => {
return (
<View style={styles.container}>
<Text
style={styles.text}>
Making a luxurious lifestyle accessible for a generous group of
women is our daily drive.
</Text>
</View>
);
};
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems:"center",
padding: 8,
backgroundColor: 'white',
},
text:{
marginTop: 16,
alignSelf: 'center',
fontSize: 15,
textAlign:"center",
width: '75%',
textAlignVertical: 'center',
justifyContent: 'center',
}
});
Upvotes: 3