Sin descripción

_layout.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Stack, useRouter } from 'expo-router';
  2. import { Pressable } from 'react-native';
  3. import { IconSymbol } from '@/components/ui/icon-symbol';
  4. import { Colors } from '@/constants/theme';
  5. import { useColorScheme } from '@/hooks/use-color-scheme';
  6. import { useTranslation } from '@/localization/i18n';
  7. export default function TasksLayout() {
  8. const i18n = useTranslation();
  9. const title = typeof i18n?.t === 'function' ? i18n.t('tasks.title') : 'Tasks';
  10. const router = useRouter();
  11. const colorScheme = useColorScheme();
  12. const palette = Colors[colorScheme ?? 'light'];
  13. return (
  14. <Stack
  15. screenOptions={{
  16. headerBackTitleVisible: false,
  17. headerBackTitle: '',
  18. headerBackTitleStyle: { display: 'none' },
  19. headerLeft: ({ canGoBack }) =>
  20. canGoBack ? (
  21. <Pressable onPress={() => router.back()} hitSlop={10} style={{ paddingHorizontal: 8 }}>
  22. <IconSymbol size={20} name="chevron.left" color={palette.text} />
  23. </Pressable>
  24. ) : null,
  25. }}>
  26. <Stack.Screen
  27. name="index"
  28. options={{
  29. title,
  30. headerLeft: () => (
  31. <Pressable onPress={() => router.back()} hitSlop={10} style={{ paddingHorizontal: 8 }}>
  32. <IconSymbol size={20} name="chevron.left" color={palette.text} />
  33. </Pressable>
  34. ),
  35. }}
  36. />
  37. <Stack.Screen name="[id]" options={{ title }} />
  38. </Stack>
  39. );
  40. }