Send files directly between devices over the internet - no cloud storage, no size limits.
TypeScript cross-platformdata-transferdecentralizedfile-sharingfile-transferhole-punchingopen-sourcep2ppeer-to-peerprivacyprivacy-tools
Show settings titles in the native header on mobile
Denis Lupookovbe966f903a19
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 8b51483..79badac 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -73,20 +73,32 @@ function MobileCrashScreen({ error, onRestart }: { error: Error; onRestart: () =)}-function getFlowScreenOptions(theme: Theme) {+function getHeaderOptions(theme: Theme) {return {headerShown: true,headerStyle: { backgroundColor: theme.colors.colorBackground },headerTintColor: theme.colors.colorTextPrimary,headerShadowVisible: false,- headerTitle: '',...(Platform.OS === 'ios' ? { headerBackButtonDisplayMode: 'minimal' as const } : {})} as const}+function getFlowScreenOptions(theme: Theme) {+ return { ...getHeaderOptions(theme), headerTitle: '' } as const+}++function getTitledScreenOptions(theme: Theme, fontFamilyName?: string) {+ return {+ ...getHeaderOptions(theme),+ ...(fontFamilyName ? { headerTitleStyle: { fontFamily: fontFamilyName } } : {})+ } as const+}+function ThemedStack() {- const { theme } = useTheme()+ const { theme, fontFamilyName } = useTheme()+ const { t } = useTranslation(['settings', 'feedback'])const flowScreenOptions = getFlowScreenOptions(theme)+ const titledScreenOptions = getTitledScreenOptions(theme, fontFamilyName)const progress = useSimulatedLoading()return (@@ -95,13 +107,34 @@ function ThemedStack() {<Stack.Screen name='index' options={{ headerShown: false }} /><Stack.Screen name='(tabs)' options={{ headerShown: false }} /><Stack.Screen name='onboarding' options={{ headerShown: false, gestureEnabled: false }} />- <Stack.Screen name='settings' options={flowScreenOptions} />- <Stack.Screen name='language' options={flowScreenOptions} />- <Stack.Screen name='general' options={flowScreenOptions} />- <Stack.Screen name='connection' options={flowScreenOptions} />- <Stack.Screen name='devices' options={flowScreenOptions} />- <Stack.Screen name='about' options={flowScreenOptions} />- <Stack.Screen name='report' options={flowScreenOptions} />+ <Stack.Screen+ name='settings'+ options={{ ...titledScreenOptions, title: t('settings:title') }}+ />+ <Stack.Screen+ name='language'+ options={{ ...titledScreenOptions, title: t('settings:languageTitle') }}+ />+ <Stack.Screen+ name='general'+ options={{ ...titledScreenOptions, title: t('settings:sections.general') }}+ />+ <Stack.Screen+ name='connection'+ options={{ ...titledScreenOptions, title: t('settings:rows.connection') }}+ />+ <Stack.Screen+ name='devices'+ options={{ ...titledScreenOptions, title: t('settings:pairing.pairedDevices') }}+ />+ <Stack.Screen+ name='about'+ options={{ ...titledScreenOptions, title: t('settings:sections.about') }}+ />+ <Stack.Screen+ name='report'+ options={{ ...titledScreenOptions, title: t('feedback:title') }}+ /><Stack.Screenname='send/preparing'options={{ ...flowScreenOptions, gestureEnabled: false }}diff --git a/apps/mobile/app/about.tsx b/apps/mobile/app/about.tsxindex 4435b37..9b2c45f 100644--- a/apps/mobile/app/about.tsx+++ b/apps/mobile/app/about.tsx@@ -41,7 +41,7 @@ export default function AboutScreen() {}return (- <Layout title={t('settings:sections.about')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={styles.content}><View style={styles.brand}><Image source={brandLogo} style={styles.brandLogo} resizeMode='contain' />diff --git a/apps/mobile/app/connection.tsx b/apps/mobile/app/connection.tsxindex b2f9b3e..7707142 100644--- a/apps/mobile/app/connection.tsx+++ b/apps/mobile/app/connection.tsx@@ -28,7 +28,7 @@ export default function ConnectionScreen() {}return (- <Layout title={t('settings:rows.connection')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={[styles.card, styles.cardPad, cardStyle]}><ToggleSwitchchecked={relay}diff --git a/apps/mobile/app/devices.tsx b/apps/mobile/app/devices.tsxindex a71c9c4..4b7cbb8 100644--- a/apps/mobile/app/devices.tsx+++ b/apps/mobile/app/devices.tsx@@ -23,7 +23,6 @@ export default function DevicesScreen() {return (<Layout- title={t('settings:pairing.pairedDevices')}hasNativeHeaderfooter={<Buttondiff --git a/apps/mobile/app/general.tsx b/apps/mobile/app/general.tsxindex 16d2482..3343132 100644--- a/apps/mobile/app/general.tsx+++ b/apps/mobile/app/general.tsx@@ -47,7 +47,7 @@ export default function GeneralScreen() {}return (- <Layout title={t('settings:sections.general')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={styles.container}><View style={[styles.card, cardStyle]}><ToggleSwitchdiff --git a/apps/mobile/app/language.tsx b/apps/mobile/app/language.tsxindex de9f196..a936000 100644--- a/apps/mobile/app/language.tsx+++ b/apps/mobile/app/language.tsx@@ -47,11 +47,7 @@ export default function LanguageScreen() {}return (- <Layout- title={t('settings:languageTitle')}- description={t('settings:languageHint')}- hasNativeHeader- >+ <Layout description={t('settings:languageHint')} hasNativeHeader><LinkCard>{LOCALE_OPTIONS.map((option, index) => {const selected = option.preference === preferencediff --git a/apps/mobile/app/report.tsx b/apps/mobile/app/report.tsxindex 722e3a5..b3f0d45 100644--- a/apps/mobile/app/report.tsx+++ b/apps/mobile/app/report.tsx@@ -36,7 +36,7 @@ export default function ReportScreen() {if (state === 'sent') {return (- <Layout title={t('feedback:title')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={styles.centred}><Text style={[styles.sentTitle, { color: theme.colors.colorTextPrimary }]}>{t('feedback:states.sent')}@@ -50,7 +50,7 @@ export default function ReportScreen() {}return (- <Layout title={t('feedback:title')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={styles.content}><FeedbackTypeSelectorvalue={type}diff --git a/apps/mobile/app/send/preparing.tsx b/apps/mobile/app/send/preparing.tsxindex 7443bb4..3ff9091 100644--- a/apps/mobile/app/send/preparing.tsx+++ b/apps/mobile/app/send/preparing.tsx@@ -48,7 +48,7 @@ export default function SendPreparingScreen() {}, [navigation, handleBack, t, theme.colors.colorTextPrimary])return (- <Layout title='' description='' hasNativeHeader>+ <Layout hasNativeHeader><PreparingView /></Layout>)diff --git a/apps/mobile/app/settings.tsx b/apps/mobile/app/settings.tsxindex 6cb54c0..a4f3596 100644--- a/apps/mobile/app/settings.tsx+++ b/apps/mobile/app/settings.tsx@@ -57,7 +57,7 @@ export default function SettingsScreen() {t('common:labels.systemDefault')return (- <Layout title={t('settings:title')} description='' hasNativeHeader>+ <Layout hasNativeHeader><View style={styles.container}><View style={styles.section}><Text style={[styles.sectionTitle, { color: c.colorTextMuted }]}>diff --git a/apps/mobile/src/components/AddPairDeviceSheet/index.tsx b/apps/mobile/src/components/AddPairDeviceSheet/index.tsxindex 5825831..771eadc 100644--- a/apps/mobile/src/components/AddPairDeviceSheet/index.tsx+++ b/apps/mobile/src/components/AddPairDeviceSheet/index.tsx@@ -26,12 +26,7 @@ export function AddPairDeviceSheet({const c = theme.colorsreturn (- <BottomSheet- open={open}- onClose={onClose}- onDismiss={onDismiss}- sheetStyle={styles.sheet}- >+ <BottomSheet open={open} onClose={onClose} onDismiss={onDismiss} sheetStyle={styles.sheet}><View style={styles.actionList}><ListItemicon={<QrCodeIcon size={15} />}diff --git a/apps/mobile/src/components/DeviceActionsSheet/index.tsx b/apps/mobile/src/components/DeviceActionsSheet/index.tsxindex b9c5a74..97af1d1 100644--- a/apps/mobile/src/components/DeviceActionsSheet/index.tsx+++ b/apps/mobile/src/components/DeviceActionsSheet/index.tsx@@ -15,11 +15,7 @@ export function DeviceActionsSheet({ open, onClose, onRemove, onRename }: Deviceconst { t } = useTranslation(['settings'])return (- <BottomSheet- open={open}- onClose={onClose}- sheetStyle={styles.sheet}- >+ <BottomSheet open={open} onClose={onClose} sheetStyle={styles.sheet}><View style={styles.actionList}><ListItemsize='large'diff --git a/apps/mobile/src/components/Layout/Layout.tsx b/apps/mobile/src/components/Layout/Layout.tsxindex 5b330a4..69aa7e9 100644--- a/apps/mobile/src/components/Layout/Layout.tsx+++ b/apps/mobile/src/components/Layout/Layout.tsx@@ -7,7 +7,7 @@ import { IconButton } from '@/src/components/IconButton'import { Text } from '@/src/components/ThemedText'interface LayoutProps {- title: string+ title?: stringdescription?: stringbadge?: React.ReactElementfooter?: React.ReactElement@@ -32,7 +32,9 @@ export const Layout = ({const { theme } = useTheme()const insets = useSafeAreaInsets()- const paddingTop = hasNativeHeader ? 8 : insets.top + 32+ const showHeader = Boolean(title || description || badge || onMenuPress)+ const nativeHeaderPaddingTop = showHeader ? 8 : 24+ const paddingTop = hasNativeHeader ? nativeHeaderPaddingTop : insets.top + 32const paddingBottom = Platform.OS === 'ios' ? insets.bottom + 8 : 28return (@@ -46,20 +48,26 @@ export const Layout = ({}]}>- <View style={[styles.header, compactHeader && styles.headerCompact]}>- {badge ? <View style={styles.badgeSlot}>{badge}</View> : null}- <View style={styles.titleRow}>- <Text style={[styles.title, { color: theme.colors.colorTextPrimary }]}>{title}</Text>- {onMenuPress ? (- <IconButton icon='settings' label={t('common:labels.settings')} onPress={onMenuPress} />+ {showHeader ? (+ <View style={[styles.header, compactHeader && styles.headerCompact]}>+ {badge ? <View style={styles.badgeSlot}>{badge}</View> : null}+ <View style={styles.titleRow}>+ <Text style={[styles.title, { color: theme.colors.colorTextPrimary }]}>{title}</Text>+ {onMenuPress ? (+ <IconButton+ icon='settings'+ label={t('common:labels.settings')}+ onPress={onMenuPress}+ />+ ) : null}+ </View>+ {description ? (+ <Text style={[styles.description, { color: theme.colors.colorTextSecondary }]}>+ {description}+ </Text>) : null}</View>- {description ? (- <Text style={[styles.description, { color: theme.colors.colorTextSecondary }]}>- {description}- </Text>- ) : null}- </View>+ ) : null}{noScroll ? (<View style={styles.scrollView}>{children}</View>