diff options
author | Markus Amalthea Magnuson <markus@polyscopic.works> | 2023-07-02 22:18:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 15:18:42 -0500 |
commit | 1ea2a94b9b757f7215ae668c485c94ab95d6e40c (patch) | |
tree | 140eaa349f06aef1c2c817a9e2dfd0f634657569 /src | |
parent | 6768e3ff7177ba1e635284da2808b5165c16c1b1 (diff) | |
download | voidsky-1ea2a94b9b757f7215ae668c485c94ab95d6e40c.tar.zst |
Fix keyboard navigation on settings page. (#923)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/screens/Settings.tsx | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index b7a5a8c2c..e1fb549bc 100644 --- a/src/view/screens/Settings.tsx +++ b/src/view/screens/Settings.tsx @@ -172,6 +172,22 @@ export const SettingsScreen = withAuthRequired( }) }, [store]) + const onPressAppPasswords = React.useCallback(() => { + navigation.navigate('AppPasswords') + }, [navigation]) + + const onPressSystemLog = React.useCallback(() => { + navigation.navigate('Log') + }, [navigation]) + + const onPressStorybook = React.useCallback(() => { + navigation.navigate('Debug') + }, [navigation]) + + const onPressSavedFeeds = React.useCallback(() => { + navigation.navigate('SavedFeeds') + }, [navigation]) + return ( <View style={[s.hContentRegion]} testID="settingsScreen"> <ViewHeader title="Settings" /> @@ -369,10 +385,13 @@ export const SettingsScreen = withAuthRequired( Home Feed Preferences </Text> </TouchableOpacity> - <Link + <TouchableOpacity testID="appPasswordBtn" style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]} - href="/settings/app-passwords"> + onPress={onPressAppPasswords} + accessibilityRole="button" + accessibilityHint="Open app password settings" + accessibilityLabel="Opens the app password settings page"> <View style={[styles.iconContainer, pal.btn]}> <FontAwesomeIcon icon="lock" @@ -382,13 +401,13 @@ export const SettingsScreen = withAuthRequired( <Text type="lg" style={pal.text}> App passwords </Text> - </Link> - <Link + </TouchableOpacity> + <TouchableOpacity testID="savedFeedsBtn" style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]} accessibilityHint="Saved Feeds" accessibilityLabel="Opens screen with all saved feeds" - href="/settings/saved-feeds"> + onPress={onPressSavedFeeds}> <View style={[styles.iconContainer, pal.btn]}> <FontAwesomeIcon icon="satellite-dish" @@ -398,7 +417,7 @@ export const SettingsScreen = withAuthRequired( <Text type="lg" style={pal.text}> Saved Feeds </Text> - </Link> + </TouchableOpacity> <TouchableOpacity testID="contentLanguagesBtn" style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]} @@ -459,14 +478,16 @@ export const SettingsScreen = withAuthRequired( <Text type="xl-bold" style={[pal.text, styles.heading]}> Developer Tools </Text> - <Link + <TouchableOpacity style={[pal.view, styles.linkCardNoIcon]} - href="/sys/log" - title="System log"> + onPress={onPressSystemLog} + accessibilityRole="button" + accessibilityHint="Open system log" + accessibilityLabel="Opens the system log page"> <Text type="lg" style={pal.text}> System log </Text> - </Link> + </TouchableOpacity> {isDesktopWeb ? ( <ToggleButton type="default-light" @@ -477,22 +498,26 @@ export const SettingsScreen = withAuthRequired( ) : null} {__DEV__ ? ( <> - <Link + <TouchableOpacity style={[pal.view, styles.linkCardNoIcon]} - href="/sys/debug" - title="Debug tools"> + onPress={onPressStorybook} + accessibilityRole="button" + accessibilityHint="Open storybook page" + accessibilityLabel="Opens the storybook page"> <Text type="lg" style={pal.text}> Storybook </Text> - </Link> - <Link + </TouchableOpacity> + <TouchableOpacity style={[pal.view, styles.linkCardNoIcon]} onPress={onPressResetPreferences} - title="Debug tools"> + accessibilityRole="button" + accessibilityHint="Reset preferences" + accessibilityLabel="Resets the preferences state"> <Text type="lg" style={pal.text}> Reset preferences state </Text> - </Link> + </TouchableOpacity> </> ) : null} <TouchableOpacity |