# All navigable screens are properly registered in navigation stack/tab/drawer definitions

- **Pattern:** `ab-001853` (`mobile-navigation-linking.navigation-structure.screens-registered`)
- **Severity:** high
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-001853
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-001853)

## Why it matters

A screen that appears in the `linking` config but is not registered as `<Stack.Screen>` or `<Tab.Screen>` is a dangling reference — React Navigation logs a warning and refuses to navigate, so deep links, push-notification taps, and `navigation.navigate('X')` calls silently fail. Orphaned registrations with undefined components crash the tree on mount. The user sees a frozen button, a broken link, or a white screen with no recovery path.

## Severity rationale

High because unregistered screens break navigation for real users at runtime without producing a loud crash.

## Remediation

Register every screen named in the linking config inside the matching navigator. In your root navigator file, mirror each `config.screens` entry with a `<Stack.Screen>` using the exact same name:

```tsx
<Stack.Navigator>
  <Stack.Screen name="Home" component={HomeScreen} />
  <Stack.Screen name="ProductDetail" component={ProductDetailScreen} />
</Stack.Navigator>
```

Run a grep across the codebase for each screen name in `linking.config.screens` and confirm a `component` is bound.

## Detection

- **ID:** `screens-registered`
- **Severity:** `high`
- **What to look for:** Examine your navigation stack definitions (e.g., `<Stack.Navigator>`, `<Tab.Navigator>`). Every screen that appears in your `linking` config (the URL patterns mapped to routes) must have a corresponding `<Stack.Screen>` or `<Tab.Screen>` entry. Check for orphaned screen definitions or missing screen registrations.
- **Pass criteria:** Count all screen names in the linking config and all `<Stack.Screen>` or `<Tab.Screen>` registrations. Every navigable screen has a corresponding navigator entry with a valid `component` or `lazy` prop. No more than 0 screens in linking config should lack a corresponding Screen registration. Report even on pass: "Found X screen registrations matching Y linking config entries."
- **Fail criteria:** Screens are referenced in linking config but not registered as `<Stack.Screen>` entries. Orphaned screen definitions with no component assigned. Navigation structure is incomplete or inconsistent.
- **Skip (N/A) when:** Never — all screens must be registered.
- **Detail on fail:** List missing or orphaned screens. Example: `"Deep link config references 'ProductDetail' screen but it's not registered in any navigator"` or `"'Settings' screen is registered but component is undefined"`
- **Remediation:** Every screen referenced in your deep link config must be registered in your navigator:

  ```tsx
  <Stack.Navigator>
    <Stack.Screen name="Home" component={HomeScreen} />
    <Stack.Screen name="ProductDetail" component={ProductDetailScreen} />
    <Stack.Screen name="Settings" component={SettingsScreen} />
  </Stack.Navigator>
  ```

  Ensure the `name` in `<Stack.Screen>` matches exactly the screen name used in your linking config.

Taxons: reference-integrity, user-experience

HTML version: https://auditbuffet.com/patterns/ab-001853
