Deano Deano - 1 year ago 111
React JSX Question

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;

Answer Source

You are missing styles, see following block of code:

const Header = () => {
  return <Text style={styles.textStyle}>Albums!</Text>;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download