New post composer
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, Icon, Image, Text, Textarea } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, RowIcon, StickyBottomBar, World } from "../shared";
export interface CreatePostScreenProps {
author?: string;
avatarUrl?: string;
photoUrl?: string;
onPost?: (text: string) => void;
onBack?: () => void;
}
/** Create post — photo preview, caption field, options row, post CTA. */
export function CreatePostScreen({
author = "Amara Chen",
avatarUrl = "https://i.pravatar.cc/300?img=47",
photoUrl = "https://images.unsplash.com/photo-1555881400-74d7acaacd8b?w=800&h=800&fit=crop&q=75&auto=format",
onPost,
onBack,
}: CreatePostScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [caption, setCaption] = React.useState(
"Golden hour on the Douro — Porto keeps winning.",
);
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View className="flex-row items-center justify-between px-4 pb-1 pt-2">
<Button
variant="ghost"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Cancel"
className="-ml-2"
>
<Text>Cancel</Text>
</Button>
<Text variant="h4" accessibilityRole="header">
New post
</Text>
<View className="w-12" />
</View>
<ScrollView
className="flex-1"
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
>
{/* Media preview — the thing being posted. */}
<Mount className="px-4 pt-2">
<Image
source={{ uri: photoUrl }}
className="aspect-square w-full rounded-3xl bg-muted"
accessibilityLabel="Selected photo"
/>
{/* Audience line — composers say who this lands with. */}
<Text variant="muted" className="pt-2 text-[11px]">
Sharing to everyone · 9:41 PM
</Text>
</Mount>
{/* Author + caption. */}
<Mount delay={60} className="flex-row gap-2.5 px-4 pt-3">
<Avatar size="sm" source={{ uri: avatarUrl }} fallback={author} alt={author} />
<View className="flex-1">
<Text className="text-sm font-semibold">{author}</Text>
<Textarea
glass
value={caption}
onChangeText={setCaption}
placeholder="Write a caption..."
accessibilityLabel="Caption"
className="mt-1 min-h-[80px] border-0 bg-transparent px-0"
/>
</View>
</Mount>
{/* Options — tag/location/audience rows. */}
<Mount delay={120} className="mx-4 mt-4 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
{[
{ icon: "user-plus" as const, tone: "blue" as const, label: "Tag people" },
{ icon: "map-pin" as const, tone: "green" as const, label: "Add location" },
{ icon: "globe" as const, tone: "purple" as const, label: "Audience · Everyone" },
].map((o) => (
<Button
key={o.label}
variant="ghost"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={o.label}
className="h-14 flex-row items-center justify-between px-4"
>
<View className="flex-row items-center gap-3">
<RowIcon name={o.icon} tone={o.tone} />
<Text className="text-sm">{o.label}</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Button>
))}
</Mount>
</ScrollView>
<StickyBottomBar>
<View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
<Button
haptic="light"
onPress={() => {
haptics.medium();
onPost?.(caption);
}}
accessibilityLabel="Share post"
tone="inverse" className="bg-[#1B1B26] h-11 w-full"
>
Share
</Button>
</View>
</StickyBottomBar>
</SafeAreaView>
</World>
);
}
CreatePostScreen.displayName = "CreatePostScreen";
Recreate the "Create Post Screen" screen in React Native using LumioUI.
Goal: New post composer 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 social-create-post
```
Or pull just the components: `npx lumioui add avatar button icon image text textarea`
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
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×1
### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×5
### `textarea` — Multiline field with auto-grow and character count.
- `<Textarea>` ×1
## 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/social/create-post.tsx` exporting CreatePostScreen. 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, Icon, Image, Text, Textarea } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, RowIcon, StickyBottomBar, World } from "../shared";
export interface CreatePostScreenProps {
author?: string;
avatarUrl?: string;
photoUrl?: string;
onPost?: (text: string) => void;
onBack?: () => void;
}
/** Create post — photo preview, caption field, options row, post CTA. */
export function CreatePostScreen({
author = "Amara Chen",
avatarUrl = "https://i.pravatar.cc/300?img=47",
photoUrl = "https://images.unsplash.com/photo-1555881400-74d7acaacd8b?w=800&h=800&fit=crop&q=75&auto=format",
onPost,
onBack,
}: CreatePostScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [caption, setCaption] = React.useState(
"Golden hour on the Douro — Porto keeps winning.",
);
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View className="flex-row items-center justify-between px-4 pb-1 pt-2">
<Button
variant="ghost"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Cancel"
className="-ml-2"
>
<Text>Cancel</Text>
</Button>
<Text variant="h4" accessibilityRole="header">
New post
</Text>
<View className="w-12" />
</View>
<ScrollView
className="flex-1"
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
>
{/* Media preview — the thing being posted. */}
<Mount className="px-4 pt-2">
<Image
source={{ uri: photoUrl }}
className="aspect-square w-full rounded-3xl bg-muted"
accessibilityLabel="Selected photo"
/>
{/* Audience line — composers say who this lands with. */}
<Text variant="muted" className="pt-2 text-[11px]">
Sharing to everyone · 9:41 PM
</Text>
</Mount>
{/* Author + caption. */}
<Mount delay={60} className="flex-row gap-2.5 px-4 pt-3">
<Avatar size="sm" source={{ uri: avatarUrl }} fallback={author} alt={author} />
<View className="flex-1">
<Text className="text-sm font-semibold">{author}</Text>
<Textarea
glass
value={caption}
onChangeText={setCaption}
placeholder="Write a caption..."
accessibilityLabel="Caption"
className="mt-1 min-h-[80px] border-0 bg-transparent px-0"
/>
</View>
</Mount>
{/* Options — tag/location/audience rows. */}
<Mount delay={120} className="mx-4 mt-4 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
{[
{ icon: "user-plus" as const, tone: "blue" as const, label: "Tag people" },
{ icon: "map-pin" as const, tone: "green" as const, label: "Add location" },
{ icon: "globe" as const, tone: "purple" as const, label: "Audience · Everyone" },
].map((o) => (
<Button
key={o.label}
variant="ghost"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel={o.label}
className="h-14 flex-row items-center justify-between px-4"
>
<View className="flex-row items-center gap-3">
<RowIcon name={o.icon} tone={o.tone} />
<Text className="text-sm">{o.label}</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Button>
))}
</Mount>
</ScrollView>
<StickyBottomBar>
<View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
<Button
haptic="light"
onPress={() => {
haptics.medium();
onPost?.(caption);
}}
accessibilityLabel="Share post"
tone="inverse" className="bg-[#1B1B26] h-11 w-full"
>
Share
</Button>
</View>
</StickyBottomBar>
</SafeAreaView>
</World>
);
}
CreatePostScreen.displayName = "CreatePostScreen";
```
Screen: https://lumioui.dev/screens/social-create-post