Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import { Text } from "@/app/components/ui";
export function Screen({
title,
subtitle,
headerLeft,
headerRight,
children,
scrollableHeader,
}: {
title?: string;
subtitle?: string;
headerLeft?: React.ReactNode;
headerRight?: React.ReactNode;
children: React.ReactNode;
/** When true, the header is part of the scroll content (caller handles it). */
Expand All @@ -25,7 +27,10 @@ export function Screen({
return (
<View className="flex-1 bg-background" style={{ paddingTop: insets.top }}>
{title && !scrollableHeader ? (
<View className="flex-row items-end justify-between border-b border-border px-4 pb-3 pt-3">
<View className="flex-row items-center justify-between border-b border-border px-4 pb-3 pt-3">
{headerLeft ? (
<View className="mr-3 shrink-0">{headerLeft}</View>
) : null}
<View className="min-w-0 flex-1">
<Text weight="bold" className="text-xl text-foreground">
{title}
Expand Down
13 changes: 13 additions & 0 deletions app/tabs/settings/Snippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState, useEffect, useCallback } from "react";
import { View, ScrollView, Pressable, RefreshControl } from "react-native";
import * as Clipboard from "expo-clipboard";
import {
ArrowLeft,
ChevronRight,
Copy,
FolderOpen,
Expand All @@ -10,6 +11,7 @@ import {
Trash2,
Check,
} from "lucide-react-native";
import { useRouter } from "expo-router";
import {
getSnippets,
getSnippetFolders,
Expand All @@ -34,6 +36,7 @@ type SnippetFormData = {

export default function Snippets() {
const color = useThemeColor();
const router = useRouter();

const [snippets, setSnippets] = useState<Snippet[]>([]);
const [folders, setFolders] = useState<SnippetFolder[]>([]);
Expand Down Expand Up @@ -321,6 +324,16 @@ export default function Snippets() {
return (
<Screen
title="Snippets"
headerLeft={
<Pressable
onPress={() => router.back()}
accessibilityRole="button"
accessibilityLabel="Back"
hitSlop={8}
>
<ArrowLeft size={20} color={color("foreground")} />
</Pressable>
}
headerRight={
<View className="flex-row gap-2">
<Button
Expand Down
Loading