react native can't find variable center

2522 views react-native

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 (
        <Text style={styles.titel}>Random Text</Text>

const styles = StyleSheet.create({
     color: 'black',
     justifyContent: center,
     alignItems: center,

answered question

1 Answer


center is not a variable, it is a string therefore you need to add it as

     color: 'black',
     justifyContent: 'center',
     alignItems: 'center',

posted this

Have an answer?


Please login first before posting an answer.