Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor to use RobustPressable to replace standard methods (#1187)
Leendert de Borstf1fc2a5f960b
diff --git a/apps/mobile-app/app/(tabs)/credentials/[id].tsx b/apps/mobile-app/app/(tabs)/credentials/[id].tsxindex 4c6ca5342..a358c4de1 100644--- a/apps/mobile-app/app/(tabs)/credentials/[id].tsx+++ b/apps/mobile-app/app/(tabs)/credentials/[id].tsx@@ -1,7 +1,7 @@import MaterialIcons from '@expo/vector-icons/MaterialIcons';import { useLocalSearchParams, useNavigation, useRouter } from 'expo-router';import { useCallback, useEffect, useState } from 'react';-import { ActivityIndicator, View, Text, StyleSheet, TouchableOpacity, Linking, Pressable, Platform } from 'react-native';+import { ActivityIndicator, View, Text, StyleSheet, Linking, Platform } from 'react-native'import Toast from 'react-native-toast-message';import type { Credential } from '@/utils/dist/shared/models/vault';@@ -20,6 +20,7 @@ import { ThemedContainer } from '@/components/themed/ThemedContainer';import { ThemedScrollView } from '@/components/themed/ThemedScrollView';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useDb } from '@/context/DbContext';/**@@ -49,32 +50,16 @@ export default function CredentialDetailsScreen() : React.ReactNode {*/headerRight: () => (<View style={styles.headerRightContainer}>- {Platform.OS === 'android' ? (- <Pressable- onPressIn={handleEdit}- android_ripple={{ color: 'lightgray' }}- pressRetentionOffset={100}- hitSlop={100}- style={styles.headerRightButton}- >- <MaterialIcons- name="edit"- size={24}- color={colors.primary}- />- </Pressable>- ) : (- <TouchableOpacity- onPress={handleEdit}- style={styles.headerRightButton}- >- <MaterialIcons- name="edit"- size={22}- color={colors.primary}- />- </TouchableOpacity>- )}+ <RobustPressable+ onPress={handleEdit}+ style={styles.headerRightButton}+ >+ <MaterialIcons+ name="edit"+ size={Platform.OS === 'android' ? 24 : 22}+ color={colors.primary}+ />+ </RobustPressable></View>),});@@ -137,11 +122,13 @@ export default function CredentialDetailsScreen() : React.ReactNode {</ThemedText>{credential.ServiceUrl && (/^https?:\/\//i.test(credential.ServiceUrl) ? (- <TouchableOpacity onPress={() => Linking.openURL(credential.ServiceUrl!)}>+ <RobustPressable+ onPress={() => Linking.openURL(credential.ServiceUrl!)}+ ><Text style={[styles.serviceUrl, { color: colors.primary }]}>{credential.ServiceUrl}</Text>- </TouchableOpacity>+ </RobustPressable>) : (<Text style={styles.serviceUrl}>{credential.ServiceUrl}@@ -170,6 +157,10 @@ const styles = StyleSheet.create({headerRightButton: {padding: 10,},+ headerRightButtonPressed: {+ padding: 10,+ opacity: 0.8,+ },headerRightContainer: {flexDirection: 'row',},diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsxindex d69ff368f..c3fa295dd 100644--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx@@ -543,14 +543,12 @@ export default function AddEditCredentialScreen() : React.ReactNode {*/...(Platform.OS === 'ios' && {/**- *+ * Header left button.*/- headerLeft: () => (+ headerLeft: () : React.ReactNode => (<RobustPressableonPress={() => router.back()}style={styles.headerLeftButton}- accessibilityRole="button"- accessibilityLabel="Cancel"><ThemedText style={styles.headerLeftButtonText}>{t('common.cancel')}</ThemedText></RobustPressable>@@ -564,13 +562,11 @@ export default function AddEditCredentialScreen() : React.ReactNode {onPress={handleSubmit(onSubmit)}style={[styles.headerRightButton, isSaveDisabled && styles.headerRightButtonDisabled]}disabled={isSaveDisabled}- accessibilityRole="button"- accessibilityLabel="Save credential">- <MaterialIcons- name="save"- size={Platform.OS === 'android' ? 24 : 22}- color={colors.primary}+ <MaterialIcons+ name="save"+ size={Platform.OS === 'android' ? 24 : 22}+ color={colors.primary}/></RobustPressable>),@@ -599,8 +595,6 @@ export default function AddEditCredentialScreen() : React.ReactNode {<RobustPressablestyle={[styles.modeButton, mode === 'random' && styles.modeButtonActive]}onPress={() => setMode('random')}- accessibilityRole="button"- accessibilityState={{ selected: mode === 'random' }}><MaterialIconsname="auto-fix-high"@@ -614,8 +608,6 @@ export default function AddEditCredentialScreen() : React.ReactNode {<RobustPressablestyle={[styles.modeButton, mode === 'manual' && styles.modeButtonActive]}onPress={() => setMode('manual')}- accessibilityRole="button"- accessibilityState={{ selected: mode === 'manual' }}><MaterialIconsname="person"@@ -700,11 +692,9 @@ export default function AddEditCredentialScreen() : React.ReactNode {<View style={styles.section}><ThemedText style={styles.sectionTitle}>{t('credentials.alias')}</ThemedText>- <RobustPressable- style={styles.generateButton}+ <RobustPressable+ style={styles.generateButton}onPress={handleGenerateRandomAlias}- accessibilityRole="button"- accessibilityLabel="Generate random alias"><MaterialIcons name="auto-fix-high" size={20} color="#fff" /><ThemedText style={styles.generateButtonText}>{t('credentials.generateRandomAlias')}</ThemedText>@@ -764,8 +754,6 @@ export default function AddEditCredentialScreen() : React.ReactNode {<RobustPressablestyle={styles.deleteButton}onPress={handleDelete}- accessibilityRole="button"- accessibilityLabel="Delete credential"><ThemedText style={styles.deleteButtonText}>{t('credentials.deleteCredential')}</ThemedText></RobustPressable>diff --git a/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx b/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsxindex 38958c74c..79c3feb0c 100644--- a/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx@@ -2,13 +2,14 @@ import MaterialIcons from '@expo/vector-icons/MaterialIcons';import { useNavigation, useRouter } from 'expo-router';import { useCallback, useEffect } from 'react';import { useTranslation } from 'react-i18next';-import { StyleSheet, View, TouchableOpacity, AppState, Platform, Pressable } from 'react-native';+import { StyleSheet, View, AppState } from 'react-native';import { useColors } from '@/hooks/useColorScheme';import { ThemedSafeAreaView } from '@/components/themed/ThemedSafeAreaView';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';+import { RobustPressable } from '@/components/ui/RobustPressable';/*** Autofill credential created screen.@@ -80,25 +81,15 @@ export default function AutofillCredentialCreatedScreen() : React.ReactNode {/*** Header right button.*/- headerRight: () =>- Platform.OS === 'android' ? (- <Pressable- onPressIn={handleStayInApp}- android_ripple={{ color: 'lightgray' }}- pressRetentionOffset={100}- hitSlop={100}- style={styles.headerRightButton}- >- <ThemedText style={{ color: colors.primary }}>{t('common.cancel')}</ThemedText>- </Pressable>- ) : (- <TouchableOpacity- onPress={handleStayInApp}- style={styles.headerRightButton}- >- <ThemedText style={{ color: colors.primary }}>{t('common.cancel')}</ThemedText>- </TouchableOpacity>- ),+ headerRight: () =>+ <RobustPressable+ onPress={handleStayInApp}+ style={styles.headerRightButton}+ pressRetentionOffset={100}+ hitSlop={100}+ >+ <ThemedText style={{ color: colors.primary }}>{t('common.cancel')}</ThemedText>+ </RobustPressable>});}, [navigation, colors.primary, styles.headerRightButton, handleStayInApp, t]);diff --git a/apps/mobile-app/app/(tabs)/credentials/index.tsx b/apps/mobile-app/app/(tabs)/credentials/index.tsxindex ec524e184..82f3b1d8a 100644--- a/apps/mobile-app/app/(tabs)/credentials/index.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/index.tsx@@ -24,6 +24,7 @@ import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { AndroidHeader } from '@/components/ui/AndroidHeader';import { CollapsibleHeader } from '@/components/ui/CollapsibleHeader';+import { RobustPressable } from '@/components/ui/RobustPressable';import { SkeletonLoader } from '@/components/ui/SkeletonLoader';import { TitleContainer } from '@/components/ui/TitleContainer';import { useAuth } from '@/context/AuthContext';@@ -349,16 +350,15 @@ export default function CredentialsScreen() : React.ReactNode {showNavigationHeader={true}alwaysVisible={true}/>- <TouchableOpacity+ <RobustPressablestyle={styles.fab}onPress={() => {router.push('/(tabs)/credentials/add-edit');Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);}}- activeOpacity={0.8}><MaterialIcons name="add" style={styles.fabIcon} />- </TouchableOpacity>+ </RobustPressable><ThemedView style={styles.stepContainer}><Animated.FlatListref={flatListRef}diff --git a/apps/mobile-app/app/(tabs)/emails/[id].tsx b/apps/mobile-app/app/(tabs)/emails/[id].tsxindex e5c9869e9..c9fe9999c 100644--- a/apps/mobile-app/app/(tabs)/emails/[id].tsx+++ b/apps/mobile-app/app/(tabs)/emails/[id].tsx@@ -3,7 +3,7 @@ import * as FileSystem from 'expo-file-system';import { useLocalSearchParams, useRouter, useNavigation, Stack } from 'expo-router';import React, { useEffect, useState, useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { StyleSheet, View, TouchableOpacity, ActivityIndicator, Alert, Share, useColorScheme, Linking, Text, TextInput, Platform, Pressable } from 'react-native';+import { StyleSheet, View, ActivityIndicator, Alert, Share, useColorScheme, Linking, Text, TextInput, Platform } from 'react-native';import { WebView } from 'react-native-webview';import type { Credential } from '@/utils/dist/shared/models/vault';@@ -17,6 +17,7 @@ import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { IconSymbol } from '@/components/ui/IconSymbol';import { IconSymbolName } from '@/components/ui/IconSymbolName';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useDb } from '@/context/DbContext';import { useWebApi } from '@/context/WebApiContext';@@ -224,6 +225,9 @@ export default function EmailDetailsScreen() : React.ReactNode {},headerRightButton: {padding: 10,+ paddingRight: 10,+ },+ headerRightButtonDelete: {paddingRight: 0,},headerRightContainer: {@@ -324,49 +328,34 @@ export default function EmailDetailsScreen() : React.ReactNode {*/headerRight: () => (<View style={styles.headerRightContainer}>- {Platform.OS === 'android' ? (- <>- <Pressable- onPressIn={() => setHtmlView(!isHtmlView)}- style={styles.headerRightButton}- >- <Ionicons- name={isHtmlView ? 'text-outline' : 'document-outline'}- size={24}- color={colors.primary}- />- </Pressable>- <Pressable- onPressIn={handleDelete}- style={styles.headerRightButton}- >- <Ionicons name="trash-outline" size={24} color="#FF0000" />- </Pressable>- </>- ) : (- <>- <TouchableOpacity- onPress={() => setHtmlView(!isHtmlView)}- style={styles.headerRightButton}- >- <Ionicons- name={isHtmlView ? 'text-outline' : 'document-outline'}- size={22}- color={colors.primary}- />- </TouchableOpacity>- <TouchableOpacity- onPress={handleDelete}- style={styles.headerRightButton}- >- <Ionicons name="trash-outline" size={22} color="#FF0000" />- </TouchableOpacity>- </>- )}+ <RobustPressable+ onPress={() => setHtmlView(!isHtmlView)}+ style={styles.headerRightButton}+ pressRetentionOffset={10}+ hitSlop={10}+ >+ <Ionicons+ name={isHtmlView ? 'text-outline' : 'document-outline'}+ size={Platform.OS === 'android' ? 24 : 22}+ color={colors.primary}+ />+ </RobustPressable>+ <RobustPressable+ onPress={handleDelete}+ style={[styles.headerRightButton, styles.headerRightButtonDelete]}+ pressRetentionOffset={10}+ hitSlop={10}+ >+ <Ionicons+ name="trash-outline"+ size={Platform.OS === 'android' ? 24 : 22}+ color="#FF0000"+ />+ </RobustPressable></View>),});- }, [isHtmlView, navigation, handleDelete, colors.primary, styles.headerRightButton, styles.headerRightContainer]);+ }, [isHtmlView, navigation, handleDelete, colors.primary, styles.headerRightButton, styles.headerRightButtonDelete, styles.headerRightContainer]);if (isLoading) {return (@@ -396,7 +385,7 @@ export default function EmailDetailsScreen() : React.ReactNode {let metadataView = null;if (!isMetadataMaximized) {metadataView = (- <TouchableOpacity onPress={() => setMetadataMaximized(!isMetadataMaximized)}>+ <RobustPressable onPress={() => setMetadataMaximized(!isMetadataMaximized)}><View style={styles.topBox}><View style={styles.subjectContainer}><ThemedText style={styles.subject}>{email.subject}</ThemedText>@@ -405,18 +394,18 @@ export default function EmailDetailsScreen() : React.ReactNode {<Ionicons name="reorder-four-outline" size={22} color={isDarkMode ? '#eee' : '#000'} /></View></View>- </TouchableOpacity>+ </RobustPressable>);} else {metadataView = (- <TouchableOpacity onPress={() => setMetadataMaximized(!isMetadataMaximized)}>+ <RobustPressable onPress={() => setMetadataMaximized(!isMetadataMaximized)}><View style={styles.metadataContainer}><View style={styles.metadataRow}><View style={styles.metadataValue}><ThemedText style={[styles.metadataText, styles.metadataSubject]}>{email.subject}</ThemedText>{associatedCredential && (<View>- <TouchableOpacity+ <RobustPressableonPress={handleOpenCredential}style={styles.metadataCredential}>@@ -424,7 +413,7 @@ export default function EmailDetailsScreen() : React.ReactNode {<ThemedText style={[styles.metadataText, { color: colors.primary }]}>{associatedCredential.ServiceName}</ThemedText>- </TouchableOpacity>+ </RobustPressable></View>)}</View>@@ -470,7 +459,7 @@ export default function EmailDetailsScreen() : React.ReactNode {</View><View style={styles.divider} /></View>- </TouchableOpacity>+ </RobustPressable>);}@@ -517,7 +506,7 @@ export default function EmailDetailsScreen() : React.ReactNode {<View style={styles.attachments}><ThemedText style={styles.attachmentsTitle}>{t('emails.attachments')}</ThemedText>{email.attachments.map((attachment) => (- <TouchableOpacity+ <RobustPressablekey={attachment.id}style={styles.attachment}onPress={() => handleDownloadAttachment(attachment)}@@ -526,7 +515,7 @@ export default function EmailDetailsScreen() : React.ReactNode {<ThemedText style={styles.attachmentName}>{attachment.filename} ({Math.ceil(attachment.filesize / 1024)} {t('emails.sizeKB')})</ThemedText>- </TouchableOpacity>+ </RobustPressable>))}</View>)}diff --git a/apps/mobile-app/app/_layout.tsx b/apps/mobile-app/app/_layout.tsxindex aabc5102c..08e7a51d5 100644--- a/apps/mobile-app/app/_layout.tsx+++ b/apps/mobile-app/app/_layout.tsx@@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from 'react';import { Linking, StyleSheet, Platform } from 'react-native';import 'react-native-reanimated';import 'react-native-get-random-values';+import { GestureHandlerRootView } from 'react-native-gesture-handler';import { install } from 'react-native-quick-crypto';import { useColors, useColorScheme } from '@/hooks/useColorScheme';@@ -131,33 +132,35 @@ function RootLayoutNav() : React.ReactNode {};return (- <ThemeProvider value={colorScheme === 'dark' ? customDarkTheme : customDefaultTheme}>- <Stack- screenOptions={{- headerShown: true,- animation: 'none',- headerTransparent: Platform.OS === 'ios',- headerStyle: {- backgroundColor: colors.accentBackground,- },- headerTintColor: colors.primary,- headerTitleStyle: {- color: colors.text,- },- }}- >- <Stack.Screen name="index" options={{ headerShown: false }} />- <Stack.Screen name="initialize" options={{ headerShown: false }} />- <Stack.Screen name="login" options={{ headerShown: false }} />- <Stack.Screen name="login-settings" />- <Stack.Screen name="reinitialize" options={{ headerShown: false }} />- <Stack.Screen name="unlock" options={{ headerShown: false }} />- <Stack.Screen name="upgrade" options={{ headerShown: false }} />- <Stack.Screen name="(tabs)" options={{ headerShown: false }} />- <Stack.Screen name="+not-found" />- </Stack>- <AliasVaultToast />- </ThemeProvider>+ <GestureHandlerRootView>+ <ThemeProvider value={colorScheme === 'dark' ? customDarkTheme : customDefaultTheme}>+ <Stack+ screenOptions={{+ headerShown: true,+ animation: 'none',+ headerTransparent: Platform.OS === 'ios',+ headerStyle: {+ backgroundColor: colors.accentBackground,+ },+ headerTintColor: colors.primary,+ headerTitleStyle: {+ color: colors.text,+ },+ }}+ >+ <Stack.Screen name="index" options={{ headerShown: false }} />+ <Stack.Screen name="initialize" options={{ headerShown: false }} />+ <Stack.Screen name="login" options={{ headerShown: false }} />+ <Stack.Screen name="login-settings" />+ <Stack.Screen name="reinitialize" options={{ headerShown: false }} />+ <Stack.Screen name="unlock" options={{ headerShown: false }} />+ <Stack.Screen name="upgrade" options={{ headerShown: false }} />+ <Stack.Screen name="(tabs)" options={{ headerShown: false }} />+ <Stack.Screen name="+not-found" />+ </Stack>+ <AliasVaultToast />+ </ThemeProvider>+ </GestureHandlerRootView>);}diff --git a/apps/mobile-app/app/login-settings.tsx b/apps/mobile-app/app/login-settings.tsxindex d11edae98..083bbf038 100644--- a/apps/mobile-app/app/login-settings.tsx+++ b/apps/mobile-app/app/login-settings.tsx@@ -1,7 +1,7 @@import AsyncStorage from '@react-native-async-storage/async-storage';import { useNavigation } from 'expo-router';import { useState, useEffect, useCallback, useMemo, useLayoutEffect } from 'react';-import { StyleSheet, View, Text, TextInput, TouchableOpacity, ActivityIndicator } from 'react-native';+import { StyleSheet, View, Text, TextInput, ActivityIndicator } from 'react-native';import { AppInfo } from '@/utils/AppInfo';@@ -11,6 +11,7 @@ import { useTranslation } from '@/hooks/useTranslation';import { ThemedContainer } from '@/components/themed/ThemedContainer';import { ThemedScrollView } from '@/components/themed/ThemedScrollView';import { ThemedView } from '@/components/themed/ThemedView';+import { RobustPressable } from '@/components/ui/RobustPressable';type ApiOption = {label: string;@@ -167,7 +168,7 @@ export default function SettingsScreen() : React.ReactNode {<View style={styles.formContainer}>{DEFAULT_OPTIONS.map(option => (- <TouchableOpacity+ <RobustPressablekey={option.value}style={[styles.optionButton,@@ -181,7 +182,7 @@ export default function SettingsScreen() : React.ReactNode {]}>{option.label}</Text>- </TouchableOpacity>+ </RobustPressable>))}{selectedOption === 'custom' && (diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsxindex 93e022ec1..e4bb8b29b 100644--- a/apps/mobile-app/app/login.tsx+++ b/apps/mobile-app/app/login.tsx@@ -5,7 +5,7 @@ import { useFocusEffect } from '@react-navigation/native';import { LinearGradient } from 'expo-linear-gradient';import { router } from 'expo-router';import React, { useState, useEffect } from 'react';-import { StyleSheet, View, Text, SafeAreaView, TextInput, TouchableOpacity, ActivityIndicator, Animated, ScrollView, KeyboardAvoidingView, Platform, Dimensions, Alert } from 'react-native';+import { StyleSheet, View, Text, SafeAreaView, TextInput, ActivityIndicator, Animated, ScrollView, KeyboardAvoidingView, Platform, Dimensions, Alert } from 'react-native';import { useApiUrl } from '@/utils/ApiUrlUtility';import ConversionUtility from '@/utils/ConversionUtility';@@ -24,6 +24,7 @@ import Logo from '@/assets/images/logo.svg';import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedView } from '@/components/themed/ThemedView';import { InAppBrowserView } from '@/components/ui/InAppBrowserView';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useAuth } from '@/context/AuthContext';import { useDb } from '@/context/DbContext';import { useWebApi } from '@/context/WebApiContext';@@ -583,7 +584,7 @@ export default function LoginScreen() : React.ReactNode {/></View><View style={styles.buttonContainer}>- <TouchableOpacity+ <RobustPressablestyle={[styles.button, styles.primaryButton]}onPress={handleTwoFactorSubmit}disabled={isLoading}@@ -593,8 +594,8 @@ export default function LoginScreen() : React.ReactNode {) : (<Text style={styles.buttonText}>{t('auth.verify')}</Text>)}- </TouchableOpacity>- <TouchableOpacity+ </RobustPressable>+ <RobustPressablestyle={[styles.button, styles.secondaryButton]}onPress={() => {setCredentials({ username: '', password: '' });@@ -607,7 +608,7 @@ export default function LoginScreen() : React.ReactNode {}}><Text style={styles.buttonText}>{t('common.cancel')}</Text>- </TouchableOpacity>+ </RobustPressable></View><Text style={styles.textMuted}>{t('auth.authCodeNote')}@@ -656,7 +657,7 @@ export default function LoginScreen() : React.ReactNode {numberOfLines={1}/></View>- <TouchableOpacity+ <RobustPressablestyle={[styles.button, styles.primaryButton]}onPress={handleSubmit}disabled={isLoading}@@ -666,7 +667,7 @@ export default function LoginScreen() : React.ReactNode {) : (<Text style={styles.buttonText}>{t('auth.login')}</Text>)}- </TouchableOpacity>+ </RobustPressable><View style={styles.createNewVaultContainer}><Text style={styles.textMuted}>{t('auth.noAccountYet')} </Text><InAppBrowserViewdiff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsxindex 5aba23cab..1faa81d9c 100644--- a/apps/mobile-app/app/unlock.tsx+++ b/apps/mobile-app/app/unlock.tsx@@ -2,7 +2,7 @@ import { MaterialIcons } from '@expo/vector-icons';import { LinearGradient } from 'expo-linear-gradient';import { router } from 'expo-router';import { useState, useEffect, useCallback } from 'react';-import { StyleSheet, View, TextInput, TouchableOpacity, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';+import { StyleSheet, View, TextInput, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';import EncryptionUtility from '@/utils/EncryptionUtility';@@ -14,6 +14,7 @@ import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { Avatar } from '@/components/ui/Avatar';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useAuth } from '@/context/AuthContext';import { useDb } from '@/context/DbContext';import { useWebApi } from '@/context/WebApiContext';@@ -315,7 +316,7 @@ export default function UnlockScreen() : React.ReactNode {/></View>- <TouchableOpacity+ <RobustPressablestyle={styles.button}onPress={handleUnlock}disabled={isLoading}@@ -323,24 +324,24 @@ export default function UnlockScreen() : React.ReactNode {<ThemedText style={styles.buttonText}>{isLoading ? t('auth.unlocking') : t('auth.unlock')}</ThemedText>- </TouchableOpacity>+ </RobustPressable>{isBiometricsAvailable && (- <TouchableOpacity+ <RobustPressablestyle={styles.faceIdButton}onPress={handleBiometricsRetry}><ThemedText style={styles.faceIdButtonText}>{t('auth.tryBiometricAgain', { biometric: biometricDisplayName })}</ThemedText>- </TouchableOpacity>+ </RobustPressable>)}</View>- <TouchableOpacity+ <RobustPressablestyle={styles.logoutButton}onPress={handleLogout}><ThemedText style={styles.logoutButtonText}>{t('auth.logout')}</ThemedText>- </TouchableOpacity>+ </RobustPressable></View></ScrollView></TouchableWithoutFeedback>diff --git a/apps/mobile-app/app/upgrade.tsx b/apps/mobile-app/app/upgrade.tsxindex 4afd72c7e..59332a7db 100644--- a/apps/mobile-app/app/upgrade.tsx+++ b/apps/mobile-app/app/upgrade.tsx@@ -2,7 +2,7 @@ import { LinearGradient } from 'expo-linear-gradient';import { router } from 'expo-router';import { useState, useEffect, useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { StyleSheet, View, TouchableOpacity, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';+import { StyleSheet, View, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';import type { VaultVersion } from '@/utils/dist/shared/vault-sql';import { VaultSqlGenerator } from '@/utils/dist/shared/vault-sql';@@ -16,6 +16,7 @@ import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';import { Avatar } from '@/components/ui/Avatar';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useAuth } from '@/context/AuthContext';import { useDb } from '@/context/DbContext';import { useWebApi } from '@/context/WebApiContext';@@ -417,12 +418,12 @@ export default function UpgradeScreen() : React.ReactNode {<View style={styles.versionContainer}><View style={styles.versionHeader}><ThemedText style={styles.versionTitle}>{t('upgrade.versionInformation')}</ThemedText>- <TouchableOpacity+ <RobustPressablestyle={styles.helpButton}onPress={showVersionDialog}><ThemedText style={styles.helpButtonText}>?</ThemedText>- </TouchableOpacity>+ </RobustPressable></View><View style={styles.versionRow}><ThemedText style={styles.versionLabel}>{t('upgrade.yourVault')}</ThemedText>@@ -438,7 +439,7 @@ export default function UpgradeScreen() : React.ReactNode {</View></View>- <TouchableOpacity+ <RobustPressablestyle={styles.button}onPress={handleUpgrade}disabled={isLoading || isVaultMutationLoading}@@ -446,14 +447,14 @@ export default function UpgradeScreen() : React.ReactNode {<ThemedText style={styles.buttonText}>{isLoading || isVaultMutationLoading ? (syncStatus || t('upgrade.upgrading')) : t('upgrade.upgrade')}</ThemedText>- </TouchableOpacity>+ </RobustPressable>- <TouchableOpacity+ <RobustPressablestyle={styles.logoutButton}onPress={handleLogout}><ThemedText style={styles.logoutButtonText}>{t('upgrade.logout')}</ThemedText>- </TouchableOpacity>+ </RobustPressable></View></View></ScrollView>diff --git a/apps/mobile-app/components/EmailCard.tsx b/apps/mobile-app/components/EmailCard.tsxindex eb09fb97f..12451aa44 100644--- a/apps/mobile-app/components/EmailCard.tsx+++ b/apps/mobile-app/components/EmailCard.tsx@@ -1,6 +1,6 @@import { router } from 'expo-router';import { useEffect, useState } from 'react';-import { StyleSheet, View, TouchableOpacity } from 'react-native';+import { StyleSheet, View } from 'react-native';import type { Credential } from '@/utils/dist/shared/models/vault';import type { MailboxEmail } from '@/utils/dist/shared/models/webapi';@@ -9,6 +9,7 @@ import { useColors } from '@/hooks/useColorScheme';import { useTranslation } from '@/hooks/useTranslation';import { ThemedText } from '@/components/themed/ThemedText';+import { RobustPressable } from '@/components/ui/RobustPressable';import { IconSymbol } from '@/components/ui/IconSymbol';import { IconSymbolName } from '@/components/ui/IconSymbolName';import { useDb } from '@/context/DbContext';@@ -133,10 +134,9 @@ export function EmailCard({ email }: EmailCardProps) : React.ReactNode {});return (- <TouchableOpacity+ <RobustPressablestyle={styles.emailCard}onPress={() => router.push(`/(tabs)/emails/${email.id}`)}- activeOpacity={0.7}><View style={styles.emailHeader}><ThemedText style={styles.emailSubject} numberOfLines={1}>@@ -157,6 +157,6 @@ export function EmailCard({ email }: EmailCardProps) : React.ReactNode {</ThemedText></View>)}- </TouchableOpacity>+ </RobustPressable>);}\ No newline at end of filediff --git a/apps/mobile-app/components/OfflineBanner.tsx b/apps/mobile-app/components/OfflineBanner.tsxindex 87e1cf9b6..7dc55c8e0 100644--- a/apps/mobile-app/components/OfflineBanner.tsx+++ b/apps/mobile-app/components/OfflineBanner.tsx@@ -1,5 +1,5 @@import { Ionicons } from '@expo/vector-icons';-import { StyleSheet, TouchableOpacity, View } from 'react-native';+import { StyleSheet, View } from 'react-native';import Toast from 'react-native-toast-message';import { useColors } from '@/hooks/useColorScheme';@@ -7,6 +7,7 @@ import { useVaultSync } from '@/hooks/useVaultSync';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';+import { RobustPressable } from '@/components/ui/RobustPressable';import { useAuth } from '@/context/AuthContext';/**@@ -100,12 +101,12 @@ export function OfflineBanner(): React.ReactNode {<ThemedText style={styles.text}>Offline mode (read-only)</ThemedText>- <TouchableOpacity+ <RobustPressablestyle={styles.retryButton}onPress={handleRetry}><Ionicons name="refresh" size={20} color={colors.primarySurfaceText} />- </TouchableOpacity>+ </RobustPressable></View></ThemedView>);diff --git a/apps/mobile-app/components/credentials/details/NotesSection.tsx b/apps/mobile-app/components/credentials/details/NotesSection.tsxindex ec1fe8c7c..918de17c9 100644--- a/apps/mobile-app/components/credentials/details/NotesSection.tsx+++ b/apps/mobile-app/components/credentials/details/NotesSection.tsx@@ -7,6 +7,7 @@ import { useColors } from '@/hooks/useColorScheme';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';+import { RobustPressable } from '@/components/ui/RobustPressable';type NotesSectionProps = {credential: Credential;@@ -108,11 +109,11 @@ export const NotesSection: React.FC<NotesSectionProps> = ({ credential }) : Reac{parts.map((part, index) => {if (part.type === 'url') {return (- <Pressable key={index} onPress={() => handleLinkPress(part.url!)}>+ <RobustPressable key={index} onPress={() => handleLinkPress(part.url!)}><Text style={styles.link} selectable={true}>{part.content}</Text>- </Pressable>+ </RobustPressable>);}return (diff --git a/apps/mobile-app/components/themed/ThemedButton.tsx b/apps/mobile-app/components/themed/ThemedButton.tsxindex b8f121684..bf6254514 100644--- a/apps/mobile-app/components/themed/ThemedButton.tsx+++ b/apps/mobile-app/components/themed/ThemedButton.tsx@@ -1,9 +1,10 @@import React from 'react';-import { TouchableOpacity, StyleSheet, ActivityIndicator, ViewStyle, TextStyle } from 'react-native';+import { StyleSheet, ActivityIndicator, ViewStyle, TextStyle } from 'react-native';import { useColors } from '@/hooks/useColorScheme';import { ThemedText } from '@/components/themed/ThemedText';+import { RobustPressable } from '@/components/ui/RobustPressable';type ThemedButtonProps = {title: string;@@ -50,7 +51,7 @@ export const ThemedButton: React.FC<ThemedButtonProps> = ({});return (- <TouchableOpacity+ <RobustPressablestyle={[styles.button,disabled && styles.buttonDisabled,@@ -68,6 +69,6 @@ export const ThemedButton: React.FC<ThemedButtonProps> = ({color={colors.background}/>)}- </TouchableOpacity>+ </RobustPressable>);};\ No newline at end of filediff --git a/apps/mobile-app/components/ui/RobustPressable.tsx b/apps/mobile-app/components/ui/RobustPressable.tsxindex eea60ddab..3f48fde8d 100644--- a/apps/mobile-app/components/ui/RobustPressable.tsx+++ b/apps/mobile-app/components/ui/RobustPressable.tsx@@ -1,105 +1,43 @@-import React, { useRef, useCallback } from 'react';-import { Pressable, PressableProps, GestureResponderEvent, Platform } from 'react-native';+import React from 'react';+import { StyleProp, ViewStyle, Platform } from 'react-native';+import { Pressable } from 'react-native-gesture-handler';-interface IRobustPressableProps extends Omit<PressableProps, 'style'> {- onPress?: (event: GestureResponderEvent) => void;+interface IRobustPressableProps {+ onPress?: () => void;children: React.ReactNode;- activeOpacity?: number;- style?: PressableProps['style'];+ style?: StyleProp<ViewStyle>;+ disabled?: boolean;+ pressRetentionOffset?: number;+ hitSlop?: number;}/**- * A more robust Pressable component that better handles Magic Keyboard trackpad interactions.- * This component ensures clicks register even when the cursor is moving slightly during tap,- * while maintaining TouchableOpacity-like activeOpacity behavior.+ * A simplified robust Pressable component that uses react-native-gesture-handler+ * for better performance and reliability, especially with Magic Keyboard trackpad+ * interactions on iPad. Simulates TouchableOpacity behavior with opacity feedback.+ * Only exposes essential props while handling all press behavior internally.*/export const RobustPressable: React.FC<IRobustPressableProps> = ({onPress,- onPressIn,- onPressOut,- hitSlop,- pressRetentionOffset,- delayLongPress,- disabled,- activeOpacity = 0.7,+ children,style,- ...props+ disabled,+ pressRetentionOffset = 10,+ hitSlop = 10,}) => {- const pressStartTime = useRef<number>(0);- const pressStartLocation = useRef<{ x: number; y: number } | null>(null);- const isPressing = useRef<boolean>(false);- const hasMoved = useRef<boolean>(false);-- const handlePressIn = useCallback((event: GestureResponderEvent) => {- pressStartTime.current = Date.now();- pressStartLocation.current = {- x: event.nativeEvent.pageX,- y: event.nativeEvent.pageY- };- isPressing.current = true;- hasMoved.current = false;-- onPressIn?.(event);- }, [onPressIn]);-- const handlePressOut = useCallback((event: GestureResponderEvent) => {- const pressDuration = Date.now() - pressStartTime.current;-- // Check if the press moved too much (for trackpad detection)- if (pressStartLocation.current) {- const moveDistance = Math.sqrt(- Math.pow(event.nativeEvent.pageX - pressStartLocation.current.x, 2) +- Math.pow(event.nativeEvent.pageY - pressStartLocation.current.y, 2)- );-- // Allow up to 15 pixels of movement for trackpad taps- if (moveDistance > 15) {- hasMoved.current = true;- }- }-- /**- * For iPad with trackpad/mouse: be more lenient with tap detection- * Accept taps up to 600ms and allow small movements- */- if (isPressing.current && pressDuration < 600 && !hasMoved.current) {- onPress?.(event);- }-- isPressing.current = false;- pressStartLocation.current = null;- onPressOut?.(event);- }, [onPress, onPressOut]);-- // Increase hit slop for better trackpad interaction- const enhancedHitSlop = Platform.select({- ios: hitSlop ?? { top: 15, bottom: 15, left: 15, right: 15 },- default: hitSlop ?? { top: 12, bottom: 12, left: 12, right: 12 }- });-- // Increase press retention offset to handle cursor movement during tap- const enhancedPressRetentionOffset = pressRetentionOffset ?? {- top: 25,- bottom: 25,- left: 25,- right: 25- };-return (<Pressable- {...props}- style={({ pressed, hovered }) => [- typeof style === 'function' ? style({ pressed, hovered }) : style,- pressed && { opacity: activeOpacity },- hovered && Platform.OS !== 'ios' && { opacity: Math.max(activeOpacity, 0.8) }- ]}- onPress={undefined} // We handle onPress in onPressOut for better trackpad support- onPressIn={handlePressIn}- onPressOut={handlePressOut}- hitSlop={enhancedHitSlop}- pressRetentionOffset={enhancedPressRetentionOffset}- delayLongPress={delayLongPress ?? 500}+ onPress={onPress}+ hitSlop={hitSlop}+ pressRetentionOffset={pressRetentionOffset}disabled={disabled}- />+ android_ripple={{ color: 'lightgray' }}+ style={({ pressed }) => [+ style,+ { opacity: pressed ? 0.6 : 1 },+ ]}+ >+ {children}+ </Pressable>);-};+};\ No newline at end of file