Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React Native Text component will not center inside a View component

$
0
0

Hi I think this should be simple, but I cannot get it to work. Seems like no matter what I do, I cannot get the text component to center horizontally inside the view. I have tried using alignItems:center, justifyContent:center, alignSelf:center, textAlign:center... nothing works. I can get it to center vertically, but not horizontally. Whyyyyy dear lord?

<Animated.View style={[styles.titleContainer]}><Text style={styles.title}>App logo here</Text></Animated.View>

How can I get the text to center both vertically and horizontally?

Here is my CSS:

titleContainer: {    flex: 1,    marginTop:30,    marginBottom:30,    justifyContent:'center'},title:{    color:'white',    textAlign:'center',    alignSelf:'center'},

This is my result:

enter image description here


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>