Update CredentialCard.tsx (#882)

This commit is contained in:
Leendert de Borst
2025-06-03 21:52:26 +02:00
committed by Leendert de Borst
parent fbc085439c
commit a1d2bcbe3b

View File

@@ -97,31 +97,37 @@ export function CredentialCard({ credential, onCredentialDelete }: CredentialCar
case 'Copy Username':
if (credential.Username) {
Clipboard.setStringAsync(credential.Username);
Toast.show({
type: 'success',
text1: 'Username copied to clipboard',
position: 'bottom',
});
if (Platform.OS === 'ios') {
Toast.show({
type: 'success',
text1: 'Username copied to clipboard',
position: 'bottom',
});
}
}
break;
case 'Copy Email':
if (credential.Alias?.Email) {
Clipboard.setStringAsync(credential.Alias.Email);
Toast.show({
type: 'success',
text1: 'Email copied to clipboard',
position: 'bottom',
});
if (Platform.OS === 'ios') {
Toast.show({
type: 'success',
text1: 'Email copied to clipboard',
position: 'bottom',
});
}
}
break;
case 'Copy Password':
if (credential.Password) {
Clipboard.setStringAsync(credential.Password);
Toast.show({
type: 'success',
text1: 'Password copied to clipboard',
position: 'bottom',
});
if (Platform.OS === 'ios') {
Toast.show({
type: 'success',
text1: 'Password copied to clipboard',
position: 'bottom',
});
}
}
break;
}
@@ -224,6 +230,7 @@ export function CredentialCard({ credential, onCredentialDelete }: CredentialCar
title="Credential Options"
actions={getMenuActions()}
onPress={handleContextMenuAction}
previewBackgroundColor={colors.accentBackground}
>
<TouchableOpacity
style={styles.credentialCard}
@@ -231,6 +238,9 @@ export function CredentialCard({ credential, onCredentialDelete }: CredentialCar
Keyboard.dismiss();
router.push(`/(tabs)/credentials/${credential.Id}`);
}}
onLongPress={() => {
// Ignore long press to prevent context menu long press from triggering the credential card press.
}}
activeOpacity={0.7}
>
<View style={styles.credentialContent}>