v0.1 public beta early access on GitHub
Home / Screens / ecommerce-product-reviews
Screen template

Product Reviews Screen

Review hub — average rating with per-star breakdown bars, sort chips, verified-purchase cards with helpful toggles, and a pinned 'Write a review' bar

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · medium · selection
$ npx lumioui add ecommerce-product-reviews
import { ProductReviewsScreen } from "@/screens/ecommerce/product-reviews";
Registry dependencies7
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
ecommerce/product-reviews.tsxsource · yours to edit
import * as React from "react";
import { useMemo, useState } from "react";
import { View, ScrollView, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, Card, Chip, Glass, Icon, Progress, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, LumioMark, Mount, Press, ROW_STAGGER, ROW_STAGGER_CAP, StickyBottomBar, World } from "../shared";

export interface ReviewItem {
  id: string;
  author: string;
  rating: number;
  date: string;
  text: string;
  avatarUrl?: string;
  /** Shows the "Verified purchase" tick. Default true. */
  verified?: boolean;
  helpfulCount?: number;
}

export interface RatingBreakdown {
  /** Star level (5 … 1). */
  stars: number;
  count: number;
}

export interface ProductReviewsScreenProps {
  productName?: string;
  rating?: number;
  reviewCount?: number;
  /** Bar breakdown — one entry per star level, any order. */
  distribution?: RatingBreakdown[];
  reviews?: ReviewItem[];
  onSortChange?: (sort: "recent" | "highest" | "lowest") => void;
  onHelpful?: (review: ReviewItem) => void;
  onWriteReview?: () => void;
  onBack?: () => void;
}

const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;

// 194·5 + 13·4 + 4·3 + 2·2 + 1·1 = 1039 → 1039/214 = 4.86 → displays 4.9.
const DEFAULT_DISTRIBUTION: RatingBreakdown[] = [
  { stars: 5, count: 194 },
  { stars: 4, count: 13 },
  { stars: 3, count: 4 },
  { stars: 2, count: 2 },
  { stars: 1, count: 1 },
];

const DEFAULT_REVIEWS: ReviewItem[] = [
  {
    id: "r1",
    author: "Priya N.",
    rating: 5,
    date: "Sep 2, 2026",
    text: "Beautifully made — the drape is perfect and it layers over knitwear without pulling. Runs true to size.",
    avatarUrl: face(5),
    helpfulCount: 24,
  },
  {
    id: "r2",
    author: "Tom R.",
    rating: 5,
    date: "Aug 28, 2026",
    text: "The cupro lining is the detail that sells it — slides over a hoodie without a fight. Camel reads richer in person.",
    avatarUrl: face(12),
    helpfulCount: 18,
  },
  {
    id: "r3",
    author: "Maya C.",
    rating: 4,
    date: "Aug 19, 2026",
    text: "Gorgeous coat, but the sleeves run a touch long on me — had them taken in an inch. Otherwise flawless.",
    avatarUrl: face(38),
    helpfulCount: 9,
  },
  {
    id: "r4",
    author: "Daniel O.",
    rating: 5,
    date: "Aug 3, 2026",
    text: "Wore it through a rainy Copenhagen week — the wool shrugged off drizzle and still looks pressed.",
    avatarUrl: face(59),
    helpfulCount: 14,
  },
  {
    id: "r5",
    author: "Jonas B.",
    rating: 3,
    date: "Jul 22, 2026",
    text: "Cut is boxier than the photos suggest. Quality is there; sizing down would have been smarter.",
    avatarUrl: face(60),
    helpfulCount: 6,
  },
];

const SORTS = [
  { id: "recent", label: "Most recent" },
  { id: "highest", label: "Highest" },
  { id: "lowest", label: "Lowest" },
] as const;

type SortId = (typeof SORTS)[number]["id"];

/** Five-star row — matches the product-detail treatment exactly. */
function Stars({ rating, size = "sm" }: { rating: number; size?: "sm" | "md" }) {
  return (
    <View
      className="flex-row items-center gap-0.5"
      accessibilityElementsHidden
      importantForAccessibility="no"
    >
      {[0, 1, 2, 3, 4].map((i) => (
        <Icon
          key={i}
          name="star"
          size={size}
          color={i < Math.round(rating) ? "warning" : "mutedForeground"}
          filled={i < Math.round(rating)}
        />
      ))}
    </View>
  );
}
Stars.displayName = "Stars";

function ReviewCard({
  review,
  helpful,
  onHelpful,
}: {
  review: ReviewItem;
  helpful: boolean;
  onHelpful?: (review: ReviewItem) => void;
}) {
  const haptics = useHaptic();
  const count = (review.helpfulCount ?? 0) + (helpful ? 1 : 0);
  return (
    <View className="gap-2 rounded-3xl bg-white p-5 dark:bg-[#1A1A20]">
      <View className="flex-row items-center gap-3">
        <Avatar
          size="sm"
          source={review.avatarUrl ? { uri: review.avatarUrl } : undefined}
          fallback={review.author.slice(0, 1)}
          alt={`${review.author} avatar`}
        />
        <View className="flex-1">
          <Text variant="small">{review.author}</Text>
          <Text variant="muted" className="text-xs tabular-nums">
            {review.date}
          </Text>
        </View>
        <Stars rating={review.rating} />
      </View>
      <Text variant="muted" className="leading-5">
        {review.text}
      </Text>
      <View className="flex-row items-center justify-between pt-0.5">
        {review.verified !== false ? (
          <View className="flex-row items-center gap-1.5">
            <Icon name="check-circle" size="sm" color="success" />
            <Text variant="muted" className="text-xs">
              Verified purchase
            </Text>
          </View>
        ) : (
          <View />
        )}
        {/* Helpful is a toggle — tinted pill once marked. */}
        <Pressable
          onPress={() => {
            haptics.selection();
            onHelpful?.(review);
          }}
          accessibilityRole="button"
          accessibilityLabel={
            helpful
              ? `Marked helpful, ${count} total`
              : `Mark ${review.author}'s review as helpful`
          }
          accessibilityState={{ selected: helpful }}
          hitSlop={8}
          className={cn(
            "min-h-8 flex-row items-center gap-1.5 rounded-full px-3",
            helpful ? "bg-[#EDF8C4] dark:bg-[#1E2410]" : "bg-transparent"
          )}
        >
          <Icon
            name="check"
            size="sm"
            color={helpful ? "primary" : "mutedForeground"}
          />
          <Text
            variant="small"
            className={cn("tabular-nums", helpful ? "font-semibold text-[#65A30D]" : "text-muted-foreground")}
          >
            Helpful{count > 0 ? ` (${count})` : ""}
          </Text>
        </Pressable>
      </View>
    </View>
  );
}
ReviewCard.displayName = "ReviewCard";

/** Product reviews — rating summary with per-star bars, sort chips, review
 *  cards with verified/helpful rows, and a pinned "Write a review" CTA. */
export function ProductReviewsScreen({
  productName = "Structured Wool Overcoat",
  rating = 4.9,
  reviewCount = 214,
  distribution = DEFAULT_DISTRIBUTION,
  reviews = DEFAULT_REVIEWS,
  onSortChange,
  onHelpful,
  onWriteReview,
  onBack,
}: ProductReviewsScreenProps) {
  const insets = useSafeAreaInsets();
  const [sort, setSort] = useState<SortId>("recent");
  const [helpfulIds, setHelpfulIds] = useState<Set<string>>(new Set());

  const sorted = useMemo(() => {
    if (sort === "highest") return [...reviews].sort((a, b) => b.rating - a.rating);
    if (sort === "lowest") return [...reviews].sort((a, b) => a.rating - b.rating);
    return reviews;
  }, [reviews, sort]);

  const markHelpful = (review: ReviewItem) => {
    setHelpfulIds((prev) => {
      const next = new Set(prev);
      if (next.has(review.id)) next.delete(review.id);
      else next.add(review.id);
      return next;
    });
    onHelpful?.(review);
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered title pill. */}
      <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 pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Reviews
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 96 }}
      >
        {/* Summary — big average + stars left, per-star bars right. */}
        <Mount className="px-6">
          <Card variant="elevated" className="rounded-3xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="flex-row items-center gap-5 p-5">
              <View
                className="items-center gap-1.5"
                accessibilityLabel={`Average rating ${rating} out of 5 from ${reviewCount} reviews`}
              >
                <Text variant="h2" className="tabular-nums">
                  {rating.toFixed(1)}
                </Text>
                <Stars rating={rating} />
                <Text variant="muted" className="text-xs tabular-nums">
                  {reviewCount.toLocaleString()} reviews
                </Text>
                {/* Recommend share — the number buyers actually scan for. */}
                <View className="mt-1 rounded-full bg-success/15 px-2 py-0.5">
                  <Text className="text-[11px] font-semibold text-success">
                    {Math.round((distribution[0] ? distribution[0].count : 0) / Math.max(1, reviewCount) * 100)}% recommend
                  </Text>
                </View>
              </View>
              <View className="flex-1 gap-1.5">
                {distribution.map((d) => (
                  <View
                    key={d.stars}
                    className="flex-row items-center gap-2"
                    accessibilityLabel={`${d.stars} stars, ${d.count} reviews`}
                  >
                    <Text variant="muted" className="w-3 text-right text-xs tabular-nums">
                      {d.stars}
                    </Text>
                    <View className="flex-1">
                      <Progress
                        value={reviewCount > 0 ? (d.count / reviewCount) * 100 : 0}
                      />
                    </View>
                    <Text variant="muted" className="w-8 text-right text-xs tabular-nums">
                      {d.count}
                    </Text>
                  </View>
                ))}
              </View>
            </Card.Content>
          </Card>
        </Mount>

        {/* Sort chips — single-select filter row. Chip fires its own
            selection haptic internally. */}
        <Mount delay={BLOCK_STAGGER} className="px-6 pt-5">
          <View className="flex-row gap-2">
            {SORTS.map((s) => (
              <Chip
                key={s.id}
                variant="filter"
                selected={sort === s.id}
                onPress={() => {
                  setSort(s.id);
                  onSortChange?.(s.id);
                }}
                accessibilityLabel={`Sort by ${s.label}`}
                className="h-9 px-4"
              >
                {s.label}
              </Chip>
            ))}
          </View>
        </Mount>

        {/* Review cards */}
        <View className="gap-5 px-6 pt-5">
          {sorted.map((review, i) => (
            <Mount
              key={review.id}
              delay={BLOCK_STAGGER * 2 + Math.min(i * ROW_STAGGER, ROW_STAGGER_CAP)}
            >
              <ReviewCard
                review={review}
                helpful={helpfulIds.has(review.id)}
                onHelpful={markHelpful}
              />
            </Mount>
          ))}
        </View>
      </ScrollView>

      <StickyBottomBar>
        <Button
            tone="inverse"
          size="lg"
          className="bg-[#1B1B26]"
          haptic="medium"
          icon={<Icon name="edit" size="sm" color="#FFFFFF" />}
          onPress={onWriteReview}
          accessibilityLabel="Write a review"
        >
          Write a review
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
ProductReviewsScreen.displayName = "ProductReviewsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Product Reviews Screen" screen in React Native using LumioUI.

Goal: Review hub — average rating with per-star breakdown bars, sort chips, verified-purchase cards with helpful toggles, and a pinned 'Write a review' bar 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 ecommerce-product-reviews
```

Or pull just the components: `npx lumioui add avatar button card chip icon progress 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

### `card` — Compound surface — header, title, content and footer slots.
- `<Card>` ×1

### `chip` — Compact selectable pill with press scale and ink overlay.
- `<Chip>` ×1

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

### `progress` — Animated fill bar with indeterminate sweep mode.
- `<Progress>` ×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/ecommerce/product-reviews.tsx` exporting ProductReviewsScreen. 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 { useMemo, useState } from "react";
import { View, ScrollView, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, Card, Chip, Glass, Icon, Progress, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, LumioMark, Mount, Press, ROW_STAGGER, ROW_STAGGER_CAP, StickyBottomBar, World } from "../shared";

export interface ReviewItem {
  id: string;
  author: string;
  rating: number;
  date: string;
  text: string;
  avatarUrl?: string;
  /** Shows the "Verified purchase" tick. Default true. */
  verified?: boolean;
  helpfulCount?: number;
}

export interface RatingBreakdown {
  /** Star level (5 … 1). */
  stars: number;
  count: number;
}

export interface ProductReviewsScreenProps {
  productName?: string;
  rating?: number;
  reviewCount?: number;
  /** Bar breakdown — one entry per star level, any order. */
  distribution?: RatingBreakdown[];
  reviews?: ReviewItem[];
  onSortChange?: (sort: "recent" | "highest" | "lowest") => void;
  onHelpful?: (review: ReviewItem) => void;
  onWriteReview?: () => void;
  onBack?: () => void;
}

const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;

// 194·5 + 13·4 + 4·3 + 2·2 + 1·1 = 1039 → 1039/214 = 4.86 → displays 4.9.
const DEFAULT_DISTRIBUTION: RatingBreakdown[] = [
  { stars: 5, count: 194 },
  { stars: 4, count: 13 },
  { stars: 3, count: 4 },
  { stars: 2, count: 2 },
  { stars: 1, count: 1 },
];

const DEFAULT_REVIEWS: ReviewItem[] = [
  {
    id: "r1",
    author: "Priya N.",
    rating: 5,
    date: "Sep 2, 2026",
    text: "Beautifully made — the drape is perfect and it layers over knitwear without pulling. Runs true to size.",
    avatarUrl: face(5),
    helpfulCount: 24,
  },
  {
    id: "r2",
    author: "Tom R.",
    rating: 5,
    date: "Aug 28, 2026",
    text: "The cupro lining is the detail that sells it — slides over a hoodie without a fight. Camel reads richer in person.",
    avatarUrl: face(12),
    helpfulCount: 18,
  },
  {
    id: "r3",
    author: "Maya C.",
    rating: 4,
    date: "Aug 19, 2026",
    text: "Gorgeous coat, but the sleeves run a touch long on me — had them taken in an inch. Otherwise flawless.",
    avatarUrl: face(38),
    helpfulCount: 9,
  },
  {
    id: "r4",
    author: "Daniel O.",
    rating: 5,
    date: "Aug 3, 2026",
    text: "Wore it through a rainy Copenhagen week — the wool shrugged off drizzle and still looks pressed.",
    avatarUrl: face(59),
    helpfulCount: 14,
  },
  {
    id: "r5",
    author: "Jonas B.",
    rating: 3,
    date: "Jul 22, 2026",
    text: "Cut is boxier than the photos suggest. Quality is there; sizing down would have been smarter.",
    avatarUrl: face(60),
    helpfulCount: 6,
  },
];

const SORTS = [
  { id: "recent", label: "Most recent" },
  { id: "highest", label: "Highest" },
  { id: "lowest", label: "Lowest" },
] as const;

type SortId = (typeof SORTS)[number]["id"];

/** Five-star row — matches the product-detail treatment exactly. */
function Stars({ rating, size = "sm" }: { rating: number; size?: "sm" | "md" }) {
  return (
    <View
      className="flex-row items-center gap-0.5"
      accessibilityElementsHidden
      importantForAccessibility="no"
    >
      {[0, 1, 2, 3, 4].map((i) => (
        <Icon
          key={i}
          name="star"
          size={size}
          color={i < Math.round(rating) ? "warning" : "mutedForeground"}
          filled={i < Math.round(rating)}
        />
      ))}
    </View>
  );
}
Stars.displayName = "Stars";

function ReviewCard({
  review,
  helpful,
  onHelpful,
}: {
  review: ReviewItem;
  helpful: boolean;
  onHelpful?: (review: ReviewItem) => void;
}) {
  const haptics = useHaptic();
  const count = (review.helpfulCount ?? 0) + (helpful ? 1 : 0);
  return (
    <View className="gap-2 rounded-3xl bg-white p-5 dark:bg-[#1A1A20]">
      <View className="flex-row items-center gap-3">
        <Avatar
          size="sm"
          source={review.avatarUrl ? { uri: review.avatarUrl } : undefined}
          fallback={review.author.slice(0, 1)}
          alt={`${review.author} avatar`}
        />
        <View className="flex-1">
          <Text variant="small">{review.author}</Text>
          <Text variant="muted" className="text-xs tabular-nums">
            {review.date}
          </Text>
        </View>
        <Stars rating={review.rating} />
      </View>
      <Text variant="muted" className="leading-5">
        {review.text}
      </Text>
      <View className="flex-row items-center justify-between pt-0.5">
        {review.verified !== false ? (
          <View className="flex-row items-center gap-1.5">
            <Icon name="check-circle" size="sm" color="success" />
            <Text variant="muted" className="text-xs">
              Verified purchase
            </Text>
          </View>
        ) : (
          <View />
        )}
        {/* Helpful is a toggle — tinted pill once marked. */}
        <Pressable
          onPress={() => {
            haptics.selection();
            onHelpful?.(review);
          }}
          accessibilityRole="button"
          accessibilityLabel={
            helpful
              ? `Marked helpful, ${count} total`
              : `Mark ${review.author}'s review as helpful`
          }
          accessibilityState={{ selected: helpful }}
          hitSlop={8}
          className={cn(
            "min-h-8 flex-row items-center gap-1.5 rounded-full px-3",
            helpful ? "bg-[#EDF8C4] dark:bg-[#1E2410]" : "bg-transparent"
          )}
        >
          <Icon
            name="check"
            size="sm"
            color={helpful ? "primary" : "mutedForeground"}
          />
          <Text
            variant="small"
            className={cn("tabular-nums", helpful ? "font-semibold text-[#65A30D]" : "text-muted-foreground")}
          >
            Helpful{count > 0 ? ` (${count})` : ""}
          </Text>
        </Pressable>
      </View>
    </View>
  );
}
ReviewCard.displayName = "ReviewCard";

/** Product reviews — rating summary with per-star bars, sort chips, review
 *  cards with verified/helpful rows, and a pinned "Write a review" CTA. */
export function ProductReviewsScreen({
  productName = "Structured Wool Overcoat",
  rating = 4.9,
  reviewCount = 214,
  distribution = DEFAULT_DISTRIBUTION,
  reviews = DEFAULT_REVIEWS,
  onSortChange,
  onHelpful,
  onWriteReview,
  onBack,
}: ProductReviewsScreenProps) {
  const insets = useSafeAreaInsets();
  const [sort, setSort] = useState<SortId>("recent");
  const [helpfulIds, setHelpfulIds] = useState<Set<string>>(new Set());

  const sorted = useMemo(() => {
    if (sort === "highest") return [...reviews].sort((a, b) => b.rating - a.rating);
    if (sort === "lowest") return [...reviews].sort((a, b) => a.rating - b.rating);
    return reviews;
  }, [reviews, sort]);

  const markHelpful = (review: ReviewItem) => {
    setHelpfulIds((prev) => {
      const next = new Set(prev);
      if (next.has(review.id)) next.delete(review.id);
      else next.add(review.id);
      return next;
    });
    onHelpful?.(review);
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered title pill. */}
      <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 pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Reviews
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 96 }}
      >
        {/* Summary — big average + stars left, per-star bars right. */}
        <Mount className="px-6">
          <Card variant="elevated" className="rounded-3xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="flex-row items-center gap-5 p-5">
              <View
                className="items-center gap-1.5"
                accessibilityLabel={`Average rating ${rating} out of 5 from ${reviewCount} reviews`}
              >
                <Text variant="h2" className="tabular-nums">
                  {rating.toFixed(1)}
                </Text>
                <Stars rating={rating} />
                <Text variant="muted" className="text-xs tabular-nums">
                  {reviewCount.toLocaleString()} reviews
                </Text>
                {/* Recommend share — the number buyers actually scan for. */}
                <View className="mt-1 rounded-full bg-success/15 px-2 py-0.5">
                  <Text className="text-[11px] font-semibold text-success">
                    {Math.round((distribution[0] ? distribution[0].count : 0) / Math.max(1, reviewCount) * 100)}% recommend
                  </Text>
                </View>
              </View>
              <View className="flex-1 gap-1.5">
                {distribution.map((d) => (
                  <View
                    key={d.stars}
                    className="flex-row items-center gap-2"
                    accessibilityLabel={`${d.stars} stars, ${d.count} reviews`}
                  >
                    <Text variant="muted" className="w-3 text-right text-xs tabular-nums">
                      {d.stars}
                    </Text>
                    <View className="flex-1">
                      <Progress
                        value={reviewCount > 0 ? (d.count / reviewCount) * 100 : 0}
                      />
                    </View>
                    <Text variant="muted" className="w-8 text-right text-xs tabular-nums">
                      {d.count}
                    </Text>
                  </View>
                ))}
              </View>
            </Card.Content>
          </Card>
        </Mount>

        {/* Sort chips — single-select filter row. Chip fires its own
            selection haptic internally. */}
        <Mount delay={BLOCK_STAGGER} className="px-6 pt-5">
          <View className="flex-row gap-2">
            {SORTS.map((s) => (
              <Chip
                key={s.id}
                variant="filter"
                selected={sort === s.id}
                onPress={() => {
                  setSort(s.id);
                  onSortChange?.(s.id);
                }}
                accessibilityLabel={`Sort by ${s.label}`}
                className="h-9 px-4"
              >
                {s.label}
              </Chip>
            ))}
          </View>
        </Mount>

        {/* Review cards */}
        <View className="gap-5 px-6 pt-5">
          {sorted.map((review, i) => (
            <Mount
              key={review.id}
              delay={BLOCK_STAGGER * 2 + Math.min(i * ROW_STAGGER, ROW_STAGGER_CAP)}
            >
              <ReviewCard
                review={review}
                helpful={helpfulIds.has(review.id)}
                onHelpful={markHelpful}
              />
            </Mount>
          ))}
        </View>
      </ScrollView>

      <StickyBottomBar>
        <Button
            tone="inverse"
          size="lg"
          className="bg-[#1B1B26]"
          haptic="medium"
          icon={<Icon name="edit" size="sm" color="#FFFFFF" />}
          onPress={onWriteReview}
          accessibilityLabel="Write a review"
        >
          Write a review
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
ProductReviewsScreen.displayName = "ProductReviewsScreen";
```

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