import { StyleSheet, Text, View, Alert } from 'react-native'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { confirmLogout } from '../helpers' const Menu = ({ session, setSession, setEdit, showError, saveNote }) => { const logout = async () => { try { await AsyncStorage.clear(); setSession(null) } catch(e) { showError('Error while logging out') } } return ( { saveNote ? ( <> setEdit(null)} > Back Save ) : ( <> setEdit({})} > New Note Sort confirmLogout({ logout, email: session.email })} > {session.email} ) } ) } const styles = StyleSheet.create({ menu: { backgroundColor: '#333', height: 60, width: '100%', flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-between', padding: 10, }, menuText: { fontWeight: 'bold', paddingHorizontal: 15, color: 'white', }, }); export default Menu