diff --git a/mobile-app/app/(tabs)/(credentials)/_layout.tsx b/mobile-app/app/(tabs)/(credentials)/_layout.tsx index 65cf5532d..e8aae0f2c 100644 --- a/mobile-app/app/(tabs)/(credentials)/_layout.tsx +++ b/mobile-app/app/(tabs)/(credentials)/_layout.tsx @@ -1,9 +1,8 @@ -import { Colors } from '@/constants/Colors'; +import { useColors } from '@/hooks/useColorScheme'; import { Stack } from 'expo-router'; -import { useColorScheme } from 'react-native'; export default function CredentialsLayout() { - const colorScheme = useColorScheme(); + const colors = useColors(); return ( @@ -19,9 +18,8 @@ export default function CredentialsLayout() { title: 'Credential Details', headerShown: true, headerStyle: { - backgroundColor: Colors[colorScheme ?? 'light'].headerBackground, + backgroundColor: colors.headerBackground, }, - headerTintColor: Colors[colorScheme ?? 'light'].text, }} /> diff --git a/mobile-app/app/(tabs)/(credentials)/index.tsx b/mobile-app/app/(tabs)/(credentials)/index.tsx index 414759d78..c8b67509b 100644 --- a/mobile-app/app/(tabs)/(credentials)/index.tsx +++ b/mobile-app/app/(tabs)/(credentials)/index.tsx @@ -12,8 +12,6 @@ import { CredentialIcon } from '@/components/CredentialIcon'; import { useVaultSync } from '@/hooks/useVaultSync'; import { useColors } from '@/hooks/useColorScheme'; export default function CredentialsScreen() { - const colorScheme = useColorScheme(); - const isDarkMode = colorScheme === 'dark'; const [searchQuery, setSearchQuery] = useState(''); const [refreshing, setRefreshing] = useState(false); const { syncVault } = useVaultSync(); @@ -171,7 +169,7 @@ export default function CredentialsScreen() { {isLoadingCredentials ? ( - + ) : ( } renderItem={({ item }) => ( diff --git a/mobile-app/app/_layout.tsx b/mobile-app/app/_layout.tsx index ede346004..d1d4478db 100644 --- a/mobile-app/app/_layout.tsx +++ b/mobile-app/app/_layout.tsx @@ -51,8 +51,27 @@ function RootLayoutNav() { const colorScheme = useColorScheme(); const colors = useColors(); + + // Create custom themes that extend the default ones. + const customDefaultTheme = { + ...DefaultTheme, + colors: { + ...DefaultTheme.colors, + background: colors.background, + }, + }; + + const customDarkTheme = { + ...DarkTheme, + colors: { + ...DarkTheme.colors, + primary: colors.primary, + background: colors.background, + }, + }; + return ( - + (null); const [passwordHashBase64, setPasswordHashBase64] = useState(null); - const appState = useRef(AppState.currentState); const authContext = useAuth(); const dbContext = useDb(); const webApi = useWebApi(); @@ -217,15 +294,15 @@ export default function LoginScreen() { {twoFactorRequired ? ( - Authentication Code + Authentication Code {isLoading ? ( - + ) : ( Verify )} @@ -254,38 +331,38 @@ export default function LoginScreen() { Cancel - + Note: if you don't have access to your authenticator device, you can reset your 2FA with a recovery code by logging in via the website. ) : ( - Username or email + Username or email setCredentials({ ...credentials, username: text })} placeholder="name / name@company.com" autoCapitalize="none" - placeholderTextColor={isDarkMode ? '#9ca3af' : '#6b7280'} + placeholderTextColor={colors.textMuted} /> - Password + Password setCredentials({ ...credentials, password: text })} placeholder="Enter your password" secureTextEntry - placeholderTextColor={isDarkMode ? '#9ca3af' : '#6b7280'} + placeholderTextColor={colors.textMuted} /> setRememberMe(!rememberMe)} > - Remember me + Remember me {isLoading ? ( - + ) : ( Login )} @@ -303,92 +380,4 @@ export default function LoginScreen() { ); -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - }, - content: { - flex: 1, - padding: 16, - }, - titleContainer: { - flexDirection: 'row', - alignItems: 'center', - gap: 8, - marginBottom: 16, - }, - formContainer: { - gap: 16, - }, - errorContainer: { - backgroundColor: '#fee2e2', - padding: 12, - borderRadius: 8, - marginBottom: 16, - }, - errorText: { - color: '#dc2626', - fontSize: 14, - }, - label: { - fontSize: 14, - fontWeight: '600', - marginBottom: 4, - }, - input: { - borderWidth: 1, - borderRadius: 8, - padding: 12, - fontSize: 16, - }, - buttonContainer: { - gap: 8, - }, - button: { - padding: 12, - borderRadius: 8, - alignItems: 'center', - }, - primaryButton: { - backgroundColor: '#f97316', - }, - secondaryButton: { - backgroundColor: '#6b7280', - }, - buttonText: { - color: '#fff', - fontSize: 16, - fontWeight: '600', - }, - rememberMeContainer: { - flexDirection: 'row', - alignItems: 'center', - gap: 8, - }, - checkbox: { - width: 20, - height: 20, - borderWidth: 2, - borderRadius: 4, - justifyContent: 'center', - alignItems: 'center', - }, - checkboxInner: { - width: 12, - height: 12, - borderRadius: 2, - }, - checkboxChecked: { - backgroundColor: '#f97316', - }, - rememberMeText: { - fontSize: 14, - }, - noteText: { - fontSize: 12, - textAlign: 'center', - marginTop: 16, - }, -}); \ No newline at end of file +} \ No newline at end of file diff --git a/mobile-app/constants/Colors.ts b/mobile-app/constants/Colors.ts index 984f12401..f8136e535 100644 --- a/mobile-app/constants/Colors.ts +++ b/mobile-app/constants/Colors.ts @@ -13,14 +13,17 @@ export const Colors = { background: '#ffffff', accentBackground: '#fff', accentBorder: '#d1d5db', + errorBackground: '#f8d7da', + errorBorder: '#f8d7da', + errorText: '#842029', tint: tintColorLight, icon: '#687076', tabIconDefault: '#687076', tabIconSelected: tintColorLight, headerBackground: '#fff', tabBarBackground: '#fff', - primaryButton: '#f97316', - secondaryButton: '#6b7280', + primary: '#f97316', + secondary: '#6b7280', }, dark: { text: '#ECEDEE', @@ -28,14 +31,17 @@ export const Colors = { background: '#111827', accentBackground: '#1f2937', accentBorder: '#4b5563', + errorBackground: '#3d1a1e', + errorBorder: '#9c2530', + errorText: '#fae1e3', tint: tintColorDark, icon: '#9BA1A6', tabIconDefault: '#9BA1A6', tabIconSelected: tintColorDark, headerBackground: '#1f2937', tabBarBackground: '#1f2937', - primaryButton: '#f97316', - secondaryButton: '#6b7280', + primary: '#f97316', + secondary: '#6b7280', }, } as const;