v0.1 public beta early access on GitHub
Home / Screens / chat-message-requests
Screen template

Message Requests Screen

Accept or delete requests from unknown senders

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add chat-message-requests
import { MessageRequestsScreen } from "@/screens/chat/message-requests";
Registry dependencies6
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
chat/message-requests.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, EmptyState, Glass, Icon, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press } from "../shared";

export interface MessageRequest {
  id: string;
  name: string;
  avatarUrl?: string;
  preview: string;
  /** e.g. "3 mutual groups" — the deciding context. */
  context: string;
}

export interface MessageRequestsScreenProps {
  requests?: MessageRequest[];
  onAccept?: (id: string) => void;
  onDelete?: (id: string) => void;
  onBack?: () => void;
}

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

/** Context-chip tones — the funky palette at a readable wash. */
const CHIP_TONES = [
  { bg: "#8B93F826", fg: "#5E68E0" },
  { bg: "#3EC0BF26", fg: "#2E8F8E" },
  { bg: "#F8AC6B2E", fg: "#C96A1E" },
  { bg: "#EC5C9E26", fg: "#C73A7E" },
  { bg: "#BEF04C4D", fg: "#5A8A12" },
];

const DEFAULT_REQUESTS: MessageRequest[] = [
  { id: "r1", name: "Priya Nair", avatarUrl: face(41), preview: "Hey — saw your talk at Config, loved the tokens section", context: "2 mutual groups" },
  { id: "r2", name: "Jonah Wells", avatarUrl: face(53), preview: "Is the Obsidian jacket still available in M?", context: "Follows Lumio" },
  { id: "r3", name: "Camila Ortiz", avatarUrl: face(28), preview: "Wanted to share the invoice for Friday's shoot", context: "Photography" },
  { id: "r4", name: "Ren Ishida", avatarUrl: face(68), preview: "Your standing-desk review helped — quick question on the mat", context: "Follows you" },
  { id: "r5", name: "North Studio", avatarUrl: face(59), preview: "Contract attached for the October residency", context: "Collaboration" },
  { id: "r6", name: "Dana Kim", avatarUrl: face(24), preview: "Met you at the meetup — can I grab the slides?", context: "Attended Design Meetup" },
];

/** Message requests — accept/delete rows for unknown senders. */
export function MessageRequestsScreen({
  requests = DEFAULT_REQUESTS,
  onAccept,
  onDelete,
  onBack,
}: MessageRequestsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [items, setItems] = React.useState(requests);
  React.useEffect(() => setItems(requests), [requests]);

  const resolve = (id: string, accepted: boolean) => {
    haptics.selection();
    setItems((p) => p.filter((r) => r.id !== id));
    if (accepted) onAccept?.(id);
    else onDelete?.(id);
  };

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 62, paddingBottom: insets.bottom + 48 }}
      >
        {/* IG's privacy contract for this inbox — read receipts and status
            stay hidden until you accept. It's the reason this screen exists,
            so it leads, not the footer. */}
        <Mount delay={30}>
          <View className="mx-6 mb-3 flex-row items-start gap-2.5 rounded-2xl bg-white px-4 py-3 dark:bg-[#1A1A20]">
            <Icon name="shield" size="sm" color="foreground" />
            <Text variant="small" className="flex-1 text-muted-foreground">
              They can't see your activity status or know you've read their
              message until you accept.
            </Text>
          </View>
        </Mount>

      {items.length === 0 ? (
        <Mount className="items-center justify-center px-8 pt-24">
          <EmptyState
            icon={<Icon name="check-circle" size="lg" color="success" />}
            title="All caught up"
            description="When people you don't follow message you, their requests land here."
          />
        </Mount>
      ) : (
        <>
          
          {items.map((r, i) => {
            const chip = CHIP_TONES[i % CHIP_TONES.length]!;
            return (
            <View key={r.id} className="mx-4 mb-3 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]">
              <View className="flex-row items-center gap-3">
                <Avatar
                  size="md"
                  source={r.avatarUrl ? { uri: r.avatarUrl } : undefined}
                  fallback={r.name}
                  alt={r.name}
                />
                <View className="flex-1 gap-0.5">
                  <Text className="font-semibold">{r.name}</Text>
                  {/* The deciding context — why this person can reach you. */}
                  <View className="self-start rounded-full px-2 py-0.5" style={{ backgroundColor: chip.bg }}>
                    <Text className="text-[10px] font-semibold" style={{ color: chip.fg }}>
                      {r.context}
                    </Text>
                  </View>
                </View>
              </View>
              {/* Their actual words — a bubble, not a label. */}
              <View className="ml-11 mt-2 self-start rounded-2xl rounded-tl-md bg-[#F1F1F5] px-3.5 py-2.5 dark:bg-white/10">
                <Text
                  variant="small"
                  numberOfLines={2}
                  className="text-foreground"
                >
                  {r.preview}
                </Text>
              </View>
              {/* Compact action pair on the right — a small Accept pill
                  plus a quiet delete icon, not twin full-width buttons. */}
              <View className="ml-11 mt-3 flex-row items-center justify-end gap-2">
                <Button
                  variant="ghost"
                  size="icon"
                  haptic="light"
                  onPress={() => resolve(r.id, false)}
                  accessibilityLabel={`Delete request from ${r.name}`}
                  className="h-9 w-9"
                >
                  <Icon name="trash" size="sm" color="mutedForeground" />
                </Button>
                <Button
                  size="sm"
                  haptic="light"
                  onPress={() => resolve(r.id, true)}
                  accessibilityLabel={`Accept request from ${r.name}`}
                  className="h-9 rounded-full bg-[#BEF04C] px-5"
                  textClassName="font-semibold text-[#0B0B0F]"
                >
                  Accept
                </Button>
              </View>
            </View>
            );
          })}

          {/* Hidden-requests divider — IG keeps a second filtered inbox
              under the visible requests. */}
          <Press
            haptic="light"
            accessibilityRole="button"
            accessibilityLabel="Show hidden requests"
            className="mx-6 mt-1 flex-row items-center gap-2.5 rounded-full bg-white px-4 py-2.5 dark:bg-[#1A1A20]"
          >
            <Icon name="eye-off" size="sm" color="mutedForeground" />
            <Text variant="muted" className="flex-1 text-xs">
              Requests that may be offensive or spam are hidden
            </Text>
            <Icon name="chevron-right" size="sm" color="mutedForeground" />
          </Press>
        </>
      )}
      </ScrollView>

      {/* Floating chrome — separate frosted pills on one line: back
          and the centered title. Cards scroll underneath. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        {/* Title pill hugs its label and centers on the whole row. */}
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Mount className="items-center">
              <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
                Message requests
              </Text>
              <Text className="text-[10px] tabular-nums text-muted-foreground">
                {items.length} new
              </Text>
            </Mount>
          </Glass>
        </View>
      </View>
    </SafeAreaView>
  );
}
MessageRequestsScreen.displayName = "MessageRequestsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Message Requests Screen" screen in React Native using LumioUI.

Goal: Accept or delete requests from unknown senders 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 chat-message-requests
```

Or pull just the components: `npx lumioui add avatar button empty-state glass icon 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>` ×3

### `empty-state` — Illustrated placeholder with title, copy and action slot.
- `<EmptyState>` ×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>` ×6

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

## 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/chat/message-requests.tsx` exporting MessageRequestsScreen. 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, EmptyState, Glass, Icon, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press } from "../shared";

export interface MessageRequest {
  id: string;
  name: string;
  avatarUrl?: string;
  preview: string;
  /** e.g. "3 mutual groups" — the deciding context. */
  context: string;
}

export interface MessageRequestsScreenProps {
  requests?: MessageRequest[];
  onAccept?: (id: string) => void;
  onDelete?: (id: string) => void;
  onBack?: () => void;
}

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

/** Context-chip tones — the funky palette at a readable wash. */
const CHIP_TONES = [
  { bg: "#8B93F826", fg: "#5E68E0" },
  { bg: "#3EC0BF26", fg: "#2E8F8E" },
  { bg: "#F8AC6B2E", fg: "#C96A1E" },
  { bg: "#EC5C9E26", fg: "#C73A7E" },
  { bg: "#BEF04C4D", fg: "#5A8A12" },
];

const DEFAULT_REQUESTS: MessageRequest[] = [
  { id: "r1", name: "Priya Nair", avatarUrl: face(41), preview: "Hey — saw your talk at Config, loved the tokens section", context: "2 mutual groups" },
  { id: "r2", name: "Jonah Wells", avatarUrl: face(53), preview: "Is the Obsidian jacket still available in M?", context: "Follows Lumio" },
  { id: "r3", name: "Camila Ortiz", avatarUrl: face(28), preview: "Wanted to share the invoice for Friday's shoot", context: "Photography" },
  { id: "r4", name: "Ren Ishida", avatarUrl: face(68), preview: "Your standing-desk review helped — quick question on the mat", context: "Follows you" },
  { id: "r5", name: "North Studio", avatarUrl: face(59), preview: "Contract attached for the October residency", context: "Collaboration" },
  { id: "r6", name: "Dana Kim", avatarUrl: face(24), preview: "Met you at the meetup — can I grab the slides?", context: "Attended Design Meetup" },
];

/** Message requests — accept/delete rows for unknown senders. */
export function MessageRequestsScreen({
  requests = DEFAULT_REQUESTS,
  onAccept,
  onDelete,
  onBack,
}: MessageRequestsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [items, setItems] = React.useState(requests);
  React.useEffect(() => setItems(requests), [requests]);

  const resolve = (id: string, accepted: boolean) => {
    haptics.selection();
    setItems((p) => p.filter((r) => r.id !== id));
    if (accepted) onAccept?.(id);
    else onDelete?.(id);
  };

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingTop: insets.top + 62, paddingBottom: insets.bottom + 48 }}
      >
        {/* IG's privacy contract for this inbox — read receipts and status
            stay hidden until you accept. It's the reason this screen exists,
            so it leads, not the footer. */}
        <Mount delay={30}>
          <View className="mx-6 mb-3 flex-row items-start gap-2.5 rounded-2xl bg-white px-4 py-3 dark:bg-[#1A1A20]">
            <Icon name="shield" size="sm" color="foreground" />
            <Text variant="small" className="flex-1 text-muted-foreground">
              They can't see your activity status or know you've read their
              message until you accept.
            </Text>
          </View>
        </Mount>

      {items.length === 0 ? (
        <Mount className="items-center justify-center px-8 pt-24">
          <EmptyState
            icon={<Icon name="check-circle" size="lg" color="success" />}
            title="All caught up"
            description="When people you don't follow message you, their requests land here."
          />
        </Mount>
      ) : (
        <>
          
          {items.map((r, i) => {
            const chip = CHIP_TONES[i % CHIP_TONES.length]!;
            return (
            <View key={r.id} className="mx-4 mb-3 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]">
              <View className="flex-row items-center gap-3">
                <Avatar
                  size="md"
                  source={r.avatarUrl ? { uri: r.avatarUrl } : undefined}
                  fallback={r.name}
                  alt={r.name}
                />
                <View className="flex-1 gap-0.5">
                  <Text className="font-semibold">{r.name}</Text>
                  {/* The deciding context — why this person can reach you. */}
                  <View className="self-start rounded-full px-2 py-0.5" style={{ backgroundColor: chip.bg }}>
                    <Text className="text-[10px] font-semibold" style={{ color: chip.fg }}>
                      {r.context}
                    </Text>
                  </View>
                </View>
              </View>
              {/* Their actual words — a bubble, not a label. */}
              <View className="ml-11 mt-2 self-start rounded-2xl rounded-tl-md bg-[#F1F1F5] px-3.5 py-2.5 dark:bg-white/10">
                <Text
                  variant="small"
                  numberOfLines={2}
                  className="text-foreground"
                >
                  {r.preview}
                </Text>
              </View>
              {/* Compact action pair on the right — a small Accept pill
                  plus a quiet delete icon, not twin full-width buttons. */}
              <View className="ml-11 mt-3 flex-row items-center justify-end gap-2">
                <Button
                  variant="ghost"
                  size="icon"
                  haptic="light"
                  onPress={() => resolve(r.id, false)}
                  accessibilityLabel={`Delete request from ${r.name}`}
                  className="h-9 w-9"
                >
                  <Icon name="trash" size="sm" color="mutedForeground" />
                </Button>
                <Button
                  size="sm"
                  haptic="light"
                  onPress={() => resolve(r.id, true)}
                  accessibilityLabel={`Accept request from ${r.name}`}
                  className="h-9 rounded-full bg-[#BEF04C] px-5"
                  textClassName="font-semibold text-[#0B0B0F]"
                >
                  Accept
                </Button>
              </View>
            </View>
            );
          })}

          {/* Hidden-requests divider — IG keeps a second filtered inbox
              under the visible requests. */}
          <Press
            haptic="light"
            accessibilityRole="button"
            accessibilityLabel="Show hidden requests"
            className="mx-6 mt-1 flex-row items-center gap-2.5 rounded-full bg-white px-4 py-2.5 dark:bg-[#1A1A20]"
          >
            <Icon name="eye-off" size="sm" color="mutedForeground" />
            <Text variant="muted" className="flex-1 text-xs">
              Requests that may be offensive or spam are hidden
            </Text>
            <Icon name="chevron-right" size="sm" color="mutedForeground" />
          </Press>
        </>
      )}
      </ScrollView>

      {/* Floating chrome — separate frosted pills on one line: back
          and the centered title. Cards scroll underneath. */}
      <View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
        <View className="flex-row items-center gap-2">
          <Glass
            effect="regular"
            className="h-11 w-11 items-center justify-center rounded-full"
          >
            <Button
              variant="ghost"
              size="icon"
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityLabel="Go back"
              className="h-9 w-9"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Button>
          </Glass>
        </View>
        {/* Title pill hugs its label and centers on the whole row. */}
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <Glass
            effect="regular"
            className="h-11 flex-row items-center justify-center rounded-full px-5"
          >
            <Mount className="items-center">
              <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
                Message requests
              </Text>
              <Text className="text-[10px] tabular-nums text-muted-foreground">
                {items.length} new
              </Text>
            </Mount>
          </Glass>
        </View>
      </View>
    </SafeAreaView>
  );
}
MessageRequestsScreen.displayName = "MessageRequestsScreen";
```

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