Нет описания

_layout.tsx 1.5KB

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 SalesLayout() {
  8. const { t } = useTranslation();
  9. const router = useRouter();
  10. const colorScheme = useColorScheme();
  11. const palette = Colors[colorScheme ?? 'light'];
  12. return (
  13. <Stack
  14. screenOptions={{
  15. headerBackTitleVisible: false,
  16. headerBackTitle: '',
  17. headerBackTitleStyle: { display: 'none' },
  18. headerLeft: ({ canGoBack }) =>
  19. canGoBack ? (
  20. <Pressable onPress={() => router.back()} hitSlop={10} style={{ paddingHorizontal: 8 }}>
  21. <IconSymbol size={20} name="chevron.left" color={palette.text} />
  22. </Pressable>
  23. ) : null,
  24. }}>
  25. <Stack.Screen
  26. name="index"
  27. options={{
  28. title: t('sales.title'),
  29. headerLeft: () => (
  30. <Pressable onPress={() => router.back()} hitSlop={10} style={{ paddingHorizontal: 8 }}>
  31. <IconSymbol size={20} name="chevron.left" color={palette.text} />
  32. </Pressable>
  33. ),
  34. }}
  35. />
  36. <Stack.Screen name="new" options={{ title: t('sales.new') }} />
  37. <Stack.Screen name="[id]" options={{ title: t('sales.edit') }} />
  38. </Stack>
  39. );
  40. }