Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

feat(mobile): elastic tab marker, tab and pane transitions, list motion

Amruth Pillai8a16c3e91885
diff --git a/apps/mobile/app/(tabs)/_layout.tsx b/apps/mobile/app/(tabs)/_layout.tsx
index e0e94ffe6..caf846dca 100644
--- a/apps/mobile/app/(tabs)/_layout.tsx
+++ b/apps/mobile/app/(tabs)/_layout.tsx
@@ -15,7 +15,7 @@ import { AppStrip, BannerAbove } from "@/shell/app-banner";
import { AppSidebar, PhoneTabBar } from "@/shell/app-tabs";
import { useKeyCommands } from "@/shell/key-commands";
import { useIsTablet } from "@/shell/use-is-tablet";
-import { useTheme } from "@/ui";
+import { useReducedMotion, useTheme } from "@/ui";
/**
* Five tabs: Documents, Applications, the raised "+" (opens New as a modal), Career, Settings. Phone: the bottom tab
@@ -29,7 +29,8 @@ export default function TabsLayout() {
const insets = useSafeAreaInsets();
const network = useNetworkState();
const offline = network.isConnected === false || network.isInternetReachable === false;
- const { colors } = useTheme();
+ const { colors, motion } = useTheme();
+ const reduced = useReducedMotion();
useKeyCommands(
[
{ id: "search", input: "k", title: t`Search`, run: () => router.push(routes.search()) },
@@ -57,7 +58,16 @@ export default function TabsLayout() {
<SafeAreaProvider>
<Tabs
tabBar={(props) => (tablet ? <AppSidebar {...props} /> : <PhoneTabBar {...props} />)}
- screenOptions={{ animation: "none", headerShown: false, tabBarPosition: tablet ? "left" : "bottom" }}
+ screenOptions={{
+ // Owner asked for a swipe between tabs; reduced motion keeps a short crossfade.
+ animation: reduced ? "fade" : "shift",
+ transitionSpec: {
+ animation: "timing",
+ config: { duration: reduced ? motion.d1 : 220, easing: motion.ease },
+ },
+ headerShown: false,
+ tabBarPosition: tablet ? "left" : "bottom",
+ }}
>
<Tabs.Screen name="documents" options={{ title: t`Documents` }} />
<Tabs.Screen name="applications" options={{ title: t`Applications` }} />
diff --git a/apps/mobile/app/(tabs)/career/_layout.tsx b/apps/mobile/app/(tabs)/career/_layout.tsx
index e7b507edb..1d7713bc7 100644
--- a/apps/mobile/app/(tabs)/career/_layout.tsx
+++ b/apps/mobile/app/(tabs)/career/_layout.tsx
@@ -9,7 +9,7 @@ import { Segmented, useTheme } from "@/ui";
export default function CareerLayout() {
const { t } = useLingui();
- const { colors, space } = useTheme();
+ const { colors, motion, space } = useTheme();
const insets = useSafeAreaInsets();
const stackOptions = useTabStackOptions(true);
const pathname = usePathname();
@@ -33,7 +33,10 @@ export default function CareerLayout() {
</View>
{/* Plain content needs an opaque header; SafeAreaView already clears the status bar. */}
<SafeAreaInsetsContext value={{ ...insets, top: 0, left: 0, right: 0 }}>
- <Stack screenOptions={{ ...stackOptions, headerTransparent: false }}>
+ {/* The sub-tabs are peers swapped with `replace`, so they crossfade instead of pushing. */}
+ <Stack
+ screenOptions={{ ...stackOptions, animation: "fade", animationDuration: motion.d2, headerTransparent: false }}
+ >
{["index", ...tabs.map((tab) => tab.value)].map((name) => (
<Stack.Screen key={name} name={name} options={{ headerShown: false }} />
))}
diff --git a/apps/mobile/scripts/experience.test.mjs b/apps/mobile/scripts/experience.test.mjs
index 3b0a1a693..eb9d67b90 100644
--- a/apps/mobile/scripts/experience.test.mjs
+++ b/apps/mobile/scripts/experience.test.mjs
@@ -54,6 +54,9 @@ const ui = Object.fromEntries(
);
ui.useTheme = () => theme;
ui.showToast = (value) => calls.push(value);
+ui.listItemMotion = () => ({});
+ui.listLayout = {};
+ui.useFirstAppearance = () => false;
const mocks = {
react,
"react-native": { View: "View", Pressable: "Pressable", ScrollView: "ScrollView" },
@@ -63,6 +66,13 @@ const mocks = {
"@/routes": { routes },
"@/ui": ui,
"@/ui/use-pull-refresh": { usePullRefresh: () => ({ refreshing: false, onRefresh: () => undefined }) },
+ "react-native-reanimated": {
+ View: "Animated.View",
+ useSharedValue: (initial) => ({ get: () => initial, set() {} }),
+ useAnimatedStyle: () => ({}),
+ withTiming: (value) => value,
+ withSpring: (value) => value,
+ },
};
function load(path, extra = {}) {
const module = { exports: {} };
diff --git a/apps/mobile/scripts/layout.test.mjs b/apps/mobile/scripts/layout.test.mjs
index 360069309..51e85d673 100644
--- a/apps/mobile/scripts/layout.test.mjs
+++ b/apps/mobile/scripts/layout.test.mjs
@@ -85,7 +85,7 @@ const { useIsTablet: isTablet } = load("shell/use-is-tablet.ts");
mocks["./use-is-tablet"] = { useIsTablet: isTablet };
const { Screen } = load("ui/text.tsx");
const { TopBar } = load("shell/top-bar.tsx");
-const { AppSidebar } = load("shell/app-tabs.tsx");
+const { AppSidebar } = load("shell/app-tabs.tsx", { "react-native-reanimated": {} });
const nodes = (tree) =>
!tree || typeof tree !== "object"
? []
@@ -309,6 +309,8 @@ const animation = {
useSharedValue: (initial) => ({ get: () => initial, set() {} }),
useAnimatedStyle: () => ({}),
withTiming: (value) => value,
+ withSpring: (value) => value,
+ withSequence: (...values) => values.at(-1),
};
const componentFixtures = {
"./button": ui,
@@ -327,7 +329,7 @@ const { Segmented } = load("ui/fields.tsx", {
"./overlays": { InSheetContext: {}, Sheet: "Sheet" },
"@gorhom/bottom-sheet": { BottomSheetTextInput: "TextInput" },
});
-const { BarItem } = load("shell/app-tabs.tsx");
+const { BarItem } = load("shell/app-tabs.tsx", { "react-native-reanimated": animation });
const { KnowledgeScreen } = load("features/career/knowledge.tsx", {
"./facts": { Facts: "Facts" },
"./stories": { Stories: "Stories" },
@@ -354,7 +356,17 @@ const { DocumentsLibrary } = load("features/documents/library.tsx", {
"expo-router": { ...mocks["expo-router"], useFocusEffect() {} },
"@lingui/core/macro": { plural: (count, options) => options[count === 1 ? "one" : "other"].replace("#", count) },
"react-native-gesture-handler/ReanimatedSwipeable": {},
- "@/ui": { ...ui, Screen: "Screen", ListRow: "ListRow", Chip: "Chip", Banner: "Banner" },
+ "react-native-reanimated": { ...animation, FlatList: "FlatList" },
+ "@/ui": {
+ ...ui,
+ Screen: "Screen",
+ ListRow: "ListRow",
+ Chip: "Chip",
+ Banner: "Banner",
+ listItemMotion: () => ({}),
+ listLayout: {},
+ useFirstAppearance: () => false,
+ },
});
for (const fontScale of [1, 1.95, 3.12]) {
window = { width: 320, height: 568, fontScale };
diff --git a/apps/mobile/src/features/applications-board/board-screen.tsx b/apps/mobile/src/features/applications-board/board-screen.tsx
index 33e879b37..ef1bc9bc1 100644
--- a/apps/mobile/src/features/applications-board/board-screen.tsx
+++ b/apps/mobile/src/features/applications-board/board-screen.tsx
@@ -41,7 +41,10 @@ import {
Switch,
Text,
haptics,
+ listItemMotion,
+ listLayout,
showToast,
+ useFirstAppearance,
useReducedMotion,
useTheme,
} from "@/ui";
@@ -445,6 +448,8 @@ function Column({
const pull = usePullRefresh(onRefresh);
const [visible, setVisible] = useState(COLUMN_PAGE_SIZE);
const shown = applications.slice(0, visible);
+ // Columns mount once the board has data, so cards stagger in when the board opens.
+ const firstAppearance = useFirstAppearance(true);
const remaining = applications.length - shown.length;
return (
@@ -493,15 +498,16 @@ function Column({
{stage === "closed" && applications.length === 0 ? (
<Text variant="callout" color="ink3">{t`Drop here to close with a reason.`}</Text>
) : null}
- {shown.map((application) => (
- <DraggableCard
- key={application.id}
- application={application}
- width={cardWidth}
- dragging={application.id === draggingId}
- handlers={handlers}
- onMove={() => onMove(application)}
- />
+ {shown.map((application, index) => (
+ <Animated.View key={application.id} {...listItemMotion(index, firstAppearance)} layout={listLayout}>
+ <DraggableCard
+ application={application}
+ width={cardWidth}
+ dragging={application.id === draggingId}
+ handlers={handlers}
+ onMove={() => onMove(application)}
+ />
+ </Animated.View>
))}
{remaining > 0 ? (
<Button
diff --git a/apps/mobile/src/features/applications-board/views.tsx b/apps/mobile/src/features/applications-board/views.tsx
index 89bcbb417..b071f48e5 100644
--- a/apps/mobile/src/features/applications-board/views.tsx
+++ b/apps/mobile/src/features/applications-board/views.tsx
@@ -24,12 +24,14 @@ export function ApplicationsViewFrame({ current, children, search, actions }: Ap
const shared = useApplicationSearch();
const [adding, setAdding] = useState(false);
const { t } = useLingui();
- const { colors, space } = useTheme();
+ const { colors, motion, space } = useTheme();
const insets = useSafeAreaInsets();
return (
<SafeAreaView edges={["top", "left", "right"]} style={{ flex: 1, backgroundColor: colors.bg }}>
- {/* Views swap in place: no push animation, no back stack between them. Shared title stays above the view tabs. */}
- <Stack.Screen options={{ title: t`Applications`, animation: "none", headerShown: false }} />
+ {/* Views swap in place with a crossfade: no back stack between them. Shared title stays above the view tabs. */}
+ <Stack.Screen
+ options={{ title: t`Applications`, animation: "fade", animationDuration: motion.d2, headerShown: false }}
+ />
<View style={{ paddingHorizontal: space.s4, paddingTop: space.s4, paddingBottom: space.s1, gap: space.s3 }}>
<CollectionHeader
title={t`Applications`}
diff --git a/apps/mobile/src/features/applications/list-screen.tsx b/apps/mobile/src/features/applications/list-screen.tsx
index 2e7275424..be86a9867 100644
--- a/apps/mobile/src/features/applications/list-screen.tsx
+++ b/apps/mobile/src/features/applications/list-screen.tsx
@@ -4,6 +4,7 @@ import { useLingui } from "@lingui/react/macro";
import { useRouter } from "expo-router";
import { useRef, useState } from "react";
import { RefreshControl, Pressable, SectionList, View } from "react-native";
+import Animated from "react-native-reanimated";
import { AddApplicationSheet } from "./add-sheet";
import { applicationError } from "./error";
import { filterApplications, groupApplications, visibleSelection } from "./list";
@@ -29,6 +30,8 @@ import {
Switch,
Text,
TextField,
+ listItemMotion,
+ useFirstAppearance,
useTheme,
} from "@/ui";
import { usePullRefresh } from "@/ui/use-pull-refresh";
@@ -54,6 +57,7 @@ function ApplicationsList() {
const { colors, space, radius, size } = useTheme();
const query = useApplications();
const pull = usePullRefresh(query.refetch);
+ const firstAppearance = useFirstAppearance(!query.isPending);
const { timeZone } = useUserTime();
const { bulkUpdate, bulkDelete } = useApplicationMutations();
const { search, setSearch } = useApplicationSearch();
@@ -329,10 +333,11 @@ function ApplicationsList() {
/>
</Pressable>
)}
- renderItem={({ item }) => {
+ renderItem={({ item, index }) => {
const next = describeNextStep(getNextStep(item), item, i18n.locale, timeZone);
return (
- <View
+ <Animated.View
+ {...listItemMotion(index, firstAppearance)}
style={{
borderBottomWidth: 1,
borderBottomColor: colors.line,
@@ -360,7 +365,7 @@ function ApplicationsList() {
setSelecting(true);
}}
/>
- </View>
+ </Animated.View>
);
}}
/>
diff --git a/apps/mobile/src/features/career/facts.tsx b/apps/mobile/src/features/career/facts.tsx
index 85b6b21be..b7c74ae8c 100644
--- a/apps/mobile/src/features/career/facts.tsx
+++ b/apps/mobile/src/features/career/facts.tsx
@@ -6,10 +6,26 @@ import { useLingui } from "@lingui/react/macro";
import * as Crypto from "expo-crypto";
import { useRef, useState } from "react";
import { View } from "react-native";
+import Animated from "react-native-reanimated";
import { client, useCareerAction, useCareerQueries, useCareerTime, useUndoRows } from "./hooks";
import { Actions, EditorSheet, LoadState, SwitchRow } from "./shared";
import { getServer, useSession } from "@/auth/session";
-import { Banner, Button, Card, Chip, EmptyState, SelectSheet, Sheet, Text, TextArea, TextField, useTheme } from "@/ui";
+import {
+ Banner,
+ Button,
+ Card,
+ Chip,
+ EmptyState,
+ SelectSheet,
+ Sheet,
+ Text,
+ TextArea,
+ TextField,
+ listItemMotion,
+ listLayout,
+ useFirstAppearance,
+ useTheme,
+} from "@/ui";
const categoryLabel = (category: string) =>
({ accomplishment: t`Accomplishment`, experience: t`Experience`, skill: t`Skill`, preference: t`Preference` })[
@@ -58,6 +74,7 @@ export function Facts() {
.toLocaleLowerCase()
.includes(search.trim().toLocaleLowerCase()),
);
+ const firstAppearance = useFirstAppearance(!facts.isPending);
return (
<View style={{ gap: space.s4 }}>
<TextField label={t`Search facts`} value={search} onChangeText={setSearch} />
@@ -75,46 +92,48 @@ export function Facts() {
{!facts.isPending && !facts.isError && !rows.length ? (
<EmptyState title={t`No facts match`} message={t`Add a fact or try another word or type.`} />
) : null}
- {rows.map((fact) => (
- <Card key={fact.id} style={{ gap: space.s3 }}>
- <Actions>
- <Chip label={categoryLabel(fact.category)} />
- <Chip label={fact.company ? t`${fact.company} only` : t`All applications`} />
- </Actions>
- <Text>{fact.text}</Text>
- <Text variant="callout" color="ink3">
- {fact.usedBy.stories + fact.usedBy.savedItems === 0
- ? t`Not used in a story or saved item yet`
- : `${plural(fact.usedBy.stories, { one: "Backs # story", other: "Backs # stories" })} · ${plural(fact.usedBy.savedItems, { one: "used in # saved item", other: "used in # saved items" })}`}
- </Text>
- <SwitchRow
- label={t`Use this fact`}
- value={fact.status === "active"}
- disabled={updating.includes(fact.id)}
- onValueChange={(active) => {
- void updateFact({ id: fact.id, status: active ? "active" : "excluded" });
- }}
- />
- <Actions>
- <Button variant="ghost" label={t`View source`} onPress={() => setSource(fact)} />
- <Button variant="ghost" label={t`Correct`} onPress={() => setEditor({ fact })} />
- {fact.applicationId ? (
+ {rows.map((fact, index) => (
+ <Animated.View key={fact.id} {...listItemMotion(index, firstAppearance)} layout={listLayout}>
+ <Card style={{ gap: space.s3 }}>
+ <Actions>
+ <Chip label={categoryLabel(fact.category)} />
+ <Chip label={fact.company ? t`${fact.company} only` : t`All applications`} />
+ </Actions>
+ <Text>{fact.text}</Text>
+ <Text variant="callout" color="ink3">
+ {fact.usedBy.stories + fact.usedBy.savedItems === 0
+ ? t`Not used in a story or saved item yet`
+ : `${plural(fact.usedBy.stories, { one: "Backs # story", other: "Backs # stories" })} · ${plural(fact.usedBy.savedItems, { one: "used in # saved item", other: "used in # saved items" })}`}
+ </Text>
+ <SwitchRow
+ label={t`Use this fact`}
+ value={fact.status === "active"}
+ disabled={updating.includes(fact.id)}
+ onValueChange={(active) => {
+ void updateFact({ id: fact.id, status: active ? "active" : "excluded" });
+ }}
+ />
+ <Actions>
+ <Button variant="ghost" label={t`View source`} onPress={() => setSource(fact)} />
+ <Button variant="ghost" label={t`Correct`} onPress={() => setEditor({ fact })} />
+ {fact.applicationId ? (
+ <Button
+ variant="ghost"
+ label={t`Use for all applications`}
+ disabled={updating.includes(fact.id)}
+ onPress={() => {
+ void updateFact({ id: fact.id, share: true });
+ }}
+ />
+ ) : null}
<Button
variant="ghost"
- label={t`Use for all applications`}
- disabled={updating.includes(fact.id)}
- onPress={() => {
- void updateFact({ id: fact.id, share: true });
- }}
+ label={t`Forget`}
+ onPress={() => undo.remove(fact.id, t`Fact forgotten`, () => client.career.forgetFact({ id: fact.id }))}
/>
- ) : null}
- <Button
- variant="ghost"
- label={t`Forget`}
- onPress={() => undo.remove(fact.id, t`Fact forgotten`, () => client.career.forgetFact({ id: fact.id }))}
- />
- </Actions>
- </Card>
+ </Actions>
+ </Card>
+ </Animated.View>
))}
{editor ? <FactEditor key={editor.fact?.id ?? "new"} fact={editor.fact} onClose={() => setEditor(null)} /> : null}
<Sheet open={!!source} onClose={() => setSource(null)} title={t`Source and correction history`} detents={[0.75]}>
diff --git a/apps/mobile/src/features/career/stories.tsx b/apps/mobile/src/features/career/stories.tsx
index 14a8e5a9f..594e6a338 100644
--- a/apps/mobile/src/features/career/stories.tsx
+++ b/apps/mobile/src/features/career/stories.tsx
@@ -4,10 +4,24 @@ import { t } from "@lingui/core/macro";
import { useLingui } from "@lingui/react/macro";
import { useState } from "react";
import { View } from "react-native";
+import Animated from "react-native-reanimated";
import { careerStoryInputSchema } from "@reactive-resume/schema/career";
import { client, useCareerAction, useCareerQueries, useUndoRows } from "./hooks";
import { Actions, EditorSheet, LoadState, SwitchRow } from "./shared";
-import { Banner, Button, Card, ChipInput, EmptyState, Text, TextArea, TextField, useTheme } from "@/ui";
+import {
+ Banner,
+ Button,
+ Card,
+ ChipInput,
+ EmptyState,
+ Text,
+ TextArea,
+ TextField,
+ listItemMotion,
+ listLayout,
+ useFirstAppearance,
+ useTheme,
+} from "@/ui";
const parts = () =>
[
@@ -24,6 +38,7 @@ export function Stories() {
const [editor, setEditor] = useState<{ story: Story | null } | null>(null);
const undo = useUndoRows();
const rows = (stories.data ?? []).filter((row) => !undo.hidden.includes(row.id));
+ const firstAppearance = useFirstAppearance(!stories.isPending);
return (
<View style={{ gap: space.s4 }}>
<Text color="ink3">{t`Situation, Task, Action, Result, Reflection. Link each story to facts you can support; leave unknown outcomes blank.`}</Text>
@@ -33,40 +48,42 @@ export function Stories() {
{!stories.isError && !stories.isPending && !rows.length ? (
<EmptyState title={t`No stories yet`} message={t`Write one about something you did, in five parts.`} />
) : null}
- {rows.map((story) => {
+ {rows.map((story, index) => {
const changed = story.data.factIds.some((id) => {
const fact = facts.data?.find((row) => row.id === id);
const revision = fact?.revisions.at(-1);
return !fact || fact.status !== "active" || (revision && new Date(revision.at) > new Date(story.updatedAt));
});
return (
- <Card key={story.id} style={{ gap: space.s3 }}>
- <Text variant="title">{story.data.title}</Text>
- {changed ? <Banner tone="warn" message={t`A fact changed. Review this story.`} /> : null}
- {parts().map((part) => (
- <View key={part.key}>
- <Text variant="label">{part.label}</Text>
- <Text>{story.data[part.key] || t`Not recorded yet. Leave blank until you can support it.`}</Text>
- </View>
- ))}
- <Text variant="label">{t`Backed by`}</Text>
- {story.data.factIds.map((id) => (
- <Text key={id} color="ink2">
- {facts.data?.find((row) => row.id === id)?.text ?? t`Fact no longer available`}
- </Text>
- ))}
- <Text color="ink3">{story.data.tags.join(" · ")}</Text>
- <Actions>
- <Button label={t`Edit`} variant="secondary" onPress={() => setEditor({ story })} />
- <Button
- label={t`Delete story`}
- variant="ghost"
- onPress={() =>
- undo.remove(story.id, t`Story deleted`, () => client.career.deleteStory({ id: story.id }))
- }
- />
- </Actions>
- </Card>
+ <Animated.View key={story.id} {...listItemMotion(index, firstAppearance)} layout={listLayout}>
+ <Card style={{ gap: space.s3 }}>
+ <Text variant="title">{story.data.title}</Text>
+ {changed ? <Banner tone="warn" message={t`A fact changed. Review this story.`} /> : null}
+ {parts().map((part) => (
+ <View key={part.key}>
+ <Text variant="label">{part.label}</Text>
+ <Text>{story.data[part.key] || t`Not recorded yet. Leave blank until you can support it.`}</Text>
+ </View>
+ ))}
+ <Text variant="label">{t`Backed by`}</Text>
+ {story.data.factIds.map((id) => (
+ <Text key={id} color="ink2">
+ {facts.data?.find((row) => row.id === id)?.text ?? t`Fact no longer available`}
+ </Text>
+ ))}
+ <Text color="ink3">{story.data.tags.join(" · ")}</Text>
+ <Actions>
+ <Button label={t`Edit`} variant="secondary" onPress={() => setEditor({ story })} />
+ <Button
+ label={t`Delete story`}
+ variant="ghost"
+ onPress={() =>
+ undo.remove(story.id, t`Story deleted`, () => client.career.deleteStory({ id: story.id }))
+ }
+ />
+ </Actions>
+ </Card>
+ </Animated.View>
);
})}
{editor && facts.data ? (
diff --git a/apps/mobile/src/features/career/today.tsx b/apps/mobile/src/features/career/today.tsx
index 2f0f443aa..690f6e726 100644
--- a/apps/mobile/src/features/career/today.tsx
+++ b/apps/mobile/src/features/career/today.tsx
@@ -5,6 +5,7 @@ import { useRouter } from "expo-router";
import { openBrowserAsync } from "expo-web-browser";
import { type ComponentRef, useRef, useState } from "react";
import { RefreshControl, ScrollView, View } from "react-native";
+import Animated from "react-native-reanimated";
import { client, useCareerAction, useCareerTime, useNow, useTodayQueries, useUndoRows } from "./hooks";
import { ScheduleSheet, scheduleTitle } from "./schedule-sheet";
import { collectInterviews, rollForward } from "./scheduling";
@@ -13,7 +14,20 @@ import { getNextStep } from "@/features/applications/next-step";
import { useApplications } from "@/features/applications/queries";
import { getStageLabel } from "@/features/applications/stages";
import { routes } from "@/routes";
-import { Banner, Button, Card, Chip, EmptyState, Screen, Text, showToast, useTheme } from "@/ui";
+import {
+ Banner,
+ Button,
+ Card,
+ Chip,
+ EmptyState,
+ Screen,
+ Text,
+ listItemMotion,
+ listLayout,
+ showToast,
+ useFirstAppearance,
+ useTheme,
+} from "@/ui";
import { usePullRefresh } from "@/ui/use-pull-refresh";
export function TodayScreen() {
@@ -53,6 +67,7 @@ export function TodayScreen() {
const notes = (queries.notifications.data ?? []).filter(
(row) => showRead || (!row.readAt && !undo.hidden.includes(row.id)),
);
+ const firstAppearance = useFirstAppearance(!queries.notifications.isPending);
const openSchedule = (schedule: Schedule) =>
setSheet({ schedule, kind: schedule.kind as "discovery" | "prepare" | "follow-up" });
const toggle = (row: Schedule, enabled: boolean) => {
@@ -149,59 +164,61 @@ export function TodayScreen() {
message={t`New roles, reminders and finished briefings appear here.`}
/>
) : null}
- {notes.map((row) => (
- <Card key={row.id} style={{ gap: space.s3 }}>
- <Text variant="title">{row.title}</Text>
- <Text>{row.body}</Text>
- <Text variant="caption" color="ink3">
- {time.when(row.createdAt)}
- </Text>
- <Actions>
- {row.notice.type === "opportunities" ? (
- <Button
- label={t`Review`}
- variant="secondary"
- onPress={() => {
- setExpanded(true);
- scroll.current?.scrollTo({
- y: groupY.current + columnY.current + rolesY.current,
- animated: false,
- });
- }}
- />
- ) : row.applicationId ? (
- <Button
- label={row.notice.type === "briefing" ? t`Open briefing` : t`Open workspace`}
- variant="secondary"
- onPress={() =>
- router.push(
- routes.application(
- row.applicationId ?? "",
- row.notice.type === "briefing" ? "prepare" : "messages",
- ),
- )
- }
- />
- ) : (
- <Button
- label={t`Open settings`}
- variant="secondary"
- onPress={() => router.push(routes.settings("ai"))}
- />
- )}
- {!row.readAt && !undo.hidden.includes(row.id) ? (
- <Button
- label={t`Mark as read`}
- variant="ghost"
- onPress={() =>
- undo.remove(row.id, t`Marked as read`, () =>
- client.career.markNotificationRead({ id: row.id }),
- )
- }
- />
- ) : null}
- </Actions>
- </Card>
+ {notes.map((row, index) => (
+ <Animated.View key={row.id} {...listItemMotion(index, firstAppearance)} layout={listLayout}>
+ <Card style={{ gap: space.s3 }}>
+ <Text variant="title">{row.title}</Text>
+ <Text>{row.body}</Text>
+ <Text variant="caption" color="ink3">
+ {time.when(row.createdAt)}
+ </Text>
+ <Actions>
+ {row.notice.type === "opportunities" ? (
+ <Button
+ label={t`Review`}
+ variant="secondary"
+ onPress={() => {
+ setExpanded(true);
+ scroll.current?.scrollTo({
+ y: groupY.current + columnY.current + rolesY.current,
+ animated: false,
+ });
+ }}
+ />
+ ) : row.applicationId ? (
+ <Button
+ label={row.notice.type === "briefing" ? t`Open briefing` : t`Open workspace`}
+ variant="secondary"
+ onPress={() =>
+ router.push(
+ routes.application(
+ row.applicationId ?? "",
+ row.notice.type === "briefing" ? "prepare" : "messages",
+ ),
+ )
+ }
+ />
+ ) : (
+ <Button
+ label={t`Open settings`}
+ variant="secondary"
+ onPress={() => router.push(routes.settings("ai"))}
+ />
+ )}
+ {!row.readAt && !undo.hidden.includes(row.id) ? (
+ <Button
+ label={t`Mark as read`}
+ variant="ghost"
+ onPress={() =>
+ undo.remove(row.id, t`Marked as read`, () =>
+ client.career.markNotificationRead({ id: row.id }),
+ )
+ }
+ />
+ ) : null}
+ </Actions>
+ </Card>
+ </Animated.View>
))}
<Button
variant="ghost"
diff --git a/apps/mobile/src/features/documents/library.tsx b/apps/mobile/src/features/documents/library.tsx
index 877b54ecc..21beda2c2 100644
--- a/apps/mobile/src/features/documents/library.tsx
+++ b/apps/mobile/src/features/documents/library.tsx
@@ -7,17 +7,9 @@ import { useQuery } from "@tanstack/react-query";
import { impactAsync, ImpactFeedbackStyle } from "expo-haptics";
import { useRouter, Stack, useFocusEffect } from "expo-router";
import { useCallback, useState } from "react";
-import {
- RefreshControl,
- FlatList,
- I18nManager,
- Platform,
- Pressable,
- ScrollView,
- View,
- useWindowDimensions,
-} from "react-native";
+import { RefreshControl, I18nManager, Platform, Pressable, ScrollView, View, useWindowDimensions } from "react-native";
import ReanimatedSwipeable from "react-native-gesture-handler/ReanimatedSwipeable";
+import Animated from "react-native-reanimated";
import { DocumentSheets } from "./document-sheets";
import { collectTags, daysLeftInTrash, documentKey, documentRef, filterDocuments } from "./filter";
import { isNewDocument, useNewDocuments } from "./new-documents";
@@ -43,6 +35,9 @@ import {
Sheet,
Skeleton,
Text,
+ listItemMotion,
+ listLayout,
+ useFirstAppearance,
useTheme,
} from "@/ui";
import { usePullRefresh } from "@/ui/use-pull-refresh";
@@ -200,6 +195,7 @@ export function DocumentsLibrary({ trashed = false }: DocumentsLibraryProps) {
? []
: pending.filter((document) => !all.some((saved) => documentKey(saved) === documentKey(document)));
const filtered = filterDocuments(all, { q, type, tags, sort, public: publicOnly });
+ const firstAppearance = useFirstAppearance(filtered.length > 0);
const selected = filtered.filter((document) => selection.includes(documentKey(document)));
const { refetch: refetchDocuments } = documents;
const { refetch: refetchCounts } = counts;
@@ -419,7 +415,7 @@ export function DocumentsLibrary({ trashed = false }: DocumentsLibraryProps) {
onLayout={(event) => setWidth(event.nativeEvent.layout.width - space.s4 * 2)}
>
<Stack.Screen options={{ title: trashed ? t`Trash` : t`Documents`, headerShown: false }} />
- <FlatList
+ <Animated.FlatList
key={columns}
data={session.status === "signed-in" ? filtered : []}
ListHeaderComponent={header}
@@ -433,8 +429,13 @@ export function DocumentsLibrary({ trashed = false }: DocumentsLibraryProps) {
keyboardShouldPersistTaps="handled"
contentContainerStyle={{ gap: space.s3, paddingBottom: space.s4 }}
columnWrapperStyle={columns > 1 ? { gap: space.s3 } : undefined}
- renderItem={({ item }) => (
- <View style={{ flex: 1, maxWidth: Math.max(0, (width - space.s3 * (columns - 1)) / columns) }}>
+ // Reanimated's item layout animation supports one column only.
+ {...(columns === 1 ? { itemLayoutAnimation: listLayout } : {})}
+ renderItem={({ item, index }) => (
+ <Animated.View
+ {...listItemMotion(index, firstAppearance)}
+ style={{ flex: 1, maxWidth: Math.max(0, (width - space.s3 * (columns - 1)) / columns) }}
+ >
<DocumentItem
document={item}
visible={visible.includes(documentKey(item))}
@@ -449,7 +450,7 @@ export function DocumentsLibrary({ trashed = false }: DocumentsLibraryProps) {
onTrash={() => void operations.trash([item])}
onDuplicate={() => void duplicate(item)}
/>
- </View>
+ </Animated.View>
)}
ListEmptyComponent={
session.status !== "signed-in" ? (
diff --git a/apps/mobile/src/features/settings/api-keys.tsx b/apps/mobile/src/features/settings/api-keys.tsx
index f12f72b28..827c4c9e9 100644
--- a/apps/mobile/src/features/settings/api-keys.tsx
+++ b/apps/mobile/src/features/settings/api-keys.tsx
@@ -1,11 +1,22 @@
import { useLingui } from "@lingui/react/macro";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
+import Animated from "react-native-reanimated";
import { openAccountSettings } from "./browser";
import { SettingsGroup } from "./layout";
import { client, orpc } from "@/api/client";
import { useSession } from "@/auth/session";
-import { Banner, ConfirmDialog, EmptyState, ListRow, Text, showToast } from "@/ui";
+import {
+ Banner,
+ ConfirmDialog,
+ EmptyState,
+ ListRow,
+ Text,
+ listItemMotion,
+ listLayout,
+ showToast,
+ useFirstAppearance,
+} from "@/ui";
type ApiKeysProps = { userId: string };
export function ApiKeys({ userId }: ApiKeysProps) {
@@ -16,6 +27,7 @@ export function ApiKeys({ userId }: ApiKeysProps) {
const keys = useQuery(
orpc.auth.apiKeys.list.queryOptions({ queryKey: [...orpc.auth.apiKeys.list.key(), server, userId], retry: false }),
);
+ const firstAppearance = useFirstAppearance(!keys.isPending);
const revoke = useMutation({
mutationKey: ["settings", "revoke-key"],
mutationFn: async (keyId: string) => {
@@ -56,17 +68,18 @@ export function ApiKeys({ userId }: ApiKeysProps) {
/>
) : null}
{keys.data?.apiKeys.length === 0 ? <EmptyState title={t`No keys yet.`} /> : null}
- {keys.data?.apiKeys.map((key) => (
- <ListRow
- key={key.id}
- title={key.name ?? t`Unnamed key`}
- subtitle={t`Created ${date(key.createdAt)} · Last used ${date(key.lastRequest)} · Expires ${date(key.expiresAt)}`}
- leading="key"
- trailing={<Text color="dangerText">{t`Revoke`}</Text>}
- accessibilityHint={t`Revoke this API key`}
- disabled={revoke.isPending}
- onPress={() => setSelected({ id: key.id, name: key.name ?? t`Unnamed key` })}
- />
+ {keys.data?.apiKeys.map((key, index) => (
+ <Animated.View key={key.id} {...listItemMotion(index, firstAppearance)} layout={listLayout}>
+ <ListRow
+ title={key.name ?? t`Unnamed key`}
+ subtitle={t`Created ${date(key.createdAt)} · Last used ${date(key.lastRequest)} · Expires ${date(key.expiresAt)}`}
+ leading="key"
+ trailing={<Text color="dangerText">{t`Revoke`}</Text>}
+ accessibilityHint={t`Revoke this API key`}
+ disabled={revoke.isPending}
+ onPress={() => setSelected({ id: key.id, name: key.name ?? t`Unnamed key` })}
+ />
+ </Animated.View>
))}
<ConfirmDialog
open={selected !== null}
diff --git a/apps/mobile/src/shell/app-tabs.tsx b/apps/mobile/src/shell/app-tabs.tsx
index 2be36245c..301d618c7 100644
--- a/apps/mobile/src/shell/app-tabs.tsx
+++ b/apps/mobile/src/shell/app-tabs.tsx
@@ -3,11 +3,19 @@ import type { BottomTabBarProps } from "expo-router/tabs";
import type { ReactNode } from "react";
import { useLingui } from "@lingui/react/macro";
import { useRouter, usePathname } from "expo-router";
+import { Children, useEffect, useState } from "react";
import { I18nManager, Platform, Pressable, ScrollView, View, useWindowDimensions } from "react-native";
import { useKeyboardState } from "react-native-keyboard-controller";
+import Animated, {
+ useAnimatedStyle,
+ useSharedValue,
+ withSequence,
+ withSpring,
+ withTiming,
+} from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { routes } from "@/routes";
-import { Button, Icon, IconButton, Text, haptics, useTheme } from "@/ui";
+import { Button, Icon, IconButton, Text, haptics, useReducedMotion, useTheme } from "@/ui";
/** The tab routes of `app/(tabs)`, in tab-bar order. `create` is the raised "+" that opens New. */
const appTabIcons: Record<string, IconName> = {
@@ -17,9 +25,11 @@ const appTabIcons: Record<string, IconName> = {
settings: "gear-six",
};
-// tokens.md §7: the iOS active-tab marker and the Android active-tab pill; Android tab cells are 64 tall (app.html).
-const iosMarker = { width: 28, height: 3 };
-const androidPill = { width: 56, height: 30 };
+// tokens.md §7: the active-tab marker on the bar's top rule; Android tab cells are 64 tall (app.html).
+const railMarker = { width: 28, height: 3 };
+// The edge moving toward the new tab arrives first; the other catches up with a little overshoot, so the marker stretches.
+const leadingEdge = { duration: 260, dampingRatio: 0.8 };
+const trailingEdge = { duration: 420, dampingRatio: 0.62 };
const androidTabHeight = 64;
const badgeMinWidth = 18;
@@ -41,7 +51,11 @@ const tabLabel = ({ descriptors }: BottomTabBarProps, route: TabRoute) => {
return typeof tabBarLabel === "string" ? tabBarLabel : (title ?? route.name);
};
-const tabBadge = ({ descriptors }: BottomTabBarProps, route: TabRoute) => descriptors[route.key]?.options.tabBarBadge;
+/** A count of 0 shows nothing, like the web sidebar. */
+const tabBadge = ({ descriptors }: BottomTabBarProps, route: TabRoute) => {
+ const badge = descriptors[route.key]?.options.tabBarBadge;
+ return badge === 0 || badge === "0" ? undefined : badge;
+};
/** `quiet`: a grey count. `accent`: unread. `warn`: open issues on Check. */
type BadgeTone = "quiet" | "accent" | "warn";
@@ -65,7 +79,7 @@ function TabBadge({ value, tone }: BadgeProps) {
position: "absolute",
top: -space.s1,
// Just past the middle of the icon cell (app.html: left 50% + 6px).
- start: (Platform.OS === "android" ? androidPill.width : size.icon.bar) / 2 + space.s1,
+ start: size.icon.bar / 2 + space.s1,
minWidth: badgeMinWidth,
paddingHorizontal: space.s1,
borderRadius: radius.rPill,
@@ -106,7 +120,7 @@ export function BarItem({ label, icon, focused, onPress, badge, badgeTone = "acc
if (icon && !focused) haptics.selection();
onPress();
}}
- android_ripple={{ color: colors.press, borderless: true }}
+ android_ripple={{ color: colors.press, borderless: false }}
style={({ pressed }) => ({
flex: 1,
minHeight: android ? androidTabHeight : size.tabBar,
@@ -118,28 +132,8 @@ export function BarItem({ label, icon, focused, onPress, badge, badgeTone = "acc
backgroundColor: pressed && !android ? colors.press : "transparent",
})}
>
- {focused && !android ? (
- <View
- style={{
- position: "absolute",
- top: 0,
- ...iosMarker,
- borderBottomStartRadius: iosMarker.height,
- borderBottomEndRadius: iosMarker.height,
- backgroundColor: colors.accent,
- }}
- />
- ) : null}
{icon ? (
- <View
- style={{
- ...(android ? androidPill : null),
- borderRadius: radius.rPill,
- alignItems: "center",
- justifyContent: "center",
- backgroundColor: focused && android ? colors.accentSoft : "transparent",
- }}
- >
+ <View style={{ alignItems: "center", justifyContent: "center" }}>
<Icon name={icon} filled={focused} color={focused ? colors.ink : colors.ink2} size={size.icon.bar} />
{badge === undefined ? null : <TabBadge value={badge} tone={badgeTone} />}
</View>
@@ -163,15 +157,80 @@ export function BarItem({ label, icon, focused, onPress, badge, badgeTone = "acc
);
}
+type RailMarkerProps = {
+ index: number;
+ count: number;
+ /** The width of the row of cells. */
+ width: number;
+};
+
+/** The `accent` marker on the bar's top rule, over the focused cell. Its two edges spring separately, so it stretches. */
+function RailMarker({ index, count, width }: RailMarkerProps) {
+ const { colors, motion } = useTheme();
+ const reduced = useReducedMotion();
+ const cell = width / count;
+ // Cells are equal `flex: 1`; in RTL the row runs right to left but translateX does not.
+ const slot = I18nManager.isRTL ? count - 1 - index : index;
+ const target = slot * cell + (cell - railMarker.width) / 2;
+ const left = useSharedValue(target);
+ const right = useSharedValue(target + railMarker.width);
+ const opacity = useSharedValue(1);
+
+ useEffect(() => {
+ const end = target + railMarker.width;
+ if (reduced) {
+ // No stretch or travel: jump, then fade in.
+ left.set(target);
+ right.set(end);
+ opacity.set(withSequence(withTiming(0, { duration: 0 }), withTiming(1, { duration: motion.d1 })));
+ return;
+ }
+ // Springs start from where the marker is now, so a tap mid-flight retargets instead of restarting.
+ const forward = target > left.get();
+ left.set(withSpring(target, forward ? trailingEdge : leadingEdge));
+ right.set(withSpring(end, forward ? leadingEdge : trailingEdge));
+ }, [target, reduced, left, right, opacity, motion.d1]);
+
+ const style = useAnimatedStyle(() => ({
+ opacity: opacity.get(),
+ // Absolute and childless, so animating width costs no sibling layout.
+ width: Math.max(right.get() - left.get(), railMarker.height),
+ transform: [{ translateX: left.get() }],
+ }));
+
+ return (
+ <Animated.View
+ pointerEvents="none"
+ style={[
+ {
+ position: "absolute",
+ // Sits on the bar's 1 pt top rule.
+ top: -1,
+ left: 0,
+ height: railMarker.height,
+ borderBottomLeftRadius: railMarker.height,
+ borderBottomRightRadius: railMarker.height,
+ backgroundColor: colors.accent,
+ },
+ style,
+ ]}
+ />
+ );
+}
+
type BarProps = {
children: ReactNode;
+ /** The focused cell, marked on the top rule. Omit for no marker. */
+ activeIndex?: number | undefined;
};
/** A bottom bar on `surface` with a top rule, padding the bottom and side safe areas. Hidden while the keyboard is up. */
-export function Bar({ children }: BarProps) {
+export function Bar({ children, activeIndex }: BarProps) {
const insets = useSafeAreaInsets();
const { colors } = useTheme();
const keyboardVisible = useKeyboardState((keyboard) => keyboard.isVisible);
+ const [width, setWidth] = useState(0);
+ const count = Children.count(children);
if (keyboardVisible) return null;
@@ -188,14 +247,19 @@ export function Bar({ children }: BarProps) {
borderTopColor: colors.line,
}}
>
- {children}
+ <View style={{ flex: 1, flexDirection: "row" }} onLayout={(event) => setWidth(event.nativeEvent.layout.width)}>
+ {children}
+ {activeIndex !== undefined && activeIndex >= 0 && width > 0 && count > 0 ? (
+ <RailMarker index={activeIndex} count={count} width={width} />
+ ) : null}
+ </View>
</View>
);
}
/**
- * The phone tab bar (app.html): five cells, the active tab with a filled icon plus an `accent` 28×3 marker on iOS or
- * an `accentSoft` pill on Android, and the raised "+" pill in the middle. Labels stay under the icons at every text
+ * The phone tab bar (app.html): five cells, the active tab with a filled icon and the `accent` 28×3 marker on the top
+ * rule (both platforms), and the raised "+" pill in the middle. Labels stay under the icons at every text
* size (`micro` caps its scale); the bar grows taller instead of truncating.
*/
export function PhoneTabBar(props: BottomTabBarProps) {
@@ -203,7 +267,7 @@ export function PhoneTabBar(props: BottomTabBarProps) {
const onPress = useTabPress(props);
return (
- <Bar>
+ <Bar activeIndex={props.state.index}>
{props.state.routes.map((route, index) => (
<BarItem
key={route.key}
diff --git a/apps/mobile/src/shell/builder-chrome.tsx b/apps/mobile/src/shell/builder-chrome.tsx
index d8be2d50e..723a16138 100644
--- a/apps/mobile/src/shell/builder-chrome.tsx
+++ b/apps/mobile/src/shell/builder-chrome.tsx
@@ -5,7 +5,7 @@ import type { ReactNode } from "react";
import { useLingui } from "@lingui/react/macro";
import { useRouter, Stack, useNavigation, useSegments } from "expo-router";
import { createContext, use, useEffect, useState } from "react";
-import { ActivityIndicator, Platform, Pressable, View } from "react-native";
+import { ActivityIndicator, I18nManager, Platform, Pressable, View } from "react-native";
import { KeyboardAvoidingView } from "react-native-keyboard-controller";
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
import { AppStrip } from "./app-banner";
@@ -15,7 +15,7 @@ import { createSlot } from "./slot";
import { TopBar } from "./top-bar";
import { useIsTablet } from "./use-is-tablet";
import { routes } from "@/routes";
-import { Button, Icon, IconButton, Segmented, Text, useTheme } from "@/ui";
+import { Button, Icon, IconButton, Segmented, Text, useReducedMotion, useTheme } from "@/ui";
export type SaveStatusSlot = {
status: SaveStatus;
@@ -116,6 +116,7 @@ function Frame<T extends string>({ panes, tabletPanes, page, title, onShare, mod
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const { colors, size } = useTheme();
+ const reduced = useReducedMotion();
const current = useSegments().at(-1);
const currentPane = panes.find(({ pane }) => pane === current);
// The pane under a pushed screen or modal, so the switch and tabs keep showing it.
@@ -130,8 +131,13 @@ function Frame<T extends string>({ panes, tabletPanes, page, title, onShare, mod
if (redirect) router.replace(redirect.href);
}, [redirect, router]);
+ // Panes slide in from the side of the tab that was tapped, like a pager; set before each switch.
+ const [paneAnimation, setPaneAnimation] = useState<"slide_from_right" | "slide_from_left">("slide_from_right");
+
const switchPane = (next: PaneTab<T>) => {
if (next.pane === currentPane?.pane) return;
+ const after = panes.indexOf(next) > panes.findIndex(({ pane }) => pane === activePane?.pane);
+ setPaneAnimation(after !== I18nManager.isRTL ? "slide_from_right" : "slide_from_left");
if (!currentPane && activePane) router.dismissTo(activePane.href);
router.replace(next.href);
};
@@ -195,13 +201,11 @@ function Frame<T extends string>({ panes, tabletPanes, page, title, onShare, mod
}
>
<Stack
- screenOptions={({ route }) =>
- paneNames.has(route.name)
- ? tablet
- ? { headerShown: false, animation: "none" }
- : { header: () => <ChromeTopBar />, animation: "none" }
- : { headerTransparent: false }
- }
+ screenOptions={({ route }) => {
+ if (!paneNames.has(route.name)) return { headerTransparent: false };
+ const animation = reduced ? "fade" : paneAnimation;
+ return tablet ? { headerShown: false, animation } : { header: () => <ChromeTopBar />, animation };
+ }}
>
{modals.map((name) => (
<Stack.Screen
@@ -270,7 +274,7 @@ function PaneBar<T extends string>({ panes, active, onSwitch }: PaneBarProps<T>)
const slots = slot.useSlot();
return (
- <Bar>
+ <Bar activeIndex={panes.findIndex(({ pane }) => pane === active)}>
{panes.map((pane) => (
<BarItem
key={pane.pane}
diff --git a/apps/mobile/src/ui/index.ts b/apps/mobile/src/ui/index.ts
index 5eddcb22a..958c5d96b 100644
--- a/apps/mobile/src/ui/index.ts
+++ b/apps/mobile/src/ui/index.ts
@@ -50,7 +50,7 @@ export {
type ToastOptions,
} from "./overlays";
export { SortableList, type SortableItemInfo, type SortableListProps } from "./sortable";
-export { haptics, useReducedMotion } from "./motion";
+export { haptics, listItemMotion, listLayout, useFirstAppearance, useReducedMotion } from "./motion";
export { usePullRefresh } from "./use-pull-refresh";
export { Screen, Text, type ScreenProps, type TextProps, type TextVariant } from "./text";
export { WindowSafeAreaProvider, useWindowSafeAreaInsets } from "./safe-area";
diff --git a/apps/mobile/src/ui/motion.ts b/apps/mobile/src/ui/motion.ts
index 00c5d8fb3..a99e580ec 100644
--- a/apps/mobile/src/ui/motion.ts
+++ b/apps/mobile/src/ui/motion.ts
@@ -1,8 +1,9 @@
// Reduced motion, haptics and the tablet check shared by the primitives (tokens.md §6).
import * as Haptics from "expo-haptics";
-import { useSyncExternalStore } from "react";
+import { useEffect, useState, useSyncExternalStore } from "react";
import { AccessibilityInfo, useWindowDimensions } from "react-native";
-import { size } from "./tokens";
+import { Easing, FadeInDown, FadeOut, LinearTransition, ReduceMotion } from "react-native-reanimated";
+import { motion, size } from "./tokens";
let reduceMotion = false;
const listeners = new Set<() => void>();
@@ -49,3 +50,41 @@ export function useIsWide(): boolean {
const { width, height } = useWindowDimensions();
return Math.min(width, height) >= size.formSheet;
}
+
+// Shared list motion. Reanimated needs its own (worklet) easing, so these repeat the `motion.ease` and `motion.easeMove` curves.
+const listEase = Easing.bezier(0.2, 0.8, 0.2, 1);
+const listMove = Easing.bezier(0.77, 0, 0.175, 1);
+const listStagger = 40;
+const listStaggerCap = 8;
+
+/** A row fading in from 8 pt below its place, staggered by its index (capped at 8). Reduced motion: no movement. */
+const listEntering = (index: number) =>
+ FadeInDown.duration(motion.d2)
+ .easing(listEase)
+ .withInitialValues({ opacity: 0, transform: [{ translateY: 8 }] })
+ .delay(Math.min(index, listStaggerCap) * listStagger)
+ .reduceMotion(ReduceMotion.System);
+
+/** A removed row fades out, faster than it came in. */
+const listExiting = FadeOut.duration(motion.d1).reduceMotion(ReduceMotion.System);
+
+/** Spread on a row's `Animated.View`: staggers in on the screen's first appearance only, always fades out. */
+export const listItemMotion = (index: number, first: boolean) =>
+ first ? { entering: listEntering(index), exiting: listExiting } : { exiting: listExiting };
+
+/** Rows sliding into the gap a removed or moved row leaves. */
+export const listLayout = LinearTransition.duration(motion.d2).easing(listMove).reduceMotion(ReduceMotion.System);
+
+/**
+ * True until shortly after the list first shows data, so rows stagger in once when the screen opens and never again
+ * on scroll, refresh or filter changes.
+ */
+export function useFirstAppearance(ready: boolean): boolean {
+ const [first, setFirst] = useState(true);
+ useEffect(() => {
+ if (!ready || !first) return;
+ const timer = setTimeout(() => setFirst(false), 400);
+ return () => clearTimeout(timer);
+ }, [ready, first]);
+ return first;
+}