Deano
Deano

Reputation: 12200

react-native style tag "can't find variable" error

I'm trying to style a text element in my component, and when attempting to apply style tag "textStyle", I'm getting the following error:

enter image description here

Here is my code:

import React from 'react';
import { Text } from 'react-native';

// Create a Component

const Header = () => {
  return <Text style={textStyle}>Albums!</Text>;
};

const styles = {
  textStyle: {
    fontSize: 30
  }
};
export default Header;

Upvotes: 0

Views: 4818

Answers (1)

Pir Shukarullah Shah
Pir Shukarullah Shah

Reputation: 4232

You are missing styles, see following block of code:

const Header = () => {
  return <Text style={styles.textStyle}>Albums!</Text>;
};

Upvotes: 7

Related Questions