diff options
author | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-29 13:39:22 -0700 |
---|---|---|
committer | ankit-thanekar007 <ankit.thanekar007@gmail.com> | 2021-03-29 13:39:22 -0700 |
commit | e8d862e5e6dd8a6a517a93c65e30795813af936d (patch) | |
tree | 3ed42fb2a394eb3a8dd5fa1dadd5881ea87eb7cd /src/screens/profile/SettingsScreen.tsx | |
parent | bc1f377dfe4033f2fad28b7852dc09a72e0bd43e (diff) |
Logout changes
Diffstat (limited to 'src/screens/profile/SettingsScreen.tsx')
-rw-r--r-- | src/screens/profile/SettingsScreen.tsx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/screens/profile/SettingsScreen.tsx b/src/screens/profile/SettingsScreen.tsx index 88962f71..05e051b5 100644 --- a/src/screens/profile/SettingsScreen.tsx +++ b/src/screens/profile/SettingsScreen.tsx @@ -8,15 +8,19 @@ import { TouchableOpacity, View, } from 'react-native'; -import {useSelector} from 'react-redux'; +import {useDispatch, useSelector} from 'react-redux'; +import {logout} from '../../store/actions'; import {RootState} from 'src/store/rootReducer'; import {Background} from '../../components'; import {SETTINGS_DATA} from '../../constants/constants'; import {BackgroundGradientType} from '../../types'; import {normalize, SCREEN_HEIGHT} from '../../utils/layouts'; import SettingsCell from './SettingsCell'; +import {useNavigation} from '@react-navigation/core'; const SettingsScreen: React.FC = () => { + const dispatch = useDispatch(); + const navigation = useNavigation(); const {suggested_people_linked} = useSelector( (state: RootState) => state.user.profile, ); @@ -44,7 +48,13 @@ const SettingsScreen: React.FC = () => { ListFooterComponent={() => ( <TouchableOpacity style={styles.logoutContainerStyles} - onPress={() => {}}> + onPress={() => { + dispatch(logout()); + navigation.reset({ + index: 0, + routes: [{name: 'SuggestedPeople'}], + }); + }}> <Text style={styles.logoutTextStyles}>Logout</Text> </TouchableOpacity> )} |