From 20b0ca39b333e0e3687f25347431643b5b2a95ef Mon Sep 17 00:00:00 2001 From: meganhong <34787696+meganhong@users.noreply.github.com> Date: Mon, 27 Jul 2020 13:05:03 -0700 Subject: TMA-167: Create Navigation Bar (#25) * Renamed Profile in Onboarding and added dummy main screens * Comments for new screens created * change navigation in verification to profileonboarding * added icons and tab navigation * added icons to navigation bar * add clicked icons * added 2x and 3x icon sizes * rename for resizing to work * remove upload clicked as informed by design * changed initialRouteName back to Login * created NavigationIcon component to hold all the nav icons * added default case * changed intialRouteName back to Login * fixed icon names * fixed icon names * add navigation to home page after login Co-authored-by: Megan Hong --- src/routes/Routes.tsx | 81 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 4 deletions(-) (limited to 'src/routes') diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx index 7379c2c2..5d69b38b 100644 --- a/src/routes/Routes.tsx +++ b/src/routes/Routes.tsx @@ -1,26 +1,94 @@ import React from 'react'; import {createStackNavigator} from '@react-navigation/stack'; +import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; import { Login, RegistrationOne, RegistrationTwo, Verification, - Profile, + ProfileOnboarding, } from '../screens/onboarding'; +import {Home, Notifications, Profile, Search, Upload} from '../screens/main'; +import {NavigationIcon} from '../components'; export type RootStackParamList = { + // Onboarding Screens Login: undefined; RegistrationOne: undefined; RegistrationTwo: | {firstName: string; lastName: string; email: string} | undefined; Verification: {username: string; email: string; userId: string}; - Profile: {username: string; userId: string}; + ProfileOnboarding: {username: string; userId: string}; + + // Main Screens + Home: undefined; + Notifications: undefined; + Profile: undefined; + Search: undefined; + Upload: undefined; }; const RootStack = createStackNavigator(); +const Tab = createBottomTabNavigator(); + +function MainTabNavigator() { + return ( + ({ + tabBarIcon: ({focused}) => { + if (route.name === 'Home') { + return focused ? ( + + ) : ( + + ); + } else if (route.name === 'Search') { + return focused ? ( + + ) : ( + + ); + } else if (route.name === 'Upload') { + return focused ? ( + + ) : ( + + ); + } else if (route.name === 'Notifications') { + return focused ? ( + + ) : ( + + ); + } else if (route.name === 'Profile') { + return focused ? ( + + ) : ( + + ); + } + }, + })} + tabBarOptions={{ + showLabel: false, + style: { + backgroundColor: 'transparent', + position: 'absolute', + borderTopWidth: 0, + }, + }}> + + + + + + + ); +} + interface RoutesProps {} const Routes: React.FC = ({}) => { @@ -47,8 +115,13 @@ const Routes: React.FC = ({}) => { options={{headerShown: false}} /> + -- cgit v1.2.3-70-g09d2