2022-09-16 20:06:52 +00:00
|
|
|
import { View, TouchableOpacity, Text } from 'react-native';
|
2022-09-16 22:00:29 +00:00
|
|
|
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
|
|
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
2022-09-17 06:54:57 +00:00
|
|
|
import { createStackNavigator } from '@react-navigation/stack';
|
2022-09-16 20:06:52 +00:00
|
|
|
import { NavigationContainer } from '@react-navigation/native';
|
2022-09-16 22:00:29 +00:00
|
|
|
import Ionicons from '@expo/vector-icons/AntDesign';
|
2022-09-16 20:06:52 +00:00
|
|
|
import { useSession } from './useSession.hook';
|
2022-09-16 22:00:29 +00:00
|
|
|
import { styles } from './Session.styled';
|
|
|
|
import Colors from 'constants/Colors';
|
2022-09-17 06:54:57 +00:00
|
|
|
import { Profile } from './profile/Profile';
|
|
|
|
import { Channels } from './channels/Channels';
|
|
|
|
import { Cards } from './cards/Cards';
|
2022-09-12 22:18:27 +00:00
|
|
|
|
2022-09-07 07:32:06 +00:00
|
|
|
export function Session() {
|
2022-09-12 22:18:27 +00:00
|
|
|
|
2022-09-16 20:06:52 +00:00
|
|
|
const { state, actions } = useSession();
|
|
|
|
|
|
|
|
const Tab = createBottomTabNavigator();
|
|
|
|
|
2022-09-17 06:54:57 +00:00
|
|
|
const ConversationStack = createStackNavigator();
|
|
|
|
const ConversationStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<ConversationStack.Navigator screenOptions={({ route }) => ({ headerShown: false })}>
|
|
|
|
<ConversationStack.Screen name="channels" component={Channels} />
|
|
|
|
</ConversationStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
2022-09-16 20:06:52 +00:00
|
|
|
|
2022-09-17 06:54:57 +00:00
|
|
|
const ProfileStack = createStackNavigator();
|
|
|
|
const ProfileStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<ProfileStack.Navigator screenOptions={({ route }) => ({ headerShown: false })}>
|
|
|
|
<ProfileStack.Screen name="channels" component={Profile} />
|
|
|
|
</ProfileStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const ContactStack = createStackNavigator();
|
|
|
|
const ContactStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<ContactStack.Navigator screenOptions={({ route }) => ({ headerShown: false })}>
|
|
|
|
<ContactStack.Screen name="channels" component={Cards} />
|
|
|
|
</ContactStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
2022-09-12 22:18:27 +00:00
|
|
|
|
|
|
|
return (
|
2022-09-16 22:00:29 +00:00
|
|
|
<SafeAreaProvider>
|
|
|
|
<NavigationContainer>
|
2022-09-17 07:22:12 +00:00
|
|
|
{ state.tabbed && (
|
|
|
|
<Tab.Navigator
|
|
|
|
screenOptions={({ route }) => ({
|
|
|
|
tabBarStyle: styles.tabBar,
|
|
|
|
headerShown: false,
|
|
|
|
tabBarIcon: ({ focused, color, size }) => {
|
|
|
|
if (route.name === 'Profile') {
|
|
|
|
return <Ionicons name={'user'} size={size} color={color} />;
|
|
|
|
}
|
|
|
|
if (route.name === 'Conversation') {
|
|
|
|
return <Ionicons name={'message1'} size={size} color={color} />;
|
|
|
|
}
|
|
|
|
if (route.name === 'Contacts') {
|
|
|
|
return <Ionicons name={'contacts'} size={size} color={color} />;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tabBarShowLabel: false,
|
|
|
|
tabBarActiveTintColor: Colors.white,
|
|
|
|
tabBarInactiveTintColor: Colors.disabled,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<Tab.Screen name="Conversation" component={ConversationStackScreen} />
|
|
|
|
<Tab.Screen name="Profile" component={ProfileStackScreen} />
|
|
|
|
<Tab.Screen name="Contacts" component={ContactStackScreen} />
|
|
|
|
</Tab.Navigator>
|
|
|
|
)}
|
2022-09-16 22:00:29 +00:00
|
|
|
</NavigationContainer>
|
|
|
|
</SafeAreaProvider>
|
2022-09-12 22:18:27 +00:00
|
|
|
);
|
2022-09-07 07:32:06 +00:00
|
|
|
}
|
|
|
|
|
2022-09-16 20:06:52 +00:00
|
|
|
|