Skip to content

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

Add toast message on copy (#771)

Leendert de Borstf76a396e6d5f
diff --git a/mobile-app/app/(tabs)/(credentials)/[id].tsx b/mobile-app/app/(tabs)/(credentials)/[id].tsx
index 0207a737a..6bfc3db5a 100644
--- a/mobile-app/app/(tabs)/(credentials)/[id].tsx
+++ b/mobile-app/app/(tabs)/(credentials)/[id].tsx
@@ -2,6 +2,7 @@ import { useLocalSearchParams } from 'expo-router';
import { useEffect, useState } from 'react';
import { ActivityIndicator, View, Text, TouchableOpacity, Image, ScrollView, useColorScheme, StyleSheet } from 'react-native';
import * as Clipboard from 'expo-clipboard';
+import Toast from 'react-native-toast-message';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { useDb } from '@/context/DbContext';
@@ -26,6 +27,12 @@ const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> = ({
const copyToClipboard = async () => {
if (value) {
await Clipboard.setStringAsync(value);
+ Toast.show({
+ type: 'success',
+ text1: 'Copied to clipboard',
+ position: 'bottom',
+ visibilityTime: 2000, // Show for 2 seconds
+ });
}
};
@@ -64,9 +71,6 @@ const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> = ({
</Text>
</TouchableOpacity>
)}
- <TouchableOpacity style={styles.iconButton}>
- <Text style={styles.iconText}>📋</Text>
- </TouchableOpacity>
</View>
</View>
</TouchableOpacity>
@@ -96,6 +100,11 @@ export default function CredentialDetailsScreen() {
};
loadCredential();
+
+ // Cleanup function to hide any visible toasts when navigating away
+ return () => {
+ Toast.hide();
+ };
}, [id, dbContext.dbAvailable]);
if (isLoading) {
diff --git a/mobile-app/app/_layout.tsx b/mobile-app/app/_layout.tsx
index c524b4f82..081f64f89 100644
--- a/mobile-app/app/_layout.tsx
+++ b/mobile-app/app/_layout.tsx
@@ -8,6 +8,7 @@ import 'react-native-reanimated';
// Required for certain modules such as secure-remote-password which relies on crypto.getRandomValues
// and this is not available in react-native without this polyfill
import 'react-native-get-random-values';
+import Toast from 'react-native-toast-message';
import { useColorScheme } from '@/hooks/useColorScheme';
import { LoadingProvider } from '@/context/LoadingContext';
@@ -16,11 +17,38 @@ import { AuthProvider } from '@/context/AuthContext';
import { WebApiProvider } from '@/context/WebApiContext';
import { useAuth } from '@/context/AuthContext';
import { useDb } from '@/context/DbContext';
-import { View, ActivityIndicator } from 'react-native';
+import { View, ActivityIndicator, Text } from 'react-native';
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
+// Configure toast styling
+const toastConfig = {
+ success: (props: any) => (
+ <View
+ style={{
+ backgroundColor: '#f97316', // AliasVault orange
+ padding: 12,
+ borderRadius: 8,
+ marginHorizontal: 16,
+ marginBottom: 64,
+ shadowColor: '#000',
+ shadowOffset: {
+ width: 0,
+ height: 2,
+ },
+ shadowOpacity: 0.25,
+ shadowRadius: 3.84,
+ elevation: 5,
+ }}
+ >
+ <Text style={{ color: 'white', fontSize: 14, fontWeight: '500' }}>
+ {props.text1}
+ </Text>
+ </View>
+ ),
+};
+
function RootLayoutNav() {
const colorScheme = useColorScheme();
const authContext = useAuth();
@@ -52,6 +80,7 @@ function RootLayoutNav() {
<Stack.Screen name="+not-found" />
</Stack>
<StatusBar style="auto" />
+ <Toast config={toastConfig} />
</ThemeProvider>
);
}
diff --git a/mobile-app/package-lock.json b/mobile-app/package-lock.json
index c0c1bb3d1..fa95c5049 100644
--- a/mobile-app/package-lock.json
+++ b/mobile-app/package-lock.json
@@ -37,6 +37,7 @@
"react-native-reanimated": "~3.16.1",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
+ "react-native-toast-message": "^2.2.1",
"react-native-web": "~0.19.13",
"react-native-webview": "13.12.5",
"secure-remote-password": "github:LinusU/secure-remote-password#73e5f732b6ca0cdbdc19da1a0c5f48cdbad2cbf0"
@@ -12012,6 +12013,16 @@
"react-native": "*"
}
},
+ "node_modules/react-native-toast-message": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/react-native-toast-message/-/react-native-toast-message-2.2.1.tgz",
+ "integrity": "sha512-iXFMnlxPcgKKs4bZOIl06W16m6KXMh/bAYpWLyVXlISSCdcL2+FX5WPpRP3TGQeM/u9q+j5ex48DDY+72en+Sw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "*",
+ "react-native": "*"
+ }
+ },
"node_modules/react-native-web": {
"version": "0.19.13",
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.19.13.tgz",
diff --git a/mobile-app/package.json b/mobile-app/package.json
index ca906a715..d11db99a0 100644
--- a/mobile-app/package.json
+++ b/mobile-app/package.json
@@ -44,6 +44,7 @@
"react-native-reanimated": "~3.16.1",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
+ "react-native-toast-message": "^2.2.1",
"react-native-web": "~0.19.13",
"react-native-webview": "13.12.5",
"secure-remote-password": "github:LinusU/secure-remote-password#73e5f732b6ca0cdbdc19da1a0c5f48cdbad2cbf0"