From 456af73e916aef083ef07267d998d5d3248797fc Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Tue, 14 Nov 2023 14:45:15 +1300 Subject: [PATCH] Rename useTheme to useAppTheme React Native and React Native Paper already have a useTheme so let's not add to the clutter. --- SettingsPage.tsx | 4 ++-- use-dark.ts | 4 ++-- use-theme.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SettingsPage.tsx b/SettingsPage.tsx index e4722dd..abede86 100644 --- a/SettingsPage.tsx +++ b/SettingsPage.tsx @@ -20,7 +20,7 @@ import { DrawerParams } from "./drawer-param-list"; import { darkOptions, lightOptions, themeOptions } from "./options"; import Settings from "./settings"; import { toast } from "./toast"; -import { useTheme } from "./use-theme"; +import { useAppTheme } from "./use-theme"; const twelveHours = [ "dd/LL/yyyy", @@ -66,7 +66,7 @@ export default function SettingsPage() { setLightColor, darkColor, setDarkColor, - } = useTheme(); + } = useAppTheme(); useEffect(() => { NativeModules.SettingsModule.ignoringBattery(setIgnoring); diff --git a/use-dark.ts b/use-dark.ts index c5f6b45..db25e68 100644 --- a/use-dark.ts +++ b/use-dark.ts @@ -1,9 +1,9 @@ import { useColorScheme } from "react-native"; -import { useTheme } from "./use-theme"; +import { useAppTheme } from "./use-theme"; export default function useDark() { const dark = useColorScheme() === "dark"; - const { theme } = useTheme(); + const { theme } = useAppTheme(); if (theme === "dark") return true; if (theme === "light") return false; diff --git a/use-theme.ts b/use-theme.ts index 448e923..17099e0 100644 --- a/use-theme.ts +++ b/use-theme.ts @@ -17,6 +17,6 @@ export const ThemeContext = createContext<{ setDarkColor: () => null, }); -export function useTheme() { +export function useAppTheme() { return useContext(ThemeContext); }