-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(layout): simplify layout components by removing unnecessary …
…padding and views
- Loading branch information
Showing
6 changed files
with
45 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,27 @@ | ||
import { Stack } from 'expo-router' | ||
import React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { Platform, View } from 'react-native' | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context' | ||
import { createStyleSheet, useStyles } from 'react-native-unistyles' | ||
|
||
export default function FoodStack(): JSX.Element { | ||
const { styles, theme } = useStyles(stylesheet) | ||
const { t } = useTranslation('navigation') | ||
const safeArea = useSafeAreaInsets() | ||
const topInset = safeArea.top | ||
const hasDynamicIsland = Platform.OS === 'ios' && topInset > 50 | ||
const paddingTop = hasDynamicIsland ? topInset : 0 | ||
return ( | ||
<View | ||
style={{ | ||
...styles.page, | ||
paddingTop, | ||
<Stack | ||
screenOptions={{ | ||
headerShown: true, | ||
headerStyle: styles.headerBackground, | ||
headerTitleStyle: styles.headerTextStyle, | ||
headerTintColor: theme.colors.primary, | ||
contentStyle: styles.background, | ||
title: t('navigation.food'), | ||
}} | ||
> | ||
<Stack | ||
screenOptions={{ | ||
headerShown: true, | ||
headerStyle: styles.headerBackground, | ||
headerTitleStyle: styles.headerTextStyle, | ||
headerTintColor: theme.colors.primary, | ||
contentStyle: styles.background, | ||
title: t('navigation.food'), | ||
}} | ||
></Stack> | ||
</View> | ||
></Stack> | ||
) | ||
} | ||
|
||
const stylesheet = createStyleSheet((theme) => ({ | ||
background: { backgroundColor: theme.colors.background }, | ||
headerBackground: { backgroundColor: theme.colors.card }, | ||
headerTextStyle: { color: theme.colors.text }, | ||
page: { | ||
backgroundColor: theme.colors.card, | ||
flex: 1, | ||
}, | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,27 @@ | ||
import { Stack } from 'expo-router' | ||
import React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { Platform, View } from 'react-native' | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context' | ||
import { createStyleSheet, useStyles } from 'react-native-unistyles' | ||
|
||
export default function TimetableStack(): JSX.Element { | ||
const { t } = useTranslation('navigation') | ||
const safeArea = useSafeAreaInsets() | ||
const topInset = safeArea.top | ||
const hasDynamicIsland = Platform.OS === 'ios' && topInset > 50 | ||
const paddingTop = hasDynamicIsland ? topInset : 0 | ||
const { styles, theme } = useStyles(stylesheet) | ||
return ( | ||
<View style={{ ...styles.page, paddingTop }}> | ||
<Stack | ||
screenOptions={{ | ||
headerShown: true, | ||
title: t('navigation.timetable'), | ||
headerStyle: styles.headerBackground, | ||
headerTitleStyle: styles.headerTextStyle, | ||
headerTintColor: theme.colors.primary, | ||
contentStyle: styles.background, | ||
}} | ||
></Stack> | ||
</View> | ||
<Stack | ||
screenOptions={{ | ||
headerShown: true, | ||
title: t('navigation.timetable'), | ||
headerStyle: styles.headerBackground, | ||
headerTitleStyle: styles.headerTextStyle, | ||
headerTintColor: theme.colors.primary, | ||
contentStyle: styles.background, | ||
}} | ||
></Stack> | ||
) | ||
} | ||
|
||
const stylesheet = createStyleSheet((theme) => ({ | ||
background: { backgroundColor: theme.colors.background }, | ||
headerBackground: { backgroundColor: theme.colors.card }, | ||
headerTextStyle: { color: theme.colors.text }, | ||
page: { | ||
backgroundColor: theme.colors.card, | ||
flex: 1, | ||
}, | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters