I'm trying to access the primary color of the theme. I have a problem doing it since the error says "Cannot read property colors of undefined"
Pls check my code below.
import React, { memo } from "react";
import { StyleSheet, Text, withTheme } from "react-native";
const Header = ({ children }) => <Text style={styles.header}>{children}</Text>;
const styles = StyleSheet.create({
header: {
fontSize: 26,
color: withTheme.colors.primary,
},
});
export default memo(Header);