Skip to content

Commit

Permalink
correção do arquivo layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheus-0217 committed Feb 1, 2025
1 parent 0d189a0 commit 7cffdb9
Showing 1 changed file with 86 additions and 47 deletions.
133 changes: 86 additions & 47 deletions src/app/private/tabs/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,96 @@
import React, { useEffect, useRef } from "react";
import { Stack } from "expo-router";
import * as Notifications from "expo-notifications";
import { LogBox, View } from "react-native";
import Toast from "react-native-toast-message";
import { Platform, StyleSheet } from "react-native";

Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false,
}),
});

export default function AppLayout() {
const notificationListener = useRef<Notifications.Subscription>();
const responseListener = useRef<Notifications.Subscription>();

LogBox.ignoreLogs([
'JSI SQLiteAdapter not available',
]);

useEffect(() => {
notificationListener.current =
Notifications.addNotificationReceivedListener((notification) => {
console.log(notification);
});

responseListener.current =
Notifications.addNotificationResponseReceivedListener((response) => {
console.log(response);
});
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import React from "react";
import { Tabs } from "expo-router";

return () => {
Notifications.removeNotificationSubscription(
notificationListener.current as Notifications.Subscription,
);
Notifications.removeNotificationSubscription(
responseListener.current as Notifications.Subscription,
);
};
}, []);
export default function TabsLayout() {
const iconComponent = (focused: boolean, size: number, iconName: string) => (
<Icon
name={focused ? iconName : ${iconName}-outline}
style={styles.itemIcon}
size={size}
/>
);

return (
<>
<View style={{ zIndex: 9999 }} testID="toast-view">
<Toast />
</View>
<Stack
<Tabs
screenOptions={{
header: () => <View style={{ height: 50 }} testID="stack-header" />,
tabBarActiveTintColor: "lightgrey",
tabBarStyle: {
backgroundColor: "#2CCDB5",
height: 65,
},
tabBarLabelStyle: {
marginBottom: Platform.OS === "ios" ? -15 : 10,
fontWeight: "600",
color: "#fff",
fontSize: 14,
},
}}
/>
<View testID="layout-view" />
>
<Tabs.Screen
name="rotinas"
options={{
title: "Rotinas",
headerShown: false,
tabBarIcon: ({ size, focused }) => {
return iconComponent(focused, size, "calendar");
},
}}
/>

<Tabs.Screen
name="eventos"
options={{
title: "Eventos",
headerShown: false,
tabBarIcon: ({ size, focused }) => {
return iconComponent(focused, size, "calendar");
},
}}
/>
<Tabs.Screen
name="registros"
options={{
title: "Registros",
headerShown: false,
tabBarIcon: ({ size, focused }) => {
return iconComponent(focused, size, "heart");
},
}}
/>
<Tabs.Screen
name="forum"
options={{
title: "Forum",
headerShown: false,
tabBarHideOnKeyboard: true,
tabBarIcon: ({ size, focused }) => {
return iconComponent(focused, size, "message");
},
}}
/>
<Tabs.Screen
name="perfil"
options={{
title: "Perfil",
headerShown: false,
tabBarIcon: ({ size, focused }) => {
return iconComponent(focused, size, "account");
},
}}
/>
</Tabs>
</>
);
}

const styles = StyleSheet.create({
itemIcon: {
color: "#fff",
marginTop: Platform.OS === "ios" ? 10 : 0,
marginBottom: Platform.OS === "ios" ? 0 : -10,
  },
});

0 comments on commit 7cffdb9

Please sign in to comment.