Created
April 18, 2021 19:15
-
-
Save AllGistsEqual/94e37419df6985afe7f2d445badcc5fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: src/screens/HomeScreen.tsx | |
import React from 'react' | |
import { Text, View, StyleSheet, Button } from 'react-native' | |
import { MainNavigationProp } from '../routing/types' | |
import { MainRoutes } from '../routing/routes' | |
import { useReduxDispatch } from '../redux' | |
import { setLogin } from '../redux/ducks/user' | |
type HomeScreenProps = { | |
navigation: MainNavigationProp<MainRoutes.Home> | |
} | |
const HomeScreen = ({ navigation }: HomeScreenProps): React.ReactElement => { | |
const dispatch = useReduxDispatch() | |
const logoutHandler = () => dispatch(setLogin(false)) | |
return ( | |
<View style={styles.page}> | |
<Text>HOME</Text> | |
<Button title="logout" onPress={() => logoutHandler()} /> | |
<Button title="settings" onPress={() => navigation.navigate(MainRoutes.Settings)} /> | |
</View> | |
) | |
} | |
const styles = StyleSheet.create({ | |
page: { | |
flex: 1, | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}) | |
export default HomeScreen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment