Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Fix KeyboardAvoidingView margins on Android

Leendert de Borst28005cfda868
diff --git a/apps/mobile-app/app/(tabs)/settings/password-generator.tsx b/apps/mobile-app/app/(tabs)/settings/password-generator.tsx
index ac24e829c..d301901c3 100644
--- a/apps/mobile-app/app/(tabs)/settings/password-generator.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/password-generator.tsx
@@ -1,4 +1,5 @@
import { useFocusEffect } from 'expo-router';
+import { useHeaderHeight } from 'expo-router/react-navigation';
import { useState, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { KeyboardAvoidingView, Platform, StyleSheet, View } from 'react-native';
@@ -25,6 +26,7 @@ export default function PasswordGeneratorSettingsScreen(): React.ReactNode {
const dbContext = useDb();
const { showAlert } = useDialog();
const { executeVaultMutation } = useVaultMutate();
+ const headerHeight = useHeaderHeight();
const [settings, setSettings] = useState<PasswordSettings | null>(null);
// Increments each time settings are (re)loaded so the panel remounts with fresh initial values.
@@ -102,7 +104,7 @@ export default function PasswordGeneratorSettingsScreen(): React.ReactNode {
}
return (
- <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={styles.keyboardAvoidingView}>
+ <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} keyboardVerticalOffset={Platform.OS === 'android' ? headerHeight : 0} style={styles.keyboardAvoidingView}>
<ThemedContainer>
<ThemedScrollView>
<ThemedText style={styles.descriptionText}>
diff --git a/apps/mobile-app/app/(tabs)/settings/security/change-password.tsx b/apps/mobile-app/app/(tabs)/settings/security/change-password.tsx
index 672a4905a..335a84e83 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/change-password.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/change-password.tsx
@@ -3,6 +3,7 @@ import { IncorrectPasswordError, PasswordChangedElsewhereError } from '@aliasvau
import { MIN_ACCEPTED_PASSWORD_LENGTH } from '@aliasvault/client/utilities/PasswordStrength';
import { Ionicons } from '@expo/vector-icons';
import { router } from 'expo-router';
+import { useHeaderHeight } from 'expo-router/react-navigation';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { StyleSheet, View, KeyboardAvoidingView, Platform } from 'react-native';
@@ -35,6 +36,7 @@ export default function ChangePasswordScreen(): React.ReactNode {
const { executeVaultPasswordChange, syncStatus } = useVaultMutate();
const { t } = useTranslation();
const { showAlert } = useDialog();
+ const headerHeight = useHeaderHeight();
const [currentPassword, setCurrentPassword] = useState('');
const [newPassword, setNewPassword] = useState('');
@@ -169,6 +171,7 @@ export default function ChangePasswordScreen(): React.ReactNode {
)}
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
+ keyboardVerticalOffset={Platform.OS === 'android' ? headerHeight : 0}
style={styles.keyboardAvoidingView}
>
<ThemedContainer testID="change-password-screen">
diff --git a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
index 5d94600f7..e2fd6e3d6 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
@@ -1,5 +1,6 @@
import { SrpAuthService } from '@aliasvault/client/auth/SrpAuthService';
import { router } from 'expo-router';
+import { useHeaderHeight } from 'expo-router/react-navigation';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { StyleSheet, View, KeyboardAvoidingView, Platform } from 'react-native';
@@ -28,6 +29,7 @@ export default function DeleteAccountScreen(): React.ReactNode {
const { username, verifyPassword, logout } = useApp();
const { t } = useTranslation();
const { showAlert, showConfirm } = useDialog();
+ const headerHeight = useHeaderHeight();
const [confirmUsername, setConfirmUsername] = useState('');
const [password, setPassword] = useState('');
@@ -217,6 +219,7 @@ export default function DeleteAccountScreen(): React.ReactNode {
{isLoading && <LoadingOverlay status={loadingStatus ?? ''} />}
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
+ keyboardVerticalOffset={Platform.OS === 'android' ? headerHeight : 0}
style={styles.keyboardAvoidingView}
>
<ThemedContainer>