generated from ibm-developer-skills-network/coding-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
62 lines (53 loc) · 2.2 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import ChatScreen from './ChatScreen';
import { ListUsers } from './ListUsers';
import SignUpScreen from './SignUpScreen';
import LoginScreen from './LoginScreen';
import SettingsScreen from './SettingsScreen';
import useAuthentication from './useAuthentication';
import { Ionicons } from '@expo/vector-icons'; // You can choose other icon sets as well
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
export default function App() {
const {user} = useAuthentication();
if (user){
return (
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === 'ChatScreen') {
iconName = focused ? 'chatbubble' : 'chatbubble-outline';
} else if (route.name === 'Settings') {
iconName = focused ? 'settings' : 'settings-outline';
} else if (route.name === 'ListUsers') {
iconName = focused ? 'people' : 'people-outline';
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: 'blue',
tabBarInactiveTintColor: 'gray',
})}
>
<Tab.Screen name="ListUsers" component={ListUsers} options={{ title: 'Buddies' }} />
<Tab.Screen name="ChatScreen" component={ChatScreen} options={{ title: 'Chat' }} />
<Tab.Screen name="Settings" component={SettingsScreen} options={{ title: 'Settings' }} />
</Tab.Navigator>
</NavigationContainer>
)
} else {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="SignUp" component={SignUpScreen} />
<Stack.Screen name="Login" component={LoginScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
}