Reputation: 8407
I'm trying to style a Text element but I'm getting the following error:
Can't find variable: StyleSheet
This is the code:
import React from 'react';
import {Text} from 'react-native';
const Header = () => (
<Text style = {styles.textStyle}>This is the header</Text>
);
const styles = StyleSheet.create({
textStyle: {
fontSize: 20
}
});
export default Header;
I can figure out what the problem is, did I miss something?
Upvotes: 1
Views: 2599
Reputation: 308
import StyleSheet before using it.
import { StyleSheet, Text } from 'react-native';
Upvotes: 5