I started with typescript for react native, but sometimes I get very weird error messages and I am not able to fix them.
I am just playing around a bit and I have this line in my code:
<Text text={user?.last_name} style={{color:colors.textSecondary}} variant="labelMedium"/>
Visual Studio Code is giving me this error for colors.textSecondary: Property ‘textSecondary’ does not exist on type ‘{ primary: string; background: string; card: string; text: string; border: string; notification: string; }’.ts(2339)
If I use colors.text it is working, but I do not understand why. Here is the theme file, where I am getting the standard theme colors from:
export const Theme = {
light: {
mode: 'light',
colors: {
primary: '#1976d2',
secondary: '#7393B3',
background: '#f9f9f9',
card: '#ffffff',
text: '#303233',
textSecondary: '#727272',
border: '#e8e8e8',
error: '#f44336',
},
},
dark: {
mode: 'dark',
colors: {
primary: '#1976d2',
secondary: '#7393B3',
background: '#171819',
card: '#202122',
text: '#e4e6eb',
textSecondary: '#b0b3b8',
border: '#333435',
error: '#f44336',
},
},
};
What am I doing wrong here? The text color is displaying correct by the way.
Thanks!
Jan