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({
|
setAppSettings({
|
||||||
startup: gotSettings.startup,
|
startup: gotSettings.startup,
|
||||||
theme: gotSettings.theme,
|
theme: gotSettings.theme,
|
||||||
lightColor: gotSettings.lightColor,
|
lightColor:
|
||||||
darkColor: gotSettings.darkColor,
|
gotSettings.lightColor || CombinedDefaultTheme.colors.primary,
|
||||||
|
darkColor: gotSettings.darkColor || CombinedDarkTheme.colors.primary,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -67,7 +68,6 @@ const App = () => {
|
||||||
...CombinedDarkTheme.colors,
|
...CombinedDarkTheme.colors,
|
||||||
primary: appSettings.darkColor,
|
primary: appSettings.darkColor,
|
||||||
},
|
},
|
||||||
dark: true,
|
|
||||||
};
|
};
|
||||||
const lightTheme = {
|
const lightTheme = {
|
||||||
...CombinedDefaultTheme,
|
...CombinedDefaultTheme,
|
||||||
|
@ -75,7 +75,6 @@ const App = () => {
|
||||||
...CombinedDefaultTheme.colors,
|
...CombinedDefaultTheme.colors,
|
||||||
primary: appSettings.lightColor,
|
primary: appSettings.lightColor,
|
||||||
},
|
},
|
||||||
dark: false,
|
|
||||||
};
|
};
|
||||||
let theme = systemTheme === "dark" ? darkTheme : lightTheme;
|
let theme = systemTheme === "dark" ? darkTheme : lightTheme;
|
||||||
if (appSettings.theme === "dark") theme = darkTheme;
|
if (appSettings.theme === "dark") theme = darkTheme;
|
||||||
|
|
18
AppFab.tsx
18
AppFab.tsx
|
@ -1,29 +1,15 @@
|
||||||
import { ComponentProps, useMemo } from "react";
|
import { ComponentProps } from "react";
|
||||||
import { FAB, useTheme } from "react-native-paper";
|
import { FAB } from "react-native-paper";
|
||||||
import { CombinedDarkTheme, CombinedDefaultTheme } from "./App";
|
|
||||||
import { lightColors } from "./colors";
|
|
||||||
|
|
||||||
export default function AppFab(props: Partial<ComponentProps<typeof FAB>>) {
|
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 (
|
return (
|
||||||
<FAB
|
<FAB
|
||||||
icon="plus"
|
icon="plus"
|
||||||
testID="add"
|
testID="add"
|
||||||
color={fabColor}
|
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: 20,
|
right: 20,
|
||||||
bottom: 20,
|
bottom: 20,
|
||||||
backgroundColor: colors.primary,
|
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -73,13 +73,11 @@ export default function TimerPage() {
|
||||||
|
|
||||||
<FAB
|
<FAB
|
||||||
icon="plus"
|
icon="plus"
|
||||||
color={colors.background}
|
|
||||||
onPress={add}
|
onPress={add}
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: 20,
|
left: 20,
|
||||||
bottom: 20,
|
bottom: 20,
|
||||||
backgroundColor: colors.primary,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<AppFab icon="stop" onPress={stop} />
|
<AppFab icon="stop" onPress={stop} />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user