When ever I try to position my text center I get the error that variable 'center' can not be found. Am I doing something wrong or is did I not do it correctly?
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Image} from 'react-native';
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View>
<Text style={styles.titel}>Random Text</Text>
</View>
);
}
}
const styles = StyleSheet.create({
titel:{
color: 'black',
justifyContent: center,
alignItems: center,
}
});
center is not a variable, it is a string therefore you need to add it as
titel:{
color: 'black',
justifyContent: 'center',
alignItems: 'center',
}
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