feat: change params on exercise screen, also reformat code

This commit is contained in:
Vinicius Souza 2024-11-01 13:05:06 -03:00
parent 2e42ecd4c0
commit 93f0696ad2

View file

@ -13,39 +13,42 @@ import { gluestackUIConfig } from '../../config/gluestack-ui.config';
import { Platform } from 'react-native'; import { Platform } from 'react-native';
type AppRoutes = { type AppRoutes = {
Home: undefined, Home: undefined;
Exercise: undefined, Exercise: { exerciseId: string };
History: undefined, History: undefined;
Profile: undefined, Profile: undefined;
} };
export type AppNavigatorRoutesProps = BottomTabNavigationProp<AppRoutes>; export type AppNavigatorRoutesProps = BottomTabNavigationProp<AppRoutes>;
const { Navigator, Screen } = createBottomTabNavigator<AppRoutes>(); const { Navigator, Screen } = createBottomTabNavigator<AppRoutes>();
export function AppRoutes() { export function AppRoutes() {
const { tokens: { space, colors } } = gluestackUIConfig; const {
tokens: { space, colors },
} = gluestackUIConfig;
const iconSize = space['6']; const iconSize = space['6'];
return ( return (
<Navigator screenOptions={{ <Navigator
headerShown: false, screenOptions={{
tabBarShowLabel: false, headerShown: false,
tabBarActiveTintColor: colors.green500, tabBarShowLabel: false,
tabBarInactiveTintColor: colors.gray200, tabBarActiveTintColor: colors.green500,
tabBarStyle: { tabBarInactiveTintColor: colors.gray200,
backgroundColor: colors.gray600, tabBarStyle: {
borderTopWidth: 0, backgroundColor: colors.gray600,
height: Platform.OS === 'android' ? 'auto' : 96, borderTopWidth: 0,
paddingBottom: space['10'], height: Platform.OS === 'android' ? 'auto' : 96,
paddingTop: space['6'], paddingBottom: space['10'],
} paddingTop: space['6'],
}}> },
}}>
<Screen <Screen
name="Home" name="Home"
component={Home} component={Home}
options={{ options={{
tabBarIcon: ({ color }) => <HomeIcon fill={color} width={iconSize} height={iconSize}/> tabBarIcon: ({ color }) => <HomeIcon fill={color} width={iconSize} height={iconSize} />,
}} }}
/> />
@ -53,23 +56,23 @@ export function AppRoutes() {
name="History" name="History"
component={History} component={History}
options={{ options={{
tabBarIcon: ({ color }) => <HistoryIcon fill={color} width={iconSize} height={iconSize}/> tabBarIcon: ({ color }) => (
}} <HistoryIcon fill={color} width={iconSize} height={iconSize} />
),
}}
/> />
<Screen <Screen
name="Profile" name="Profile"
component={Profile} component={Profile}
options={{ options={{
tabBarIcon: ({ color }) => <ProfileIcon fill={color} width={iconSize} height={iconSize}/> tabBarIcon: ({ color }) => (
<ProfileIcon fill={color} width={iconSize} height={iconSize} />
),
}} }}
/> />
<Screen <Screen name="Exercise" component={Exercise} options={{ tabBarButton: () => null }} />
name="Exercise"
component={Exercise}
options={{ tabBarButton: () => null }}
/>
</Navigator> </Navigator>
) );
} }