diff --git a/.prettierrc.js b/.prettierrc.js index a0d08460..778a65d3 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -17,7 +17,9 @@ module.exports = { '^navigation', '^navigation/(.*)$', '^network/(.*)$', + '^storage', '^storage/(.*)$', + '^themes/(.*)$', '^[./*]', ], importOrderSeparation: true, diff --git a/App.tsx b/App.tsx index 28d9d16e..09832216 100644 --- a/App.tsx +++ b/App.tsx @@ -1,17 +1,23 @@ import 'localization'; import React from 'react'; +import { StatusBar } from 'react-native'; -import { NavigationContainer } from '@react-navigation/native'; +import { NavigationContainer, useTheme } from '@react-navigation/native'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import NavigationStack from 'navigation'; +import { useThemeConfig } from 'themes/hooks'; + const client = new QueryClient(); const App = () => { + const { theme } = useThemeConfig(); + const { dark: isDarkMode } = useTheme(); return ( - + + diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts new file mode 100644 index 00000000..b045b4cd --- /dev/null +++ b/src/@types/global.d.ts @@ -0,0 +1,5 @@ +import type { CustomTheme } from 'themes/types'; + +declare module '@react-navigation/native' { + export function useTheme(): CustomTheme; +} diff --git a/src/common/Button/styles.ts b/src/common/Button/styles.ts index 8ac29100..c32438d0 100644 --- a/src/common/Button/styles.ts +++ b/src/common/Button/styles.ts @@ -1,6 +1,6 @@ import { StyleSheet } from 'react-native'; -import { BLUE, GREY_01, GREY_02, WHITE } from 'constants/styles'; +import { BLUE, GREY_01, GREY_02, WHITE } from 'constants/colors'; const styles = StyleSheet.create({ container: { diff --git a/src/constants/styles.js b/src/constants/colors.ts similarity index 100% rename from src/constants/styles.js rename to src/constants/colors.ts diff --git a/src/features/auth/welcome/screen/index.tsx b/src/features/auth/welcome/screen/index.tsx index 15160e83..0d6d2386 100644 --- a/src/features/auth/welcome/screen/index.tsx +++ b/src/features/auth/welcome/screen/index.tsx @@ -1,5 +1,5 @@ import React, { useCallback } from 'react'; -import { SafeAreaView, StatusBar, useColorScheme } from 'react-native'; +import { SafeAreaView } from 'react-native'; import Button from 'common/Button'; @@ -15,13 +15,11 @@ type WelcomeScreenProps = { } & WelcomeNavigationProps; const WelcomeScreen = ({ navigation: { navigate } }: WelcomeScreenProps) => { - const isDarkMode = useColorScheme() === 'dark'; const onSignInPress = useCallback(() => navigate(AuthStackScreens.SignIn), [navigate]); const onSignUpPress = useCallback(() => navigate(AuthStackScreens.SignUp), [navigate]); return ( -