2023-02-07 16:06:05 +01:00
|
|
|
import React, { useMemo } from 'react';
|
2023-02-04 17:29:06 +01:00
|
|
|
|
|
|
|
import { NavigationContainer } from '@react-navigation/native';
|
|
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
|
|
|
2023-02-06 11:48:53 +01:00
|
|
|
import MainScreen from './src/screens/MainScreen';
|
|
|
|
import { Card } from './src/types';
|
|
|
|
import CardEditScreen from './src/screens/CardEditScreen';
|
|
|
|
import { QueryClient, QueryClientProvider } from 'react-query';
|
2023-02-07 16:06:05 +01:00
|
|
|
import { StatusBar, useColorScheme } from 'react-native';
|
|
|
|
import { ThemeProvider } from 'styled-components/native';
|
|
|
|
|
|
|
|
import LightTheme from './src/themes/lightTheme';
|
|
|
|
import DarkTheme from './src/themes/darkTheme';
|
2023-02-06 11:48:53 +01:00
|
|
|
|
2023-03-29 16:33:45 +02:00
|
|
|
import './src/locales/i18n';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
2023-02-06 11:48:53 +01:00
|
|
|
export type RootStackParams = {
|
|
|
|
Main: undefined;
|
|
|
|
Add: undefined;
|
|
|
|
Edit: { card: Card; index: number };
|
|
|
|
};
|
|
|
|
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
const Stack = createNativeStackNavigator<RootStackParams>();
|
2023-02-04 17:29:06 +01:00
|
|
|
|
|
|
|
const App = () => {
|
2023-03-29 16:33:45 +02:00
|
|
|
const { t } = useTranslation();
|
2023-02-07 16:06:05 +01:00
|
|
|
const colorScheme = useColorScheme();
|
|
|
|
const theme = useMemo(
|
|
|
|
() => (colorScheme === 'dark' ? DarkTheme : LightTheme),
|
|
|
|
[colorScheme],
|
|
|
|
);
|
|
|
|
|
2023-02-04 17:29:06 +01:00
|
|
|
return (
|
2023-02-06 11:48:53 +01:00
|
|
|
<QueryClientProvider client={queryClient}>
|
2023-02-07 16:06:05 +01:00
|
|
|
<ThemeProvider theme={theme}>
|
|
|
|
<NavigationContainer>
|
|
|
|
<StatusBar
|
|
|
|
backgroundColor={'transparent'}
|
|
|
|
barStyle={colorScheme === 'dark' ? 'light-content' : 'dark-content'}
|
|
|
|
translucent
|
2023-02-06 11:48:53 +01:00
|
|
|
/>
|
2023-02-07 16:06:05 +01:00
|
|
|
<Stack.Navigator
|
|
|
|
screenOptions={{
|
|
|
|
headerStyle: {
|
|
|
|
backgroundColor: theme.colors.header,
|
|
|
|
},
|
|
|
|
headerTintColor: theme.colors.text,
|
|
|
|
headerTitleStyle: {
|
|
|
|
color: theme.colors.text,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Stack.Screen
|
|
|
|
name={'Main'}
|
|
|
|
component={MainScreen}
|
|
|
|
options={{
|
2023-03-29 16:33:45 +02:00
|
|
|
title: t('title.home'),
|
2023-02-07 16:06:05 +01:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Stack.Screen
|
|
|
|
name={'Add'}
|
|
|
|
component={CardEditScreen}
|
2023-03-29 16:33:45 +02:00
|
|
|
options={{
|
|
|
|
title: t('title.card_add'),
|
|
|
|
}}
|
2023-02-07 16:06:05 +01:00
|
|
|
/>
|
|
|
|
<Stack.Screen
|
|
|
|
name={'Edit'}
|
|
|
|
component={CardEditScreen}
|
2023-03-29 16:33:45 +02:00
|
|
|
options={{ title: t('title.card_edit') }}
|
2023-02-07 16:06:05 +01:00
|
|
|
/>
|
|
|
|
</Stack.Navigator>
|
|
|
|
</NavigationContainer>
|
|
|
|
</ThemeProvider>
|
2023-02-06 11:48:53 +01:00
|
|
|
</QueryClientProvider>
|
2023-02-04 17:29:06 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|