1 headline: {
2 textAlign: 'center', // <-- the magic
3 fontWeight: 'bold',
4 fontSize: 18,
5 marginTop: 0,
6 width: 200,
7 backgroundColor: 'yellow',
8 }
1import React, { Component } from 'react';
2import { Platform, StyleSheet, View, Text, } from 'react-native';
3
4export default class App extends Component {
5
6 render() {
7
8 return (
9 <View style={styles.container}>
10 <Text style={styles.headerText}>Welcome to skptricks.com</Text>
11 </View>
12 );
13 }
14}
15
16
17const styles = StyleSheet.create({
18 container: {
19 flex: 1,
20 justifyContent: 'center',
21 alignItems: 'center'
22 },
23 headerText: {
24 fontSize: 20,
25 textAlign: "center",
26 margin: 10,
27 fontWeight: "bold"
28 },
29
30});
1<View style={{flex: 1,textAlign: 'center',alignItems: 'center', textAlignVertical: 'center' }}>
2
1<View style={{justifyContent: 'center'}}>
2 <Text>Vertically Centered Text</Text>
3</View>
4