Masonry photo explore feed
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Icon, Image, SearchInput, Text } from "@lumioui/ui";
import { Mount, Press, StoryScrim, World } from "../shared";
export interface ExplorePost {
id: string;
uri: string;
likes: string;
tall?: boolean;
}
export interface ExploreGridScreenProps {
posts?: ExplorePost[];
onPostPress?: (id: string) => void;
}
const pic = (id: string, tall?: boolean) =>
`https://images.unsplash.com/photo-${id}?w=400&h=${tall ? 800 : 400}&fit=crop&q=60&auto=format`;
const DEFAULT_POSTS: ExplorePost[] = [
{ id: "e1", uri: pic("1555881400-74d7acaacd8b"), likes: "2.3k" },
{ id: "e2", uri: pic("1533106418989-88406c7cc8ca", true), likes: "1.1k", tall: true },
{ id: "e3", uri: pic("1516483638261-f4dbaf036963"), likes: "890" },
{ id: "e4", uri: pic("1499856871958-5b9627545d1a"), likes: "1.7k" },
{ id: "e5", uri: pic("1488646953014-85cb44e25828"), likes: "720" },
{ id: "e6", uri: pic("1501785888041-af3ef285b470", true), likes: "3.1k", tall: true },
{ id: "e7", uri: pic("1476514525535-07fb3b4ae5f1"), likes: "980" },
{ id: "e8", uri: pic("1467269204594-9661b134dd11"), likes: "1.4k" },
];
/** Explore grid — masonry photo feed with like-count overlays. */
export function ExploreGridScreen({
posts = DEFAULT_POSTS,
onPostPress,
}: ExploreGridScreenProps) {
const insets = useSafeAreaInsets();
const [query, setQuery] = React.useState("");
const left = posts.filter((_, i) => i % 2 === 0);
const right = posts.filter((_, i) => i % 2 === 1);
const tile = (p: ExplorePost) => (
<Press
key={p.id}
haptic="light"
onPress={() => onPostPress?.(p.id)}
accessibilityLabel={`Explore post, ${p.likes} likes`}
className="relative mb-2 overflow-hidden rounded-2xl p-0"
>
<Image
source={{ uri: p.uri }}
className={`w-full bg-muted ${p.tall ? "aspect-[3/4]" : "aspect-square"}`}
accessibilityLabel="Explore photo"
/>
<View className="absolute inset-x-0 bottom-0 h-8">
<StoryScrim edge="bottom" />
</View>
<View className="absolute bottom-1.5 left-2 flex-row items-center gap-1">
<Icon name="heart" size="sm" color="primaryForeground" />
<Text className="text-xs font-semibold text-primary-foreground">
{p.likes}
</Text>
</View>
</Press>
);
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View className="px-4 pb-1 pt-2">
<SearchInput
glass
value={query}
onChangeText={setQuery}
placeholder="Search"
accessibilityLabel="Search explore"
/>
{/* For-you line — explore grids speak to taste, not totals. */}
<Text variant="muted" className="pt-1.5 text-[11px]">
Picked for your film photography posts
</Text>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{
flexDirection: "row",
paddingHorizontal: 6,
paddingBottom: insets.bottom + 24,
}}
>
<Mount className="flex-1 px-1">{left.map(tile)}</Mount>
<Mount delay={90} className="flex-1 px-1">{right.map(tile)}</Mount>
</ScrollView>
</SafeAreaView>
</World>
);
}
ExploreGridScreen.displayName = "ExploreGridScreen";
Recreate the "Explore Grid Screen" screen in React Native using LumioUI.
Goal: Masonry photo explore feed 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-explore-grid
```
Or pull just the components: `npx lumioui add button icon image search-input text`
Native packages:
- @lumioui/ui@latest
- react-native-safe-area-context@*
- @lumioui/core@latest
- 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.
- imported but not rendered directly — likely used through a sibling or as a utility
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×1
### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×1
### `search-input` — Search field with clear button, debounce, focus halo — plus a glass capsule mode that floats over content like iOS 26
- `<SearchInput>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×2
## 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/explore-grid.tsx` exporting ExploreGridScreen. 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 { Icon, Image, SearchInput, Text } from "@lumioui/ui";
import { Mount, Press, StoryScrim, World } from "../shared";
export interface ExplorePost {
id: string;
uri: string;
likes: string;
tall?: boolean;
}
export interface ExploreGridScreenProps {
posts?: ExplorePost[];
onPostPress?: (id: string) => void;
}
const pic = (id: string, tall?: boolean) =>
`https://images.unsplash.com/photo-${id}?w=400&h=${tall ? 800 : 400}&fit=crop&q=60&auto=format`;
const DEFAULT_POSTS: ExplorePost[] = [
{ id: "e1", uri: pic("1555881400-74d7acaacd8b"), likes: "2.3k" },
{ id: "e2", uri: pic("1533106418989-88406c7cc8ca", true), likes: "1.1k", tall: true },
{ id: "e3", uri: pic("1516483638261-f4dbaf036963"), likes: "890" },
{ id: "e4", uri: pic("1499856871958-5b9627545d1a"), likes: "1.7k" },
{ id: "e5", uri: pic("1488646953014-85cb44e25828"), likes: "720" },
{ id: "e6", uri: pic("1501785888041-af3ef285b470", true), likes: "3.1k", tall: true },
{ id: "e7", uri: pic("1476514525535-07fb3b4ae5f1"), likes: "980" },
{ id: "e8", uri: pic("1467269204594-9661b134dd11"), likes: "1.4k" },
];
/** Explore grid — masonry photo feed with like-count overlays. */
export function ExploreGridScreen({
posts = DEFAULT_POSTS,
onPostPress,
}: ExploreGridScreenProps) {
const insets = useSafeAreaInsets();
const [query, setQuery] = React.useState("");
const left = posts.filter((_, i) => i % 2 === 0);
const right = posts.filter((_, i) => i % 2 === 1);
const tile = (p: ExplorePost) => (
<Press
key={p.id}
haptic="light"
onPress={() => onPostPress?.(p.id)}
accessibilityLabel={`Explore post, ${p.likes} likes`}
className="relative mb-2 overflow-hidden rounded-2xl p-0"
>
<Image
source={{ uri: p.uri }}
className={`w-full bg-muted ${p.tall ? "aspect-[3/4]" : "aspect-square"}`}
accessibilityLabel="Explore photo"
/>
<View className="absolute inset-x-0 bottom-0 h-8">
<StoryScrim edge="bottom" />
</View>
<View className="absolute bottom-1.5 left-2 flex-row items-center gap-1">
<Icon name="heart" size="sm" color="primaryForeground" />
<Text className="text-xs font-semibold text-primary-foreground">
{p.likes}
</Text>
</View>
</Press>
);
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View className="px-4 pb-1 pt-2">
<SearchInput
glass
value={query}
onChangeText={setQuery}
placeholder="Search"
accessibilityLabel="Search explore"
/>
{/* For-you line — explore grids speak to taste, not totals. */}
<Text variant="muted" className="pt-1.5 text-[11px]">
Picked for your film photography posts
</Text>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{
flexDirection: "row",
paddingHorizontal: 6,
paddingBottom: insets.bottom + 24,
}}
>
<Mount className="flex-1 px-1">{left.map(tile)}</Mount>
<Mount delay={90} className="flex-1 px-1">{right.map(tile)}</Mount>
</ScrollView>
</SafeAreaView>
</World>
);
}
ExploreGridScreen.displayName = "ExploreGridScreen";
```
Screen: https://lumioui.dev/screens/social-explore-grid