Skip to content

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

Make header right buttons on Android use Pressable instead of TouchableOpacity (#1080)

Leendert de Borst1a40e3147076
diff --git a/apps/mobile-app/app/(tabs)/credentials/[id].tsx b/apps/mobile-app/app/(tabs)/credentials/[id].tsx
index 43fe69936..8a647ed20 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 } from 'react-native';
+import { ActivityIndicator, View, Text, StyleSheet, TouchableOpacity, Linking, Pressable, Platform } from 'react-native';
import Toast from 'react-native-toast-message';
import type { Credential } from '@/utils/dist/shared/models/vault';
@@ -49,19 +49,32 @@ export default function CredentialDetailsScreen() : React.ReactNode {
*/
headerRight: () => (
<View style={styles.headerRightContainer}>
- <Pressable
- onPressIn={handleEdit}
- android_ripple={{ color: 'lightgray' }}
- pressRetentionOffset={100}
- hitSlop={100}
- style={styles.headerRightButton}
- >
- <MaterialIcons
- name="edit"
- size={24}
- color={colors.primary}
- />
- </Pressable>
+ {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>
+ )}
</View>
),
});
diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
index 44b7045bc..a18e31f32 100644
--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
@@ -567,11 +567,11 @@ export default function AddEditCredentialScreen() : React.ReactNode {
*/
headerRight: () => (
<Pressable
- onPress={handleSubmit(onSubmit)}
- style={[styles.headerRightButton, isSaveDisabled && styles.headerRightButtonDisabled]}
+ onPressIn={handleSubmit(onSubmit)}
android_ripple={{ color: 'lightgray' }}
pressRetentionOffset={100}
hitSlop={100}
+ style={[styles.headerRightButton, isSaveDisabled && styles.headerRightButtonDisabled]}
disabled={isSaveDisabled}
>
<MaterialIcons name="save" size={24} color={colors.primary} />
diff --git a/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx b/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx
index dacd0cfe2..38958c74c 100644
--- a/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/autofill-credential-created.tsx
@@ -2,7 +2,7 @@ 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 } from 'react-native';
+import { StyleSheet, View, TouchableOpacity, AppState, Platform, Pressable } from 'react-native';
import { useColors } from '@/hooks/useColorScheme';
@@ -80,14 +80,25 @@ export default function AutofillCredentialCreatedScreen() : React.ReactNode {
/**
* Header right button.
*/
- headerRight: () => (
- <TouchableOpacity
- onPress={handleStayInApp}
- style={styles.headerRightButton}
- >
- <ThemedText style={{ color: colors.primary }}>{t('common.cancel')}</ThemedText>
- </TouchableOpacity>
- ),
+ 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>
+ ),
});
}, [navigation, colors.primary, styles.headerRightButton, handleStayInApp, t]);
diff --git a/apps/mobile-app/app/(tabs)/emails/[id].tsx b/apps/mobile-app/app/(tabs)/emails/[id].tsx
index 20454c87d..e5c9869e9 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 } from 'react-native';
+import { StyleSheet, View, TouchableOpacity, ActivityIndicator, Alert, Share, useColorScheme, Linking, Text, TextInput, Platform, Pressable } from 'react-native';
import { WebView } from 'react-native-webview';
import type { Credential } from '@/utils/dist/shared/models/vault';
@@ -324,22 +324,45 @@ export default function EmailDetailsScreen() : React.ReactNode {
*/
headerRight: () => (
<View style={styles.headerRightContainer}>
- <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>
+ {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>
+ </>
+ )}
</View>
),
});