Moved logout button
This commit is contained in:
parent
f9655424db
commit
6c0a275ee0
@ -3,7 +3,6 @@ import { useRouter } from 'expo-router';
|
|||||||
import ParallaxScrollView from '@/components/default/ParallaxScrollView';
|
import ParallaxScrollView from '@/components/default/ParallaxScrollView';
|
||||||
import { ThemedText, ThemedTextButton, ThemedView } from '@/components/theme';
|
import { ThemedText, ThemedTextButton, ThemedView } from '@/components/theme';
|
||||||
import { IconSymbol } from '@/components/ui/IconSymbol';
|
import { IconSymbol } from '@/components/ui/IconSymbol';
|
||||||
import Logout_Button from '@/components/auth/Logout_Button';
|
|
||||||
|
|
||||||
const SettingsScreen = () => {
|
const SettingsScreen = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -35,7 +34,6 @@ const SettingsScreen = () => {
|
|||||||
</ThemedView>
|
</ThemedView>
|
||||||
|
|
||||||
<ThemedView style={styles.section}>
|
<ThemedView style={styles.section}>
|
||||||
<Logout_Button />
|
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
</ParallaxScrollView>
|
</ParallaxScrollView>
|
||||||
);
|
);
|
||||||
|
@ -6,6 +6,7 @@ import { ThemedView, ThemedText, ThemedTextButton, ThemedTextInput } from '@/com
|
|||||||
import { IconSymbol } from '@/components/ui/IconSymbol';
|
import { IconSymbol } from '@/components/ui/IconSymbol';
|
||||||
import Avatar from '@/components/auth/Profile_Avatar';
|
import Avatar from '@/components/auth/Profile_Avatar';
|
||||||
import { Session } from '@supabase/supabase-js'
|
import { Session } from '@supabase/supabase-js'
|
||||||
|
import Logout_Button from '@/components/auth/Logout_Button';
|
||||||
|
|
||||||
export default function ProfileScreen() {
|
export default function ProfileScreen() {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@ -101,6 +102,12 @@ export default function ProfileScreen() {
|
|||||||
width='90%'
|
width='90%'
|
||||||
style={styles.saveButton}
|
style={styles.saveButton}
|
||||||
/>
|
/>
|
||||||
|
<Logout_Button
|
||||||
|
fontSize={18}
|
||||||
|
fontWeight='semibold'
|
||||||
|
width='90%'
|
||||||
|
style={styles.logoutButton}
|
||||||
|
/>
|
||||||
|
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
);
|
);
|
||||||
@ -150,7 +157,12 @@ const styles = StyleSheet.create({
|
|||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
},
|
},
|
||||||
saveButton: {
|
saveButton: {
|
||||||
paddingVertical: 14,
|
borderRadius: 8,
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
logoutButton: {
|
||||||
|
backgroundColor: 'red',
|
||||||
|
marginTop: 50,
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,33 @@
|
|||||||
import { supabase } from '@/lib/supabase';
|
import { supabase } from '@/lib/supabase';
|
||||||
import { ThemedView, ThemedText, ThemedTextButton, ThemedTextInput } from '@/components/theme';
|
import { ThemedView, ThemedText, ThemedTextButton, ThemedTextInput } from '@/components/theme';
|
||||||
import { Alert, StyleSheet, AppState } from 'react-native';
|
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 signOut = async () => {
|
||||||
const { error } = await supabase.auth.signOut();
|
const { error } = await supabase.auth.signOut();
|
||||||
if (error) Alert.alert(error.message);
|
if (error) Alert.alert(error.message);
|
||||||
@ -10,11 +35,15 @@ const Logout_Button = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedTextButton
|
<ThemedTextButton
|
||||||
width={120}
|
|
||||||
height={60}
|
|
||||||
text='Logout'
|
text='Logout'
|
||||||
fontSize={16}
|
width={width}
|
||||||
|
height={height}
|
||||||
|
fontSize={fontSize}
|
||||||
|
fontWeight={fontWeight}
|
||||||
|
containerStyle={containerStyle}
|
||||||
|
buttonStyle={buttonStyle}
|
||||||
onPress={() => signOut()}
|
onPress={() => signOut()}
|
||||||
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user