v0.1 public beta early access on GitHub
Home / Screens / media-gallery-albums
Screen template

Gallery Albums Screen

Smart albums and user album grid

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add media-gallery-albums
import { GalleryAlbumsScreen } from "@/screens/media/gallery-albums";
Registry dependencies5
Native packages installed6
@lumioui/ui@latestreact-native-safe-area-context@*@lumioui/core@latestreact-native-reanimated@*react-native-svg@*nativewind@*
media/gallery-albums.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Image, List, Text } from "@lumioui/ui";
import { Mount, Press, SEPARATOR_INSET, World } from "../shared";

export interface Album {
  id: string;
  name: string;
  count: number;
  coverUrl?: string;
}

export interface GalleryAlbumsScreenProps {
  /** Smart albums (Favorites, Videos, Screenshots…) — list rows. */
  smart?: Album[];
  /** User albums — 2-col cover grid. */
  albums?: Album[];
  onAlbumPress?: (id: string) => void;
}

const pic = (id: string) =>
  `https://images.unsplash.com/photo-${id}?w=400&h=400&fit=crop&q=60&auto=format`;

const DEFAULT_SMART: Album[] = [
  { id: "recents", name: "Recents", count: 1284, coverUrl: pic("1544441893-675973e31985") },
  { id: "favorites", name: "Favorites", count: 96, coverUrl: pic("1469334031218-e382a71b716b") },
  { id: "videos", name: "Videos", count: 43, coverUrl: pic("1509631179647-0177331693ae") },
  { id: "screenshots", name: "Screenshots", count: 218, coverUrl: pic("1551288049-bebda4e38f71") },
];

const DEFAULT_ALBUMS: Album[] = [
  { id: "a1", name: "Lisbon trip", count: 340, coverUrl: pic("1555881400-74d7acaacd8b") },
  { id: "a2", name: "Orbit shoot", count: 87, coverUrl: pic("1446776811953-b23d57bd21aa") },
  { id: "a3", name: "Home studio", count: 52, coverUrl: pic("1516035069371-29a1b244cc32") },
  { id: "a4", name: "Family", count: 190, coverUrl: pic("1544005313-94ddf0286df2") },
];

/** Gallery albums — smart albums list + user albums grid. */
export function GalleryAlbumsScreen({
  smart = DEFAULT_SMART,
  albums = DEFAULT_ALBUMS,
  onAlbumPress,
}: GalleryAlbumsScreenProps) {
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View className="px-4 pb-2 pt-2">
        <Text variant="h2" accessibilityRole="header">
          Albums
        </Text>
        {/* Library size — Photos apps lead with the archive count. */}
        <Text variant="muted" className="pt-0.5 text-xs">
          {albums.reduce((s, a) => s + a.count, 0).toLocaleString()} items
        </Text>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        <List inset>
          <List.Section>
            {smart.map((a, ii) => (
              <React.Fragment key={a.id}>
                {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                <List.Item
                  title={a.name}
                  subtitle={`${a.count.toLocaleString()} items`}
                  leading={
                    <Image
                      source={{ uri: a.coverUrl }}
                      className="h-11 w-11 rounded-xl bg-muted"
                      accessibilityLabel={`${a.name} cover`}
                    />
                  }
                  showChevron
                  haptic="light"
                  onPress={() => onAlbumPress?.(a.id)}
                  className="py-2.5"
                />
              </React.Fragment>
            ))}
          </List.Section>
        </List>

        <Mount className="mt-4 px-4">
          <Text variant="small" className="pb-2 text-muted-foreground">
            My Albums
          </Text>
          <View className="flex-row flex-wrap justify-between gap-y-4">
            {albums.map((a) => (
              <Press
                key={a.id}
                haptic="light"
                onPress={() => onAlbumPress?.(a.id)}
                accessibilityLabel={`${a.name}, ${a.count} items`}
                className="w-[48%] items-start px-0 py-0"
              >
                <View className="w-full gap-1">
                  <Image
                    source={{ uri: a.coverUrl }}
                    className="aspect-square w-full rounded-3xl bg-muted"
                    accessibilityLabel={`${a.name} cover`}
                  />
                  <Text className="text-sm font-medium" numberOfLines={1}>
                    {a.name}
                  </Text>
                  <Text variant="small" className="text-muted-foreground">
                    {a.count}
                  </Text>
                </View>
              </Press>
            ))}
          </View>
        </Mount>
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
GalleryAlbumsScreen.displayName = "GalleryAlbumsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Gallery Albums Screen" screen in React Native using LumioUI.

Goal: Smart albums and user album grid Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add media-gallery-albums
```

Or pull just the components: `npx lumioui add button icon image list text`

Native packages:
- @lumioui/ui@latest
- react-native-safe-area-context@*
- @lumioui/core@latest
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `button` — Tactile pill button with press spring, ink wash and async loading.
- imported but not rendered directly — likely used through a sibling or as a utility

### `icon` — Lucide icon set mapped to theme colors and sizes.
- imported but not rendered directly — likely used through a sibling or as a utility

### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×2

### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1

### `text` — Themed type scale from caption to display.
- `<Text>` ×5

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/media/gallery-albums.tsx` exporting GalleryAlbumsScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Image, List, Text } from "@lumioui/ui";
import { Mount, Press, SEPARATOR_INSET, World } from "../shared";

export interface Album {
  id: string;
  name: string;
  count: number;
  coverUrl?: string;
}

export interface GalleryAlbumsScreenProps {
  /** Smart albums (Favorites, Videos, Screenshots…) — list rows. */
  smart?: Album[];
  /** User albums — 2-col cover grid. */
  albums?: Album[];
  onAlbumPress?: (id: string) => void;
}

const pic = (id: string) =>
  `https://images.unsplash.com/photo-${id}?w=400&h=400&fit=crop&q=60&auto=format`;

const DEFAULT_SMART: Album[] = [
  { id: "recents", name: "Recents", count: 1284, coverUrl: pic("1544441893-675973e31985") },
  { id: "favorites", name: "Favorites", count: 96, coverUrl: pic("1469334031218-e382a71b716b") },
  { id: "videos", name: "Videos", count: 43, coverUrl: pic("1509631179647-0177331693ae") },
  { id: "screenshots", name: "Screenshots", count: 218, coverUrl: pic("1551288049-bebda4e38f71") },
];

const DEFAULT_ALBUMS: Album[] = [
  { id: "a1", name: "Lisbon trip", count: 340, coverUrl: pic("1555881400-74d7acaacd8b") },
  { id: "a2", name: "Orbit shoot", count: 87, coverUrl: pic("1446776811953-b23d57bd21aa") },
  { id: "a3", name: "Home studio", count: 52, coverUrl: pic("1516035069371-29a1b244cc32") },
  { id: "a4", name: "Family", count: 190, coverUrl: pic("1544005313-94ddf0286df2") },
];

/** Gallery albums — smart albums list + user albums grid. */
export function GalleryAlbumsScreen({
  smart = DEFAULT_SMART,
  albums = DEFAULT_ALBUMS,
  onAlbumPress,
}: GalleryAlbumsScreenProps) {
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View className="px-4 pb-2 pt-2">
        <Text variant="h2" accessibilityRole="header">
          Albums
        </Text>
        {/* Library size — Photos apps lead with the archive count. */}
        <Text variant="muted" className="pt-0.5 text-xs">
          {albums.reduce((s, a) => s + a.count, 0).toLocaleString()} items
        </Text>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        <List inset>
          <List.Section>
            {smart.map((a, ii) => (
              <React.Fragment key={a.id}>
                {ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
                <List.Item
                  title={a.name}
                  subtitle={`${a.count.toLocaleString()} items`}
                  leading={
                    <Image
                      source={{ uri: a.coverUrl }}
                      className="h-11 w-11 rounded-xl bg-muted"
                      accessibilityLabel={`${a.name} cover`}
                    />
                  }
                  showChevron
                  haptic="light"
                  onPress={() => onAlbumPress?.(a.id)}
                  className="py-2.5"
                />
              </React.Fragment>
            ))}
          </List.Section>
        </List>

        <Mount className="mt-4 px-4">
          <Text variant="small" className="pb-2 text-muted-foreground">
            My Albums
          </Text>
          <View className="flex-row flex-wrap justify-between gap-y-4">
            {albums.map((a) => (
              <Press
                key={a.id}
                haptic="light"
                onPress={() => onAlbumPress?.(a.id)}
                accessibilityLabel={`${a.name}, ${a.count} items`}
                className="w-[48%] items-start px-0 py-0"
              >
                <View className="w-full gap-1">
                  <Image
                    source={{ uri: a.coverUrl }}
                    className="aspect-square w-full rounded-3xl bg-muted"
                    accessibilityLabel={`${a.name} cover`}
                  />
                  <Text className="text-sm font-medium" numberOfLines={1}>
                    {a.name}
                  </Text>
                  <Text variant="small" className="text-muted-foreground">
                    {a.count}
                  </Text>
                </View>
              </Press>
            ))}
          </View>
        </Mount>
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
GalleryAlbumsScreen.displayName = "GalleryAlbumsScreen";
```

Screen: https://lumioui.dev/screens/media-gallery-albums
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗