From 5a06b7ee2c3915b0935ce6058028e3d2de9bb81b Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Tue, 14 Nov 2023 14:34:10 +1300 Subject: [PATCH] Fix default colors on fresh install --- App.tsx | 7 +++---- AppFab.tsx | 18 ++---------------- TimerPage.tsx | 2 -- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/App.tsx b/App.tsx index e8482e1..3c597ae 100644 --- a/App.tsx +++ b/App.tsx @@ -54,8 +54,9 @@ const App = () => { setAppSettings({ startup: gotSettings.startup, theme: gotSettings.theme, - lightColor: gotSettings.lightColor, - darkColor: gotSettings.darkColor, + lightColor: + gotSettings.lightColor || CombinedDefaultTheme.colors.primary, + darkColor: gotSettings.darkColor || CombinedDarkTheme.colors.primary, }); })(); }, []); @@ -67,7 +68,6 @@ const App = () => { ...CombinedDarkTheme.colors, primary: appSettings.darkColor, }, - dark: true, }; const lightTheme = { ...CombinedDefaultTheme, @@ -75,7 +75,6 @@ const App = () => { ...CombinedDefaultTheme.colors, primary: appSettings.lightColor, }, - dark: false, }; let theme = systemTheme === "dark" ? darkTheme : lightTheme; if (appSettings.theme === "dark") theme = darkTheme; diff --git a/AppFab.tsx b/AppFab.tsx index 840e294..0d53ae2 100644 --- a/AppFab.tsx +++ b/AppFab.tsx @@ -1,29 +1,15 @@ -import { ComponentProps, useMemo } from "react"; -import { FAB, useTheme } from "react-native-paper"; -import { CombinedDarkTheme, CombinedDefaultTheme } from "./App"; -import { lightColors } from "./colors"; +import { ComponentProps } from "react"; +import { FAB } from "react-native-paper"; export default function AppFab(props: Partial>) { - const { colors } = useTheme(); - - const fabColor = useMemo( - () => - lightColors.map((color) => color.hex).includes(colors.primary) - ? CombinedDarkTheme.colors.background - : CombinedDefaultTheme.colors.background, - [colors.primary] - ); - return ( diff --git a/TimerPage.tsx b/TimerPage.tsx index 1accf5b..a2cfe14 100644 --- a/TimerPage.tsx +++ b/TimerPage.tsx @@ -73,13 +73,11 @@ export default function TimerPage() {