Files
jellyfin-audio-player/src/screens/Settings/index.tsx

48 lines
2.3 KiB
TypeScript
Raw Normal View History

import React, { useCallback } from 'react';
import { StyleSheet } from 'react-native';
import Library from './components/Library';
import Cache from './components/Cache';
2023-04-22 23:31:37 +02:00
import useDefaultStyles, { ColoredBlurView } from 'components/Colors';
2020-11-02 22:50:00 +01:00
import { t } from '@localisation';
import { createStackNavigator } from '@react-navigation/stack';
import { useNavigation } from '@react-navigation/native';
import ListButton from 'components/ListButton';
import { THEME_COLOR } from 'CONSTANTS';
import Sentry from './components/Sentry';
2022-01-01 22:36:05 +01:00
import { SettingsNavigationProp } from './types';
import { SafeScrollView } from 'components/SafeNavigatorView';
2020-06-16 23:11:05 +02:00
export function SettingsList() {
2022-01-01 22:36:05 +01:00
const navigation = useNavigation<SettingsNavigationProp>();
const handleLibraryClick = useCallback(() => { navigation.navigate('Library'); }, [navigation]);
const handleCacheClick = useCallback(() => { navigation.navigate('Cache'); }, [navigation]);
const handleSentryClick = useCallback(() => { navigation.navigate('Sentry'); }, [navigation]);
2020-06-16 23:11:05 +02:00
return (
<SafeScrollView>
2023-04-22 23:31:37 +02:00
<ListButton onPress={handleLibraryClick}>{t('jellyfin-library')}</ListButton>
<ListButton onPress={handleCacheClick}>{t('setting-cache')}</ListButton>
<ListButton onPress={handleSentryClick}>{t('error-reporting')}</ListButton>
</SafeScrollView>
2020-06-16 23:11:05 +02:00
);
}
const Stack = createStackNavigator();
export default function Settings() {
const defaultStyles = useDefaultStyles();
return (
2023-04-22 23:31:37 +02:00
<Stack.Navigator initialRouteName="SettingList" screenOptions={{
headerTintColor: THEME_COLOR,
2023-04-22 23:31:37 +02:00
headerTitleStyle: defaultStyles.stackHeader,
headerTransparent: true,
headerBackground: () => <ColoredBlurView style={StyleSheet.absoluteFill} />,
}}>
<Stack.Screen name="SettingList" component={SettingsList} options={{ headerTitle: t('settings') }} />
<Stack.Screen name="Library" component={Library} options={{ headerTitle: t('jellyfin-library') }} />
<Stack.Screen name="Cache" component={Cache} options={{ headerTitle: t('setting-cache') }} />
<Stack.Screen name="Sentry" component={Sentry} options={{ headerTitle: t('error-reporting') }} />
</Stack.Navigator>
);
2020-06-16 23:11:05 +02:00
}