Channel-grouped push and email notification toggles with quiet hours.
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Switch, Text, type IconName } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, RowIcon, SEPARATOR_INSET, type IconTone } from "../shared";
export interface NotificationToggle {
key: string;
title: string;
subtitle?: string;
icon: IconName;
tone: IconTone;
}
export interface NotificationSettingsScreenProps {
sections?: { title: string; items: NotificationToggle[] }[];
values?: Record<string, boolean>;
onToggle?: (key: string, value: boolean) => void;
onQuietHours?: () => void;
onBack?: () => void;
}
const DEFAULT_SECTIONS: NonNullable<NotificationSettingsScreenProps["sections"]> = [
{
title: "Push",
items: [
{ key: "mentions", title: "Mentions", subtitle: "When someone @mentions you", icon: "bell", tone: "blue" },
{ key: "comments", title: "Comments", subtitle: "Replies on your posts", icon: "message-circle", tone: "green" },
{ key: "follows", title: "New followers", icon: "user-plus", tone: "purple" },
],
},
{
title: "Email",
items: [
{ key: "digest", title: "Weekly digest", subtitle: "Your activity, every Monday", icon: "mail", tone: "orange" },
{ key: "product", title: "Product updates", icon: "zap", tone: "teal" },
],
},
{
title: "On this device",
items: [
{ key: "badges", title: "App icon badges", subtitle: "Unread count on the home screen", icon: "grid", tone: "red" },
{ key: "sounds", title: "In-app sounds", subtitle: "Chime when a message lands", icon: "volume", tone: "purple" },
{ key: "preview", title: "Show previews", subtitle: "Message text on the lock screen", icon: "eye", tone: "blue" },
],
},
];
const DEFAULT_VALUES: Record<string, boolean> = {
mentions: true,
comments: true,
follows: false,
digest: true,
product: false,
badges: true,
sounds: true,
preview: true,
};
/** Notification settings — grouped toggle lists per channel (iOS Settings idiom). */
export function NotificationSettingsScreen({
sections = DEFAULT_SECTIONS,
values = DEFAULT_VALUES,
onToggle,
onQuietHours,
onBack,
}: NotificationSettingsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [local, setLocal] = React.useState(values);
const toggle = (key: string, v: boolean) => {
haptics.selection();
setLocal((prev) => ({ ...prev, [key]: v }));
onToggle?.(key, v);
};
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill. */}
<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>
<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"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Notifications
</Text>
</Glass>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Quiet-hours card — the one schedule on the page earns its own
composition: moon tile + window + a nav chevron, above the toggles. */}
<Mount>
<Press
haptic="light"
pressedScale={0.98}
onPress={() => onQuietHours?.()}
accessibilityRole="button"
accessibilityLabel="Quiet hours, muted daily from 10 PM to 7 AM"
className="mx-6 mb-4 flex-row items-center gap-3 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]"
>
<View className="h-12 w-12 items-center justify-center rounded-2xl bg-indigo-500/15">
<Icon name="moon" size="md" color="#6366F1" />
</View>
<View className="flex-1">
<Text className="font-semibold">Quiet hours</Text>
<Text variant="small" className="text-muted-foreground">
Muted daily · 22:00–07:00
</Text>
</View>
<View className="rounded-full bg-[#BEF04C] px-2.5 py-1">
<Text className="text-xs font-semibold text-[#1B1B26]">On</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Press>
</Mount>
<Mount delay={60}>
<List inset glass>
{sections.map((section) => (
<List.Section key={section.title} title={section.title}>
{section.items.map((item, ii) => {
const checked = local[item.key] ?? false;
return (
<React.Fragment key={item.key}>
{ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
<List.Item
title={item.title}
subtitle={item.subtitle}
leading={<RowIcon name={item.icon} tone={item.tone} />}
haptic={false}
onPress={() => toggle(item.key, !checked)}
accessibilityState={{ checked }}
trailing={
<Switch
checked={checked}
onCheckedChange={(v) => toggle(item.key, v)}
accessibilityLabel={item.title}
/>
}
/>
</React.Fragment>
);
})}
</List.Section>
))}
</List>
{/* Sync note — notification prefs are account-level, not per-device. */}
<View className="flex-row items-center justify-center gap-1.5 px-6 pt-4">
<Icon name="check-circle" size="sm" color="mutedForeground" />
<Text variant="muted" className="text-center text-xs">
Synced across all your devices
</Text>
</View>
</Mount>
</ScrollView>
</SafeAreaView>
);
}
NotificationSettingsScreen.displayName = "NotificationSettingsScreen";
Recreate the "Notification settings Screen" screen in React Native using LumioUI.
Goal: Channel-grouped push and email notification toggles with quiet hours. 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 core-notification-settings
```
Or pull just the components: `npx lumioui add button icon list switch 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>` ×1
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×4
### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1
### `switch` — iOS-size toggle with spring thumb and haptics.
- `<Switch>` ×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/core/notification-settings.tsx` exporting NotificationSettingsScreen. 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 { Button, Glass, Icon, List, Switch, Text, type IconName } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, RowIcon, SEPARATOR_INSET, type IconTone } from "../shared";
export interface NotificationToggle {
key: string;
title: string;
subtitle?: string;
icon: IconName;
tone: IconTone;
}
export interface NotificationSettingsScreenProps {
sections?: { title: string; items: NotificationToggle[] }[];
values?: Record<string, boolean>;
onToggle?: (key: string, value: boolean) => void;
onQuietHours?: () => void;
onBack?: () => void;
}
const DEFAULT_SECTIONS: NonNullable<NotificationSettingsScreenProps["sections"]> = [
{
title: "Push",
items: [
{ key: "mentions", title: "Mentions", subtitle: "When someone @mentions you", icon: "bell", tone: "blue" },
{ key: "comments", title: "Comments", subtitle: "Replies on your posts", icon: "message-circle", tone: "green" },
{ key: "follows", title: "New followers", icon: "user-plus", tone: "purple" },
],
},
{
title: "Email",
items: [
{ key: "digest", title: "Weekly digest", subtitle: "Your activity, every Monday", icon: "mail", tone: "orange" },
{ key: "product", title: "Product updates", icon: "zap", tone: "teal" },
],
},
{
title: "On this device",
items: [
{ key: "badges", title: "App icon badges", subtitle: "Unread count on the home screen", icon: "grid", tone: "red" },
{ key: "sounds", title: "In-app sounds", subtitle: "Chime when a message lands", icon: "volume", tone: "purple" },
{ key: "preview", title: "Show previews", subtitle: "Message text on the lock screen", icon: "eye", tone: "blue" },
],
},
];
const DEFAULT_VALUES: Record<string, boolean> = {
mentions: true,
comments: true,
follows: false,
digest: true,
product: false,
badges: true,
sounds: true,
preview: true,
};
/** Notification settings — grouped toggle lists per channel (iOS Settings idiom). */
export function NotificationSettingsScreen({
sections = DEFAULT_SECTIONS,
values = DEFAULT_VALUES,
onToggle,
onQuietHours,
onBack,
}: NotificationSettingsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [local, setLocal] = React.useState(values);
const toggle = (key: string, v: boolean) => {
haptics.selection();
setLocal((prev) => ({ ...prev, [key]: v }));
onToggle?.(key, v);
};
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill. */}
<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>
<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"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Notifications
</Text>
</Glass>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Quiet-hours card — the one schedule on the page earns its own
composition: moon tile + window + a nav chevron, above the toggles. */}
<Mount>
<Press
haptic="light"
pressedScale={0.98}
onPress={() => onQuietHours?.()}
accessibilityRole="button"
accessibilityLabel="Quiet hours, muted daily from 10 PM to 7 AM"
className="mx-6 mb-4 flex-row items-center gap-3 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]"
>
<View className="h-12 w-12 items-center justify-center rounded-2xl bg-indigo-500/15">
<Icon name="moon" size="md" color="#6366F1" />
</View>
<View className="flex-1">
<Text className="font-semibold">Quiet hours</Text>
<Text variant="small" className="text-muted-foreground">
Muted daily · 22:00–07:00
</Text>
</View>
<View className="rounded-full bg-[#BEF04C] px-2.5 py-1">
<Text className="text-xs font-semibold text-[#1B1B26]">On</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Press>
</Mount>
<Mount delay={60}>
<List inset glass>
{sections.map((section) => (
<List.Section key={section.title} title={section.title}>
{section.items.map((item, ii) => {
const checked = local[item.key] ?? false;
return (
<React.Fragment key={item.key}>
{ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
<List.Item
title={item.title}
subtitle={item.subtitle}
leading={<RowIcon name={item.icon} tone={item.tone} />}
haptic={false}
onPress={() => toggle(item.key, !checked)}
accessibilityState={{ checked }}
trailing={
<Switch
checked={checked}
onCheckedChange={(v) => toggle(item.key, v)}
accessibilityLabel={item.title}
/>
}
/>
</React.Fragment>
);
})}
</List.Section>
))}
</List>
{/* Sync note — notification prefs are account-level, not per-device. */}
<View className="flex-row items-center justify-center gap-1.5 px-6 pt-4">
<Icon name="check-circle" size="sm" color="mutedForeground" />
<Text variant="muted" className="text-center text-xs">
Synced across all your devices
</Text>
</View>
</Mount>
</ScrollView>
</SafeAreaView>
);
}
NotificationSettingsScreen.displayName = "NotificationSettingsScreen";
```
Screen: https://lumioui.dev/screens/core-notification-settings