Moved logout button
This commit is contained in:
@ -1,8 +1,33 @@
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { ThemedView, ThemedText, ThemedTextButton, ThemedTextInput } from '@/components/theme';
|
||||
import { Alert, StyleSheet, AppState } from 'react-native';
|
||||
import React from 'react';
|
||||
import { TextStyle, PressableProps, DimensionValue } from 'react-native';
|
||||
import ThemedButton from '@/components/theme/buttons/ThemedButton';
|
||||
import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
|
||||
const Logout_Button = () => {
|
||||
// Extend ThemedButton props (which already extends PressableProps)
|
||||
type ThemedTextButtonProps = Omit<PressableProps, 'children'> & {
|
||||
width?: DimensionValue;
|
||||
height?: DimensionValue;
|
||||
fontSize?: number;
|
||||
fontWeight?: 'normal' | 'semibold' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
||||
textStyle?: TextStyle;
|
||||
containerStyle?: object;
|
||||
buttonStyle?: object;
|
||||
};
|
||||
|
||||
const Logout_Button: React.FC<ThemedTextButtonProps> = ({
|
||||
width,
|
||||
height,
|
||||
fontSize = 16,
|
||||
fontWeight = 'normal',
|
||||
textStyle,
|
||||
containerStyle,
|
||||
buttonStyle,
|
||||
...restProps
|
||||
}) => {
|
||||
const signOut = async () => {
|
||||
const { error } = await supabase.auth.signOut();
|
||||
if (error) Alert.alert(error.message);
|
||||
@ -10,11 +35,15 @@ const Logout_Button = () => {
|
||||
|
||||
return (
|
||||
<ThemedTextButton
|
||||
width={120}
|
||||
height={60}
|
||||
text='Logout'
|
||||
fontSize={16}
|
||||
width={width}
|
||||
height={height}
|
||||
fontSize={fontSize}
|
||||
fontWeight={fontWeight}
|
||||
containerStyle={containerStyle}
|
||||
buttonStyle={buttonStyle}
|
||||
onPress={() => signOut()}
|
||||
{...restProps}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user