This commit is contained in:
Maarten 2024-08-08 14:22:35 +02:00
parent cec664c8d0
commit ff2320f08c
13 changed files with 297 additions and 297 deletions

View file

@ -8,15 +8,15 @@ import { useColorScheme } from 'react-native';
import { Colors } from '@/constants/Colors';
export function useThemeColor(
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) {
const theme = useColorScheme() ?? 'light';
const colorFromProps = props[theme];
const theme = useColorScheme() ?? 'light';
const colorFromProps = props[ theme ];
if (colorFromProps) {
return colorFromProps;
} else {
return Colors[theme][colorName];
}
if (colorFromProps) {
return colorFromProps;
} else {
return Colors[ theme ][ colorName ];
}
}