Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

useUniwindTheme.ts

21 lines917 Bytes

1import { useMemo } from "react";
2​
3import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
4import type { MobileThemeVariables } from "./mobileTheme";
5import { getMobileThemeRuntimeVariables } from "./mobileThemeVariables";
6​
7/**
8 * Complete JS palette for native and third-party APIs that cannot consume a
9 * Uniwind className (React Navigation, native editors, Markdown, SVG gradients,
10 * Reanimated worklets). Ordinary React Native rendering must use className.
11 *
12 * This bridge follows the same single React theme commit as the root
13 * ScopedTheme instead of subscribing every consumer to CSS-variable updates.
14 */
15export function useUniwindTheme(): MobileThemeVariables {
16 const { themeAppearance, themeId } = useAppearancePreferences();
17 return useMemo(
18 () => getMobileThemeRuntimeVariables(themeId, themeAppearance),
19 [themeAppearance, themeId],
20 );