Skip to content

Commit 68fe2ab

Browse files
committed
add logout
1 parent 926e43b commit 68fe2ab

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

hackathon/spacecraft/src/screens/PlusScreen.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ import { View } from "react-native";
33
import { List, Text } from "react-native-paper";
44

55
import { ScreenContainer } from "~/components/ScreenContainer";
6+
import { useAuthentication } from "~/context/Authentication";
67
import { Routes } from "~/navigation/Routes";
78

8-
interface Props {}
9-
10-
export const PlusScreen = ({ navigation }: Props) => {
9+
export const PlusScreen = ({ navigation }: any) => {
1110
const navigateToDoYouLikeScreen = () => {
1211
navigation.navigate(Routes.DO_YOU_LIKE_SCREEN);
1312
};
1413

14+
const { setUser } = useAuthentication();
15+
const handleLogout = () => {
16+
setUser(false);
17+
};
18+
1519
return (
1620
<ScreenContainer title={"Plus"}>
1721
<View style={{ flex: 1 }}>
@@ -25,6 +29,16 @@ export const PlusScreen = ({ navigation }: Props) => {
2529
onPress={navigateToDoYouLikeScreen}
2630
title="Do you like Spacecraft?"
2731
/>
32+
<List.Item
33+
left={(props) => (
34+
<List.Icon
35+
{...props}
36+
icon="logout"
37+
/>
38+
)}
39+
onPress={handleLogout}
40+
title="Logout"
41+
/>
2842
</View>
2943
<View
3044
style={{

0 commit comments

Comments
 (0)