useTheme applied globally

This commit is contained in:
Jakob Stornig 2023-12-30 14:35:05 +01:00
parent 1f304d41f2
commit 9de2678922
12 changed files with 31 additions and 39 deletions

View file

@ -1,7 +1,13 @@
import { useColorScheme } from "react-native";
import colors from "../constants/colors";
/**
* @deprecated use Theme context instead
* @param colorName
* @returns
*/
export function useThemeColor(colorName: keyof typeof colors.light & keyof typeof colors.dark): string {
console.warn("useThemeColor is depreciated. Use useTheme().colors instead")
const theme = useColorScheme() ?? "light";
return colors[theme][colorName];
}