Video lesson with transport
import * as React from "react";
import { View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Image, Slider, Text, type IconName } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { GlowSpot, Mount } from "../shared";
export interface LessonPlayerScreenProps {
title?: string;
course?: string;
position?: number;
duration?: string;
onToggle?: () => void;
onBack?: () => void;
}
const CHAPTERS = [0, 22, 55, 82];
const CHAPTER_LABELS = ["Intro", "Tokens", "Scales", "Ship it"];
const RATES = ["1×", "1.25×", "1.5×", "2×"] as const;
/** Lesson player — dark frame, scrub bar, transport, next-up rail. */
export function LessonPlayerScreen({
title = "Design tokens, not hex codes",
course = "UI Polish",
position = 0.34,
duration = "12:40",
onToggle,
onBack,
}: LessonPlayerScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [playing, setPlaying] = React.useState(true);
const [pos, setPos] = React.useState(position);
const [rateIdx, setRateIdx] = React.useState(0);
const toggle = () => {
haptics.light();
setPlaying((p) => !p);
onToggle?.();
};
const control = (
name: IconName,
label: string,
onPress: () => void,
primary?: boolean,
) => (
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={onPress}
accessibilityLabel={label}
className={`items-center justify-center rounded-full ${
primary ? "h-16 w-16 bg-[#BEF04C]" : "h-11 w-11 bg-white/10 backdrop-blur-xl"
}`}
>
<Icon name={name} size={primary ? "lg" : "sm"} color={primary ? "#1B1B26" : "primaryForeground"} />
</Button>
);
return (
<SafeAreaView className="flex-1 bg-black" edges={["top"]}>
<GlowSpot color="#BEF04C" size={300} className="-top-20 right-[-80px] opacity-30" />
<GlowSpot color="#8B5CF6" size={220} className="bottom-[30%] left-[-100px] opacity-30" />
{/* Chrome — back + lesson title. */}
<View className="flex-row items-center gap-2 px-4 pb-1 pt-2">
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="-ml-2 h-10 w-10"
>
<Icon name="chevron-left" size="md" color="primaryForeground" />
</Button>
<Mount className="flex-1">
<Text variant="h4" className="text-primary-foreground" numberOfLines={1}>
{title}
</Text>
<Text className="text-xs text-primary-foreground/60">{course}</Text>
</Mount>
</View>
{/* Video frame — poster stands in for the stream. */}
<View className="mx-4 mt-2 h-52 items-center justify-center overflow-hidden rounded-xl bg-white/5">
<Mount delay={60}><Glass interactive effect="clear" className="absolute left-3 top-3 rounded-full px-2.5 py-1">
<Text className="text-[10px] font-medium text-white/90">
Lesson 3 of 8
</Text>
</Glass></Mount>
<Image
source={{
uri: "https://images.unsplash.com/photo-1587620962725-abab7fe55159?w=800&h=450&fit=crop&q=70&auto=format",
}}
className="absolute inset-0 h-full w-full"
accessibilityLabel="Lesson video"
/>
<Mount delay={120}>
<Glass interactive effect="clear" className="h-14 w-14 items-center justify-center rounded-full">
<Icon name="play" size="lg" color="primaryForeground" />
</Glass>
</Mount>
</View>
{/* Course position — the lesson lives inside a sequence. */}
<Text className="px-5 pt-3 text-center text-[10px] font-medium uppercase tracking-widest text-primary-foreground/40">
Lesson 3 of 12 · {Math.round(pos * 100)}% through
</Text>
{/* Transport — scrub + chapter markers + times + centered controls. */}
<View className="px-5 pt-4">
<Mount delay={180}>
<Slider
value={pos * 100}
onValueChange={(v) => setPos(v / 100)}
min={0}
max={100}
step={1}
accessibilityLabel="Seek"
/>
{CHAPTERS.slice(1).map((c) => (
<View
key={c}
className="absolute top-1/2 h-2 w-2 rounded-full bg-white/60"
style={{ left: `${c}%`, marginTop: -4 }}
pointerEvents="none"
/>
))}
</Mount>
<View className="flex-row items-center justify-between pt-1">
<Text className="text-xs text-primary-foreground/70">
{Math.floor((pos * 760) / 60)}:{String(Math.round((pos * 760) % 60)).padStart(2, "0")}
</Text>
<Text className="text-xs text-primary-foreground/70">{duration}</Text>
</View>
<View className="flex-row items-center justify-center gap-5 pt-3">
{control("skip-back", "Back 15s", () => haptics.light())}
{control(playing ? "pause" : "play", playing ? "Pause" : "Play", toggle, true)}
{control("skip-forward", "Forward 15s", () => haptics.light())}
</View>
{/* Utility row — speed, chapter name, save/download. */}
<View className="flex-row items-center justify-between pt-4">
<Text className="text-xs text-primary-foreground/60">
{CHAPTER_LABELS[CHAPTERS.reduce((acc, c, i) => (pos * 100 >= c ? i : acc), 0)] ?? "Intro"}
</Text>
<View className="flex-row items-center gap-1">
{(["bookmark", "download"] as const).map((n) => (
<Button
key={n}
variant="ghost"
size="icon"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={n === "bookmark" ? "Save lesson" : "Download"}
className="h-9 w-9"
>
<Icon name={n} size="sm" color="primaryForeground" />
</Button>
))}
<Button
variant="ghost"
haptic="light"
onPress={() => {
haptics.selection();
setRateIdx((i) => (i + 1) % RATES.length);
}}
accessibilityLabel={`Playback speed ${RATES[rateIdx]}`}
className="h-8 rounded-full bg-white/10 px-3 backdrop-blur-xl"
>
<Text className="text-xs font-semibold text-white">
{RATES[rateIdx]}
</Text>
</Button>
</View>
</View>
</View>
{/* Next up — keeps the course moving. */}
<View className="mt-5 px-4" style={{ paddingBottom: insets.bottom }}>
<Text className="text-xs font-medium uppercase text-primary-foreground/60">
Next up
</Text>
{[
{ title: "The icon discipline", length: "9:58" },
{ title: "Spacing that sells itself", length: "14:22" },
].map((l) => (
<Button
key={l.title}
variant="ghost"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={`Play ${l.title}`}
className="mt-2 flex-row items-center gap-3 rounded-2xl bg-white/10 p-3 backdrop-blur-xl"
>
<View className="h-12 w-12 items-center justify-center rounded-xl bg-white/15">
<Icon name="play" size="sm" color="primaryForeground" />
</View>
<View className="flex-1 items-start">
<Text
className="text-sm font-medium text-primary-foreground"
numberOfLines={1}
>
{l.title}
</Text>
<Text className="text-xs text-primary-foreground/60">
{l.length}
</Text>
</View>
<Icon name="chevron-right" size="sm" color="primaryForeground" />
</Button>
))}
</View>
</SafeAreaView>
);
}
LessonPlayerScreen.displayName = "LessonPlayerScreen";
Recreate the "Lesson Player Screen" screen in React Native using LumioUI.
Goal: Video lesson with transport 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-lesson-player
```
Or pull just the components: `npx lumioui add button glass icon image slider 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
### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×5
### `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>` ×6
### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×1
### `slider` — Draggable track with haptic ticks and precise thumb.
- `<Slider>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×11
## 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/lesson-player.tsx` exporting LessonPlayerScreen. 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 { View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Image, Slider, Text, type IconName } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { GlowSpot, Mount } from "../shared";
export interface LessonPlayerScreenProps {
title?: string;
course?: string;
position?: number;
duration?: string;
onToggle?: () => void;
onBack?: () => void;
}
const CHAPTERS = [0, 22, 55, 82];
const CHAPTER_LABELS = ["Intro", "Tokens", "Scales", "Ship it"];
const RATES = ["1×", "1.25×", "1.5×", "2×"] as const;
/** Lesson player — dark frame, scrub bar, transport, next-up rail. */
export function LessonPlayerScreen({
title = "Design tokens, not hex codes",
course = "UI Polish",
position = 0.34,
duration = "12:40",
onToggle,
onBack,
}: LessonPlayerScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [playing, setPlaying] = React.useState(true);
const [pos, setPos] = React.useState(position);
const [rateIdx, setRateIdx] = React.useState(0);
const toggle = () => {
haptics.light();
setPlaying((p) => !p);
onToggle?.();
};
const control = (
name: IconName,
label: string,
onPress: () => void,
primary?: boolean,
) => (
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={onPress}
accessibilityLabel={label}
className={`items-center justify-center rounded-full ${
primary ? "h-16 w-16 bg-[#BEF04C]" : "h-11 w-11 bg-white/10 backdrop-blur-xl"
}`}
>
<Icon name={name} size={primary ? "lg" : "sm"} color={primary ? "#1B1B26" : "primaryForeground"} />
</Button>
);
return (
<SafeAreaView className="flex-1 bg-black" edges={["top"]}>
<GlowSpot color="#BEF04C" size={300} className="-top-20 right-[-80px] opacity-30" />
<GlowSpot color="#8B5CF6" size={220} className="bottom-[30%] left-[-100px] opacity-30" />
{/* Chrome — back + lesson title. */}
<View className="flex-row items-center gap-2 px-4 pb-1 pt-2">
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="-ml-2 h-10 w-10"
>
<Icon name="chevron-left" size="md" color="primaryForeground" />
</Button>
<Mount className="flex-1">
<Text variant="h4" className="text-primary-foreground" numberOfLines={1}>
{title}
</Text>
<Text className="text-xs text-primary-foreground/60">{course}</Text>
</Mount>
</View>
{/* Video frame — poster stands in for the stream. */}
<View className="mx-4 mt-2 h-52 items-center justify-center overflow-hidden rounded-xl bg-white/5">
<Mount delay={60}><Glass interactive effect="clear" className="absolute left-3 top-3 rounded-full px-2.5 py-1">
<Text className="text-[10px] font-medium text-white/90">
Lesson 3 of 8
</Text>
</Glass></Mount>
<Image
source={{
uri: "https://images.unsplash.com/photo-1587620962725-abab7fe55159?w=800&h=450&fit=crop&q=70&auto=format",
}}
className="absolute inset-0 h-full w-full"
accessibilityLabel="Lesson video"
/>
<Mount delay={120}>
<Glass interactive effect="clear" className="h-14 w-14 items-center justify-center rounded-full">
<Icon name="play" size="lg" color="primaryForeground" />
</Glass>
</Mount>
</View>
{/* Course position — the lesson lives inside a sequence. */}
<Text className="px-5 pt-3 text-center text-[10px] font-medium uppercase tracking-widest text-primary-foreground/40">
Lesson 3 of 12 · {Math.round(pos * 100)}% through
</Text>
{/* Transport — scrub + chapter markers + times + centered controls. */}
<View className="px-5 pt-4">
<Mount delay={180}>
<Slider
value={pos * 100}
onValueChange={(v) => setPos(v / 100)}
min={0}
max={100}
step={1}
accessibilityLabel="Seek"
/>
{CHAPTERS.slice(1).map((c) => (
<View
key={c}
className="absolute top-1/2 h-2 w-2 rounded-full bg-white/60"
style={{ left: `${c}%`, marginTop: -4 }}
pointerEvents="none"
/>
))}
</Mount>
<View className="flex-row items-center justify-between pt-1">
<Text className="text-xs text-primary-foreground/70">
{Math.floor((pos * 760) / 60)}:{String(Math.round((pos * 760) % 60)).padStart(2, "0")}
</Text>
<Text className="text-xs text-primary-foreground/70">{duration}</Text>
</View>
<View className="flex-row items-center justify-center gap-5 pt-3">
{control("skip-back", "Back 15s", () => haptics.light())}
{control(playing ? "pause" : "play", playing ? "Pause" : "Play", toggle, true)}
{control("skip-forward", "Forward 15s", () => haptics.light())}
</View>
{/* Utility row — speed, chapter name, save/download. */}
<View className="flex-row items-center justify-between pt-4">
<Text className="text-xs text-primary-foreground/60">
{CHAPTER_LABELS[CHAPTERS.reduce((acc, c, i) => (pos * 100 >= c ? i : acc), 0)] ?? "Intro"}
</Text>
<View className="flex-row items-center gap-1">
{(["bookmark", "download"] as const).map((n) => (
<Button
key={n}
variant="ghost"
size="icon"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={n === "bookmark" ? "Save lesson" : "Download"}
className="h-9 w-9"
>
<Icon name={n} size="sm" color="primaryForeground" />
</Button>
))}
<Button
variant="ghost"
haptic="light"
onPress={() => {
haptics.selection();
setRateIdx((i) => (i + 1) % RATES.length);
}}
accessibilityLabel={`Playback speed ${RATES[rateIdx]}`}
className="h-8 rounded-full bg-white/10 px-3 backdrop-blur-xl"
>
<Text className="text-xs font-semibold text-white">
{RATES[rateIdx]}
</Text>
</Button>
</View>
</View>
</View>
{/* Next up — keeps the course moving. */}
<View className="mt-5 px-4" style={{ paddingBottom: insets.bottom }}>
<Text className="text-xs font-medium uppercase text-primary-foreground/60">
Next up
</Text>
{[
{ title: "The icon discipline", length: "9:58" },
{ title: "Spacing that sells itself", length: "14:22" },
].map((l) => (
<Button
key={l.title}
variant="ghost"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={`Play ${l.title}`}
className="mt-2 flex-row items-center gap-3 rounded-2xl bg-white/10 p-3 backdrop-blur-xl"
>
<View className="h-12 w-12 items-center justify-center rounded-xl bg-white/15">
<Icon name="play" size="sm" color="primaryForeground" />
</View>
<View className="flex-1 items-start">
<Text
className="text-sm font-medium text-primary-foreground"
numberOfLines={1}
>
{l.title}
</Text>
<Text className="text-xs text-primary-foreground/60">
{l.length}
</Text>
</View>
<Icon name="chevron-right" size="sm" color="primaryForeground" />
</Button>
))}
</View>
</SafeAreaView>
);
}
LessonPlayerScreen.displayName = "LessonPlayerScreen";
```
Screen: https://lumioui.dev/screens/misc-lesson-player