fix: show unified inbox rows with the list's text size, density and preview settings

This commit is contained in:
Linus Rath
2026-10-15 03:37:58 +02:00
parent 33dc3cd0dc
commit 52eb18dc33
+18 -8
View File
@@ -3,6 +3,7 @@ import {
View, Text, StyleSheet, FlatList, ActivityIndicator, Pressable, TextInput, Alert, AppState,
} from 'react-native';
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
import { useDensity, useTypography } from '../theme/dynamic';
import { useFocusEffect } from '@react-navigation/native';
import {
ArrowLeft, Star, Paperclip, AlertTriangle, Search, X, Square, SquareCheck,
@@ -50,6 +51,9 @@ export default function UnifiedInboxScreen({ navigation, route }: Props) {
const styles = React.useMemo(() => makeStyles(c), [c]);
const t = useLocaleStore((s) => s.t);
const insets = useSafeAreaInsets();
const dyn = useTypography();
const density = useDensity();
const showPreview = useSettingsStore((s) => s.showPreview);
const role: UnifiedRole = route.params?.role ?? 'inbox';
const view: CrossView | undefined = route.params?.view;
const accounts = useAccountStore((s) => s.accounts);
@@ -321,7 +325,12 @@ export default function UnifiedInboxScreen({ navigation, route }: Props) {
onPress={() => (selectionMode ? toggleSelect(item) : onOpen(item))}
onLongPress={() => toggleSelect(item)}
delayLongPress={300}
style={({ pressed }) => [styles.row, pressed && styles.rowPressed, isSelected && styles.rowSelected]}
style={({ pressed }) => [
styles.row,
{ paddingVertical: density.rowPaddingVertical },
pressed && styles.rowPressed,
isSelected && styles.rowSelected,
]}
>
{unread && <View style={styles.unreadDot} />}
{selectionMode && (
@@ -329,7 +338,7 @@ export default function UnifiedInboxScreen({ navigation, route }: Props) {
{isSelected ? <SquareCheck size={16} color={c.primary} /> : <Square size={16} color={c.textMuted} />}
</View>
)}
<View style={styles.avatarWrap}>
{density.showAvatar && <View style={styles.avatarWrap}>
<SenderAvatar
name={senderName(item, showRecipient, t('email_viewer.unknown_sender', 'Unknown'))}
email={showRecipient ? item.to?.[0]?.email : item.from?.[0]?.email}
@@ -339,17 +348,17 @@ export default function UnifiedInboxScreen({ navigation, route }: Props) {
{acc && accountIds.length > 1 && (
<View style={[styles.accountDot, { backgroundColor: acc.avatarColor }]} />
)}
</View>
</View>}
<View style={styles.content}>
<View style={styles.line}>
<Text style={[styles.sender, unread && styles.bold]} numberOfLines={1}>
<Text style={[styles.sender, dyn.bodyMedium, unread && styles.bold]} numberOfLines={1}>
{senderName(item, showRecipient, t('email_viewer.unknown_sender', 'Unknown'))}
</Text>
{starred && <Star size={12} color={c.starred} fill={c.starred} />}
{item.hasAttachment && <Paperclip size={12} color={c.textMuted} />}
<Text style={styles.time}>{formatListDate(item.receivedAt, { dateFormat, timeFormat, locale, t })}</Text>
<Text style={[styles.time, dyn.caption]}>{formatListDate(item.receivedAt, { dateFormat, timeFormat, locale, t })}</Text>
</View>
<Text style={[styles.subject, unread && styles.bold]} numberOfLines={1}>
<Text style={[styles.subject, dyn.body, unread && styles.bold]} numberOfLines={1}>
{singleLine(item.subject) || t('email_viewer.no_subject', '(No Subject)')}
</Text>
<View style={styles.line}>
@@ -372,8 +381,9 @@ export default function UnifiedInboxScreen({ navigation, route }: Props) {
</View>
)}
</View>
{item.preview ? (
<Text style={styles.preview} numberOfLines={1}>{singleLine(item.preview)}</Text>
{/* Same settings as the folder list: preview on/off, density, text size. */}
{item.preview && showPreview && density.showPreview ? (
<Text style={[styles.preview, dyn.body]} numberOfLines={2}>{singleLine(item.preview)}</Text>
) : null}
</View>
</Pressable>