File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import React, { useContext } from 'react';
import { View, Text, TouchableOpacity, StyleSheet, Platform } from 'react-native';
import { AuthContext } from '../context/AuthContext';
const SelectionScreen = ({ navigation }) => {
const { logout } = useContext(AuthContext);
const handleLogout = async () => {
await logout();
navigation.navigate('Login'); // Ensure 'Login' is defined in AuthNavigator
};
return (
<View style={styles.container}>
<TouchableOpacity style={styles.startButton} onPress={() => navigation.navigate('Camera')}>
<Text style={styles.buttonText}>운행시작</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.historyButton} onPress={() => navigation.navigate('History')}>
<Text style={styles.blueButtonText}>히스토리</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.fullWidthButton, styles.logoutButton]}
onPress={handleLogout}
>
<Text style={styles.blackbuttonText}>로그아웃</Text>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center', // 중앙 정렬
alignItems: 'center',
backgroundColor: '#fff', // 배경색 (흰색)
},
startButton: {
backgroundColor: '#007AFF', // iOS 스타일의 버튼 색상
borderRadius: 10,
padding: 15,
width: '80%', // 버튼 너비
alignItems: 'center',
marginVertical: 10, // 버튼 간격
},
historyButton: {
backgroundColor: '#CAF4FF',
borderRadius: 10,
padding: 15,
width: '80%', // 버튼 너비
alignItems: 'center',
marginVertical: 10, // 버튼 간격
},
buttonText: {
color: '#FFFFFF', // 버튼 텍스트 색상
fontSize: 18,
fontWeight: '600', // 텍스트 두께
},
blueButtonText: {
color: '#007AFF', // 버튼 텍스트 색상
fontSize: 18,
fontWeight: '600', // 텍스트 두께
},
fullWidthButton: {
paddingVertical: 15,
borderRadius: 10,
marginVertical: 5,
alignItems: 'center',
width: '80%', // 버튼 너비
},
logoutButton: {
backgroundColor: '#eeeeee',
},
blackbuttonText: {
fontWeight: 'bold',
fontSize: 16,
},
});
export default SelectionScreen;