CS lib
This commit is contained in:
parent
cec664c8d0
commit
ff2320f08c
13 changed files with 297 additions and 297 deletions
|
@ -4,5 +4,5 @@
|
|||
// to render different styles on the client and server, these aren't directly supported in React Native
|
||||
// but can be achieved using a styling library like Nativewind.
|
||||
export function useColorScheme() {
|
||||
return 'light';
|
||||
return 'light';
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue