diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-03-28 17:18:05 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-03-28 17:36:09 +0200 |
| commit | 1cb36cd073252f4a185cd9775382da4c6861a8cb (patch) | |
| tree | 30d374fc87e0409364f03faa8f7c58eb2bf7b882 /components/Options.js | |
| parent | 67b6f338cfe4da739d39dc6764d11efa00105d81 (diff) | |
| download | remarques-1cb36cd073252f4a185cd9775382da4c6861a8cb.tar.gz remarques-1cb36cd073252f4a185cd9775382da4c6861a8cb.tar.zst remarques-1cb36cd073252f4a185cd9775382da4c6861a8cb.zip | |
Working app
Diffstat (limited to 'components/Options.js')
| -rw-r--r-- | components/Options.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/components/Options.js b/components/Options.js new file mode 100644 index 0000000..fd0c21c --- /dev/null +++ b/components/Options.js @@ -0,0 +1,68 @@ +import * as React from 'react'; +import { SafeAreaView, TextInput, StyleSheet, Text, TouchableOpacity } from 'react-native'; +import * as SecureStore from 'expo-secure-store'; + +let a = true +export default function CategoryView(props) { + let [font, setFont] = React.useState(0) + + async function setFontSS(f) { + setFont(f); + await SecureStore.setItemAsync('font', f.toString()) + } + + React.useEffect(() => getFont(setFont), []) + if (a) { + props.navigation.addListener('focus', () => getFont(setFont)) + a = false + } + + return ( + <SafeAreaView style={styles.cont}> + <Text style={styles.txt}>Selected font: {font}</Text> + <TouchableOpacity onPress={() => setFontSS(12)}><Text style={[styles.txt, styles.btn]}>Font 12</Text></TouchableOpacity> + <TouchableOpacity onPress={() => setFontSS(19)}><Text style={[styles.txt, styles.btn]}>Font 19</Text></TouchableOpacity > + <TouchableOpacity onPress={() => setFontSS(26)}><Text style={[styles.txt, styles.btn]}>Font 26</Text></TouchableOpacity > + </SafeAreaView > + ) +} +export async function getFont(setFont) { + let font = await SecureStore.getItemAsync('font') + if (!font) { font = 22; await SecureStore.setItemAsync('font', '22'); } else font = JSON.parse(font); + setFont(parseInt(font)); +} + +const styles = StyleSheet.create({ + cont: { + flex: 1, + backgroundColor: "black", + padding: 20, + alignItems: "center" + }, + ico: { + width: 200, + height: 200, + }, + txt: { + fontSize: 30, + fontWeight: "bold", + color: "#FFFFFF" + }, + btn: { + textAlign: "center", + borderColor: "pink", + borderWidth: 5, + margin: 10, + padding: 10, + }, + input: { + height: 40, + width: "100%", + margin: 12, + borderWidth: 1, + padding: 10, + color: "#FFFFFF", + } +}) + + |
