14c880123c
Expo app with dashboard, time clock, invoices, and settings — native tabs, glass UI, theme-aware components, and iOS Live Activities. Co-authored-by: Cursor <cursoragent@cursor.com>
14 lines
526 B
TypeScript
14 lines
526 B
TypeScript
import { useMemo } from "react";
|
|
import { StyleSheet } from "react-native";
|
|
|
|
import { useAppTheme } from "@/contexts/ThemeContext";
|
|
import type { ThemeColors } from "@/lib/theme-palette";
|
|
|
|
/** StyleSheet factory that re-runs when light/dark palette changes. */
|
|
export function useThemedStyles<T extends StyleSheet.NamedStyles<T>>(
|
|
factory: (colors: ThemeColors, isDark: boolean) => T,
|
|
): T {
|
|
const { colors, isDark } = useAppTheme();
|
|
return useMemo(() => StyleSheet.create(factory(colors, isDark)), [colors, isDark]);
|
|
}
|