v0.1 public beta early access on GitHub
Home / Screens / misc-course-detail
Screen template

Course Detail Screen

Course cover + syllabus + enroll

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add misc-course-detail
import { CourseDetailScreen } from "@/screens/misc/course-detail";
Registry dependencies7
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
misc/course-detail.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 { Avatar, Button, Glass, Icon, Image, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Display, Mount, Press, SEPARATOR_INSET, StickyBottomBar, StoryScrim, World } from "../shared";

export interface Lesson {
  id: string;
  title: string;
  duration: string;
  free?: boolean;
}

export interface CourseDetailScreenProps {
  title?: string;
  instructor?: string;
  instructorAvatarUrl?: string;
  rating?: string;
  price?: string;
  coverUrl?: string;
  lessons?: Lesson[];
  onEnroll?: () => void;
  onLessonPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_LESSONS: Lesson[] = [
  { id: "l1", title: "Welcome + setup", duration: "6:12", free: true },
  { id: "l2", title: "Design tokens, not hex codes", duration: "12:40" },
  { id: "l3", title: "The icon discipline", duration: "9:58" },
  { id: "l4", title: "Spacing that sells itself", duration: "14:22" },
  { id: "l5", title: "Ship-check: contrast audit", duration: "8:45" },
];

/** Course detail — cover, rating, lesson list, enroll CTA. */
export function CourseDetailScreen({
  title = "UI Polish: From Good to Shipped",
  instructor = "Amara Chen",
  instructorAvatarUrl = "https://i.pravatar.cc/300?img=47",
  rating = "4.9 · 2,103 students",
  price = "$49",
  coverUrl = "https://images.unsplash.com/photo-1587620962725-abab7fe55159?w=800&h=450&fit=crop&q=70&auto=format",
  lessons = DEFAULT_LESSONS,
  onEnroll,
  onLessonPress,
  onBack,
}: CourseDetailScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 96 }}
      >
        {/* Cover — course artwork sells the course. */}
        <Mount className="relative mx-4 mt-1 overflow-hidden rounded-3xl">
          <Image
            source={{ uri: coverUrl }}
            className="h-48 w-full bg-muted"
            accessibilityLabel="Course cover"
          />
          <View className="absolute inset-x-0 bottom-0 h-14">
            <StoryScrim edge="bottom" />
          </View>
          <Glass interactive effect="clear" className="absolute bottom-2 right-2 rounded-full px-2 py-0.5">
            <Text className="text-[10px] font-semibold text-white">
              {lessons.length} lessons
            </Text>
          </Glass>
        </Mount>

        {/* Title + instructor + rating. */}
        <Mount delay={60} className="gap-2 px-4 pt-3">
          <Display className="text-3xl">{title}</Display>
          <View className="flex-row items-center gap-2.5">
            <Avatar
              size="sm"
              source={{ uri: instructorAvatarUrl }}
              fallback={instructor}
              alt={instructor}
            />
            <Text className="text-sm font-medium">{instructor}</Text>
          </View>
          <View className="flex-row items-center gap-1.5">
            <Icon name="star" size="sm" color="warning" />
            <Text className="text-sm">{rating}</Text>
          </View>
          {/* Outcome promise — courses sell the after, not the syllabus. */}
          <View className="flex-row items-center gap-1.5 pt-0.5">
            <Icon name="trophy" size="sm" color="primary" />
            <Text variant="muted" className="text-xs">
              Certificate included · intermediate friendly
            </Text>
          </View>
        </Mount>

        {/* Lessons — numbered syllabus. */}
        <Mount delay={120} className="px-4 pt-4">
          <Text variant="h4">Lessons</Text>
        </Mount>
        <Mount delay={180} className="mx-4 mt-3 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
          {lessons.map((l, i) => (
            <React.Fragment key={l.id}>
              {i > 0 && <List.Separator className={SEPARATOR_INSET} />}
              <List.Item
                title={l.title}
                subtitle={l.duration}
                leading={
                  <Text className="w-6 text-sm font-semibold text-muted-foreground">
                    {i + 1}
                  </Text>
                }
                trailing={
                  l.free ? (
                    <View className="rounded-full bg-success/15 px-2 py-0.5">
                      <Text className="text-[10px] font-semibold text-success">
                        Preview
                      </Text>
                    </View>
                  ) : (
                    <Icon name="lock" size="sm" color="mutedForeground" />
                  )
                }
                haptic="light"
                onPress={() => l.free && onLessonPress?.(l.id)}
                className="py-3"
              />
            </React.Fragment>
          ))}
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
        <Button
          tone="inverse"
          haptic="light"
          onPress={() => {
            haptics.medium();
            onEnroll?.();
          }}
          accessibilityLabel={`Enroll for ${price} — full access`}
          className="h-12 w-full bg-[#1B1B26]"
        >
          <Text className="text-[15px] font-semibold text-[#F5F7F5]">
            Enroll now · <Text className="font-bold text-[#F5F7F5]">{price}</Text>
            <Text className="text-[12px] font-medium text-[#F5F7F5]/60"> · full access</Text>
          </Text>
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
CourseDetailScreen.displayName = "CourseDetailScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Course Detail Screen" screen in React Native using LumioUI.

Goal: Course cover + syllabus + enroll 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 misc-course-detail
```

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

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- 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

### `avatar` — Circular user image with fallback initials and status dot.
- `<Avatar>` ×1

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×1

### `glass` — iOS 26 liquid-glass surface — real glass via expo-glass-effect (Expo Go) or @callstack/liquid-glass (dev builds), SVG refraction + specular rim on web, frosted fallback elsewhere; GlassContainer melts adjacent panes into one blob
- `<Glass>` ×2

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×4

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

### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility

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

## 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/misc/course-detail.tsx` exporting CourseDetailScreen. 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 { Avatar, Button, Glass, Icon, Image, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Display, Mount, Press, SEPARATOR_INSET, StickyBottomBar, StoryScrim, World } from "../shared";

export interface Lesson {
  id: string;
  title: string;
  duration: string;
  free?: boolean;
}

export interface CourseDetailScreenProps {
  title?: string;
  instructor?: string;
  instructorAvatarUrl?: string;
  rating?: string;
  price?: string;
  coverUrl?: string;
  lessons?: Lesson[];
  onEnroll?: () => void;
  onLessonPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_LESSONS: Lesson[] = [
  { id: "l1", title: "Welcome + setup", duration: "6:12", free: true },
  { id: "l2", title: "Design tokens, not hex codes", duration: "12:40" },
  { id: "l3", title: "The icon discipline", duration: "9:58" },
  { id: "l4", title: "Spacing that sells itself", duration: "14:22" },
  { id: "l5", title: "Ship-check: contrast audit", duration: "8:45" },
];

/** Course detail — cover, rating, lesson list, enroll CTA. */
export function CourseDetailScreen({
  title = "UI Polish: From Good to Shipped",
  instructor = "Amara Chen",
  instructorAvatarUrl = "https://i.pravatar.cc/300?img=47",
  rating = "4.9 · 2,103 students",
  price = "$49",
  coverUrl = "https://images.unsplash.com/photo-1587620962725-abab7fe55159?w=800&h=450&fit=crop&q=70&auto=format",
  lessons = DEFAULT_LESSONS,
  onEnroll,
  onLessonPress,
  onBack,
}: CourseDetailScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 96 }}
      >
        {/* Cover — course artwork sells the course. */}
        <Mount className="relative mx-4 mt-1 overflow-hidden rounded-3xl">
          <Image
            source={{ uri: coverUrl }}
            className="h-48 w-full bg-muted"
            accessibilityLabel="Course cover"
          />
          <View className="absolute inset-x-0 bottom-0 h-14">
            <StoryScrim edge="bottom" />
          </View>
          <Glass interactive effect="clear" className="absolute bottom-2 right-2 rounded-full px-2 py-0.5">
            <Text className="text-[10px] font-semibold text-white">
              {lessons.length} lessons
            </Text>
          </Glass>
        </Mount>

        {/* Title + instructor + rating. */}
        <Mount delay={60} className="gap-2 px-4 pt-3">
          <Display className="text-3xl">{title}</Display>
          <View className="flex-row items-center gap-2.5">
            <Avatar
              size="sm"
              source={{ uri: instructorAvatarUrl }}
              fallback={instructor}
              alt={instructor}
            />
            <Text className="text-sm font-medium">{instructor}</Text>
          </View>
          <View className="flex-row items-center gap-1.5">
            <Icon name="star" size="sm" color="warning" />
            <Text className="text-sm">{rating}</Text>
          </View>
          {/* Outcome promise — courses sell the after, not the syllabus. */}
          <View className="flex-row items-center gap-1.5 pt-0.5">
            <Icon name="trophy" size="sm" color="primary" />
            <Text variant="muted" className="text-xs">
              Certificate included · intermediate friendly
            </Text>
          </View>
        </Mount>

        {/* Lessons — numbered syllabus. */}
        <Mount delay={120} className="px-4 pt-4">
          <Text variant="h4">Lessons</Text>
        </Mount>
        <Mount delay={180} className="mx-4 mt-3 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
          {lessons.map((l, i) => (
            <React.Fragment key={l.id}>
              {i > 0 && <List.Separator className={SEPARATOR_INSET} />}
              <List.Item
                title={l.title}
                subtitle={l.duration}
                leading={
                  <Text className="w-6 text-sm font-semibold text-muted-foreground">
                    {i + 1}
                  </Text>
                }
                trailing={
                  l.free ? (
                    <View className="rounded-full bg-success/15 px-2 py-0.5">
                      <Text className="text-[10px] font-semibold text-success">
                        Preview
                      </Text>
                    </View>
                  ) : (
                    <Icon name="lock" size="sm" color="mutedForeground" />
                  )
                }
                haptic="light"
                onPress={() => l.free && onLessonPress?.(l.id)}
                className="py-3"
              />
            </React.Fragment>
          ))}
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
        <Button
          tone="inverse"
          haptic="light"
          onPress={() => {
            haptics.medium();
            onEnroll?.();
          }}
          accessibilityLabel={`Enroll for ${price} — full access`}
          className="h-12 w-full bg-[#1B1B26]"
        >
          <Text className="text-[15px] font-semibold text-[#F5F7F5]">
            Enroll now · <Text className="font-bold text-[#F5F7F5]">{price}</Text>
            <Text className="text-[12px] font-medium text-[#F5F7F5]/60"> · full access</Text>
          </Text>
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
CourseDetailScreen.displayName = "CourseDetailScreen";
```

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