{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drawer-navigation",
  "title": "Drawer Navigation",
  "type": "registry:page",
  "files": [
    {
      "path": "packages/registry-native/blocks/drawer-navigation/_layout.tsx",
      "content": "import { useCanGoBack } from 'expo-router'\nimport {\n  Drawer,\n  DrawerContentScrollView,\n  DrawerItem,\n  DrawerItemList,\n  useDrawerProgress,\n  type DrawerContentComponentProps,\n} from 'expo-router/drawer'\nimport { Menu } from 'lucide-react-native'\nimport { useRef, type ComponentRef, type RefObject } from 'react'\nimport { AccessibilityInfo, Platform, Text } from 'react-native'\nimport { GestureHandlerRootView } from 'react-native-gesture-handler'\nimport { runOnJS, useAnimatedReaction, useSharedValue } from 'react-native-reanimated'\nimport { Button } from '@/components/ui/button'\nimport { useThemeColors } from '@/lib/theme'\n\ntype MenuButton = ComponentRef<typeof Button>\n\nfunction DrawerMenu({\n  menuButtons,\n  ...props\n}: DrawerContentComponentProps & { menuButtons: RefObject<Record<string, MenuButton | null>> }) {\n  const colors = useThemeColors()\n  const heading = useRef<ComponentRef<typeof Text>>(null)\n  const progress = useDrawerProgress()\n  const wasOpen = useSharedValue(false)\n  const { navigation } = props\n\n  async function moveFocus(open: boolean) {\n    if (!(await AccessibilityInfo.isScreenReaderEnabled())) return\n    const { routes, index } = navigation.getState()\n    const target = open ? heading.current : menuButtons.current[routes[index].name]\n    if (!target) return\n    if (Platform.OS === 'web') target.focus()\n    else AccessibilityInfo.sendAccessibilityEvent(target, 'focus')\n  }\n\n  // The drawer exposes its accessibility elements only near the end of the animation.\n  useAnimatedReaction(\n    () => progress.value,\n    (value) => {\n      if (value >= 0.99 && !wasOpen.value) {\n        wasOpen.value = true\n        runOnJS(moveFocus)(true)\n      } else if (value <= 0.01 && wasOpen.value) {\n        wasOpen.value = false\n        runOnJS(moveFocus)(false)\n      }\n    },\n  )\n\n  return (\n    <DrawerContentScrollView {...props}>\n      <Text\n        ref={heading}\n        {...(Platform.OS === 'web' && { tabIndex: -1 })}\n        accessible\n        accessibilityRole=\"header\"\n        className=\"px-4 py-3 font-semibold text-foreground\"\n      >\n        Navigation menu\n      </Text>\n      <DrawerItemList {...props} />\n      <DrawerItem label=\"Close menu\" inactiveTintColor={colors.foreground} onPress={navigation.closeDrawer} />\n    </DrawerContentScrollView>\n  )\n}\n\nexport default function DrawerLayout() {\n  const canGoBack = useCanGoBack()\n  const colors = useThemeColors()\n  const menuButtons = useRef<Record<string, MenuButton | null>>({})\n\n  return (\n    <GestureHandlerRootView style={{ flex: 1 }}>\n      <Drawer\n        backBehavior=\"initialRoute\"\n        drawerContent={(props) => <DrawerMenu {...props} menuButtons={menuButtons} />}\n        screenOptions={({ navigation, route }) => ({\n          headerStyle: { backgroundColor: colors.background },\n          headerTintColor: colors.foreground,\n          headerShadowVisible: false,\n          headerLeft: () => (\n            <Button\n              ref={(button) => {\n                menuButtons.current[route.name] = button\n              }}\n              accessibilityLabel=\"Show navigation menu\"\n              variant=\"ghost\"\n              size=\"icon\"\n              onPress={navigation.openDrawer}\n            >\n              <Menu size={24} color={colors.foreground} aria-hidden />\n            </Button>\n          ),\n          headerRight: () => {\n            const parent = navigation.getParent()\n            return canGoBack && parent ? (\n              <Button variant=\"ghost\" size=\"sm\" onPress={parent.goBack}>\n                Done\n              </Button>\n            ) : null\n          },\n          sceneStyle: { backgroundColor: colors.background },\n          drawerStyle: { backgroundColor: colors.background },\n          drawerActiveBackgroundColor: colors.primary,\n          drawerActiveTintColor: colors.primaryForeground,\n          drawerInactiveTintColor: colors.foreground,\n        })}\n      >\n        <Drawer.Screen name=\"index\" options={{ title: 'Inbox' }} />\n        <Drawer.Screen name=\"archive\" options={{ title: 'Archive' }} />\n      </Drawer>\n    </GestureHandlerRootView>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/app/navigation/drawer/_layout.tsx"
    },
    {
      "path": "packages/registry-native/blocks/drawer-navigation/index.tsx",
      "content": "import { Text } from '@/components/ui/text'\nimport { NavigationExampleScreen } from '@/lib/navigation-example-screen'\n\nexport default function InboxScreen() {\n  return (\n    <NavigationExampleScreen>\n      <Text size=\"lg\" accessibilityRole=\"header\">\n        Recent messages\n      </Text>\n      <Text variant=\"muted\">Open the menu in the header to visit Archive.</Text>\n    </NavigationExampleScreen>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/app/navigation/drawer/index.tsx"
    },
    {
      "path": "packages/registry-native/blocks/drawer-navigation/archive.tsx",
      "content": "import { Text } from '@/components/ui/text'\nimport { NavigationExampleScreen } from '@/lib/navigation-example-screen'\n\nexport default function ArchiveScreen() {\n  return (\n    <NavigationExampleScreen>\n      <Text size=\"lg\" accessibilityRole=\"header\">\n        Archived messages\n      </Text>\n      <Text variant=\"muted\">Open the menu to return to Inbox.</Text>\n    </NavigationExampleScreen>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/app/navigation/drawer/archive.tsx"
    }
  ],
  "dependencies": [
    "expo-router@^58.0.0",
    "lucide-react-native",
    "react-native-gesture-handler",
    "react-native-reanimated"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/navigation-example-screen.json"
  ],
  "description": "Expo Router drawer with an accessible menu, two destinations, and an explicit close action.",
  "categories": [
    "navigation"
  ]
}