-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingsScreen.js
86 lines (80 loc) · 2.59 KB
/
SettingsScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React, { useState } from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import { Text, ButtonGroup, Slider, Switch, Divider } from 'react-native-elements';
import * as Localization from 'expo-localization';
const SettingsScreen = () => {
const [selectedIndex, setSelectedIndex] = useState(Localization.locale === 'ko-KR' ? 0 : 1);
const [fontSize, setFontSize] = useState(16);
const [darkMode, setDarkMode] = useState(false);
const [notifications, setNotifications] = useState(true);
const buttons = ['한국어', 'English'];
const updateIndex = (selectedIndex) => {
setSelectedIndex(selectedIndex);
// 언어 변경 로직을 추가할 수 있습니다. (예: i18n 라이브러리와 함께 사용)
};
return (
<ScrollView style={[styles.container, darkMode ? styles.dark : styles.light]}>
<Text h4 style={styles.title}>설정</Text>
<Text style={[styles.label, { fontSize }]}>언어</Text>
<ButtonGroup
onPress={updateIndex}
selectedIndex={selectedIndex}
buttons={buttons}
containerStyle={styles.buttonGroupContainer}
/>
<Divider style={styles.divider} />
<Text style={[styles.label, { fontSize }]}>글자 크기</Text>
<Slider
value={fontSize}
onValueChange={(value) => setFontSize(value)}
minimumValue={10}
maximumValue={30}
thumbStyle={styles.thumbStyle}
trackStyle={styles.trackStyle}
/>
<Divider style={styles.divider} />
<Text style={[styles.label, { fontSize }]}>다크 모드</Text>
<Switch value={darkMode} onValueChange={() => setDarkMode(!darkMode)} thumbColor={darkMode ? '#f1c40f' : '#f4f3f4'} />
<Divider style={styles.divider} />
<Text style={[styles.label, { fontSize }]}>알림</Text>
<Switch value={notifications} onValueChange={() => setNotifications(!notifications)} thumbColor={notifications ? '#f1c40f' : '#f4f3f4'} />
<Divider style={styles.divider} />
<Text style={[styles.label, { fontSize }]}>버전 1.0.0</Text>
</ScrollView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
},
light: {
backgroundColor: 'white',
color: 'black',
},
dark: {
backgroundColor: 'black',
color: 'white',
},
title: {
marginBottom: 20,
},
label: {
marginBottom: 10,
},
buttonGroupContainer: {
marginBottom: 20,
},
divider: {
backgroundColor: '#e0e0e0',
marginVertical: 10,
},
thumbStyle: {
height: 20,
width: 20,
},
trackStyle: {
height: 4,
},
});
export default SettingsScreen;