Fix default colors on fresh install
This commit is contained in:
parent
bec564e18b
commit
5a06b7ee2c
7
App.tsx
7
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;
|
||||
|
|
18
AppFab.tsx
18
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<ComponentProps<typeof FAB>>) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
const fabColor = useMemo(
|
||||
() =>
|
||||
lightColors.map((color) => color.hex).includes(colors.primary)
|
||||
? CombinedDarkTheme.colors.background
|
||||
: CombinedDefaultTheme.colors.background,
|
||||
[colors.primary]
|
||||
);
|
||||
|
||||
return (
|
||||
<FAB
|
||||
icon="plus"
|
||||
testID="add"
|
||||
color={fabColor}
|
||||
style={{
|
||||
position: "absolute",
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
backgroundColor: colors.primary,
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
|
|
|
@ -73,13 +73,11 @@ export default function TimerPage() {
|
|||
|
||||
<FAB
|
||||
icon="plus"
|
||||
color={colors.background}
|
||||
onPress={add}
|
||||
style={{
|
||||
position: "absolute",
|
||||
left: 20,
|
||||
bottom: 20,
|
||||
backgroundColor: colors.primary,
|
||||
}}
|
||||
/>
|
||||
<AppFab icon="stop" onPress={stop} />
|
||||
|
|
Loading…
Reference in New Issue
Block a user