Skip to content

Commit d17bc18

Browse files
committed
refactor: replace theme color accessor
1 parent b3ab9f4 commit d17bc18

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

screens/TestConfigScreen/components/ConfigList.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import { userSettingsStore, UserSetting } from "@/store/UserSettings";
77
import { observer } from "mobx-react";
88
import { testStatisticsStore } from "@/store/TestStatistics";
99
import { I18n } from "@/localize";
10-
import { APP_THEME } from "@/theme";
10+
import { useTheme } from "@react-navigation/native";
1111

1212
export const ConfigList = observer(() => (
1313
<InternalConfigList userSettings={{ ...userSettingsStore.userSetting }} />
1414
));
1515
function SettingButton(props: { onPress: () => void; label: string }) {
1616
const { onPress, label } = props;
17+
const { colors } = useTheme();
18+
1719
return (
1820
<View style={styles.item}>
1921
<Button
@@ -23,7 +25,7 @@ function SettingButton(props: { onPress: () => void; label: string }) {
2325
width: "100%",
2426
}}
2527
labelStyle={{
26-
color: "#000",
28+
color: colors.text,
2729
fontFamily: "inherit",
2830
}}
2931
contentStyle={{
@@ -50,6 +52,8 @@ function InternalConfigList({ userSettings }: { userSettings: UserSetting }) {
5052
}
5153
};
5254

55+
const { colors } = useTheme();
56+
5357
return (
5458
<View style={styles.container}>
5559
<View style={styles.list}>
@@ -58,7 +62,7 @@ function InternalConfigList({ userSettings }: { userSettings: UserSetting }) {
5862
<Switch
5963
value={isSaveDataToDevice}
6064
onValueChange={onToggleSwitch}
61-
color={APP_THEME.colors.primary}
65+
color={colors.primary}
6266
></Switch>
6367
</View>
6468
<SettingButton

theme/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export const miniStyle = StyleSheet.create({
66
fontSize: 12,
77
},
88
});
9+
/**
10+
* @todo handle the theme with light/dark
11+
*/
912
export const APP_THEME = {
1013
...DefaultTheme,
1114
colors: {

0 commit comments

Comments
 (0)