I've created a React Native functional component with both light and dark theme styles.
const lightThemeOverrides = StyleSheet.create({ <light_override_styles_here> });const styles = StyleSheet.create({ <styles_here> });
I'm trying to use them in my code with the help of a function:
const themedStyles = (key: string) => { if (props.theme === 'light') { return { ...styles[key], ...lightThemeOverrides[key] }; } else { return styles[key]; } };
I use this function in my JSX like so: <View style={themedStyles('popup')}>
But my ts linter is complaining, that Element implicitly has an 'any' type because type '{ popup: { backgroundColor: string; }; text: { color: string; }; }' has no index signature.
Any idea how to fix this?All tips will be highly appreciated.