aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding/Login.tsx
diff options
context:
space:
mode:
authormeganhong <34787696+meganhong@users.noreply.github.com>2020-07-30 13:28:56 -0700
committerGitHub <noreply@github.com>2020-07-30 16:28:56 -0400
commitf9cf9b5d89d5e25b227814f0fc759257564cea89 (patch)
treed45b6f8378acb5bccb4ff06363ccad98bcb579dd /src/screens/onboarding/Login.tsx
parent20b0ca39b333e0e3687f25347431643b5b2a95ef (diff)
TMA-168: Add Gradient to Navigation Bar (#26)
* 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 * added gradient and changed screens to transparent * renamed Routes to OnboardingStack * rerouting navigation * pulling from master * merge conflicts * added entryway to home on profileonboarding * changed gradient into custom component * removed a method that i had commented out Co-authored-by: Megan Hong <meganhong31@g.ucla.edu>
Diffstat (limited to 'src/screens/onboarding/Login.tsx')
-rw-r--r--src/screens/onboarding/Login.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx
index 537ce868..7b76e97c 100644
--- a/src/screens/onboarding/Login.tsx
+++ b/src/screens/onboarding/Login.tsx
@@ -13,7 +13,7 @@ import {
Platform,
} from 'react-native';
-import {RootStackParamList} from '../../routes';
+import {RootStackParamList, AuthContext} from '../../routes';
import {Background, TaggInput, SubmitButton} from '../../components';
import {usernameRegex, LOGIN_ENDPOINT} from '../../constants';
@@ -41,6 +41,8 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
isValidPassword: false,
attemptedSubmit: false,
});
+ // determines if user is logged in
+ const {login} = React.useContext(AuthContext);
/**
* Updates the state of username. Also verifies the input of the username field by ensuring proper length and appropriate characters.
@@ -118,7 +120,7 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
let statusCode = response.status;
if (statusCode === 200) {
- navigation.navigate('Home');
+ login();
} else if (statusCode === 401) {
Alert.alert(
'Login failed 😔',