lukedj78/dev-flow / rn-expo-router
rn-expo-router
VerifiedUse when working with navigation in an Expo + React Native app: adding routes, building tab/stack/drawer layouts, modal routes, dynamic segments (e.g. /profile/[id]), typed routes, deep linking, search params. Triggers on: "add a route", "wire up tabs", "open as modal", "set up deep linking", "configure navigation", or whenever an agent is about to touch a file under app/. Not for: styling navigation chrome (rn-styling), animating transitions (rn-animations-gestures, Wave 3), or non-RN web routing.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.3 KB |
| references/concepts.md | markdown | 2.6 KB |
| references/decision-tree.md | markdown | 1.5 KB |
| references/deep-linking-setup.md | markdown | 1.6 KB |
| references/examples/.gitkeep | other | 0 B |
| references/examples/layout-with-tabs.tsx | other | 1021 B |
| references/examples/modal-route.tsx | other | 1.2 KB |
| references/examples/typed-search-params.tsx | other | 1.0 KB |
| references/patterns.md | markdown | 2.4 KB |
references/patterns.md
View on GitHub> Sources: docs.expo.dev/router/advanced, internal opinion.
# Patterns and anti-patterns — Expo Router
## Navigation
### DO
- ✅ `useRouter()` for imperative navigation:
```tsx
const router = useRouter();
router.push({ pathname: "/profile/[id]", params: { id: "abc" } });
router.back();
router.replace("/");
```
- ✅ `<Link>` for declarative:
```tsx
<Link href={{ pathname: "/profile/[id]", params: { id: "abc" } }}>View profile</Link>
```
- ✅ `useLocalSearchParams<T>()` for typed dynamic segment / query params.
### DON'T
- ❌ `useNavigation()` from `@react-navigation/native` — Expo Router has its own primitives.
- ❌ Raw-string `router.push('/profile/abc')` — typed routes catch typos.
- ❌ Multiple nested navigators when a group + single navigator would do.
## Modals
A modal is a screen with `presentation: 'modal'`. Live under any layout.
```tsx
// app/_layout.tsx
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="settings-modal" options={{ presentation: "modal" }} />
</Stack>
```
```tsx
// app/settings-modal.tsx
import { View, Text } from "react-native";
export default function SettingsModal() {
return <View><Text>Modal content</Text></View>;
}
```
Open via `router.push('/settings-modal')`.
## Auth gating
Pattern: protected group `(app)` with a `_layout.tsx` that redirects.
```tsx
// app/(app)/_layout.tsx
import { Redirect, Stack } from "expo-router";
import { useUser } from "@/lib/auth"; // your auth hook (see rn-backend Wave 3, provider-agnostic)
export default function ProtectedLayout() {
const user = useUser();
if (!user) return <Redirect href="/(auth)/sign-in" />;
return <Stack />;
}
```
## Search params
```tsx
import { useLocalSearchParams } from "expo-router";
type Params = { id: string; tab?: "info" | "posts" };
export default function Profile() {
const { id, tab = "info" } = useLocalSearchParams<Params>();
return <Text>{id} - {tab}</Text>;
}
```
For non-route screens that observe URL changes, use `useGlobalSearchParams` (re-renders on any change).
## Anti-patterns
- ❌ Putting `<Tabs.Screen>` inside the screen component instead of the layout — won't work, Tabs ignores it.
- ❌ Two `_layout.tsx` at the same level — only one is allowed per directory.
- ❌ Defining a route AND a group with the same name (`profile.tsx` + `(profile)/`) — collision.
- ❌ Using `window.location` for URL parsing — use `usePathname()` from expo-router.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |