This commit is contained in:
oneao committed 2026-04-08 21:28:52 +08:00
1 parent f28107399e
commit 7823fe2768
13 files changed
+294 -28

No files matched your search

+15 -1
View File
@@ -1 +1,15 @@
export { useColorScheme } from 'react-native';
import { useColorScheme } from "react-native";
import { useAppStore } from "@/store/app";
function useIsDark() {
const systemScheme = useColorScheme(); // 'light' | 'dark'
const themeScheme = useAppStore((state) => state.themeScheme);
if (themeScheme === "system") {
return systemScheme === "dark";
}
return themeScheme === "dark";
}
export { useIsDark };
+4 -4
View File
@@ -3,14 +3,14 @@
* https://docs.expo.dev/guides/color-schemes/
*/
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
import { Colors } from "@/constants/theme";
import { useColorScheme } from "@/hooks/use-color-scheme";
export function useThemeColor(
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
colorName: keyof typeof Colors.light & keyof typeof Colors.dark,
) {
const theme = useColorScheme() ?? 'light';
const theme = useColorScheme() ?? "light";
const colorFromProps = props[theme];
if (colorFromProps) {