diff options
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> )} |