index.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { useRouter } from 'expo-router';
  2. import {
  3. View,
  4. Text,
  5. Image,
  6. StyleSheet,
  7. TouchableOpacity,
  8. Dimensions,
  9. } from 'react-native';
  10. import AsyncStorage from '@react-native-async-storage/async-storage';
  11. import { useEffect } from 'react';
  12. const { width, height } = Dimensions.get('window');
  13. export default function IntroScreen() {
  14. const router = useRouter();
  15. useEffect(() => {
  16. const checkGuest = async () => {
  17. const isGuest = await AsyncStorage.getItem('isGuest');
  18. if (isGuest === 'true') {
  19. router.replace('/main');
  20. }
  21. };
  22. checkGuest();
  23. }, []);
  24. const handleGuestStart = async () => {
  25. await AsyncStorage.setItem('isGuest', 'true');
  26. router.replace('/main');
  27. };
  28. const handleLoginPress = () => {
  29. // 추후 개발: 로그인 페이지로 이동
  30. alert('로그인 기능은 추후 지원 예정입니다.');
  31. };
  32. return (
  33. <View style={styles.container}>
  34. <Image
  35. source={require('../assets/background.png')}
  36. style={styles.backgroundImage}
  37. resizeMode="cover"
  38. />
  39. <View style={styles.overlay}>
  40. <TouchableOpacity style={styles.button} onPress={handleGuestStart}>
  41. <Text style={styles.buttonText}>게스트로 시작하기</Text>
  42. </TouchableOpacity>
  43. <TouchableOpacity style={styles.buttonOutline} onPress={handleLoginPress}>
  44. <Text style={styles.buttonOutlineText}>Gmail로 로그인</Text>
  45. </TouchableOpacity>
  46. </View>
  47. </View>
  48. );
  49. }
  50. const styles = StyleSheet.create({
  51. container: {
  52. flex: 1,
  53. },
  54. backgroundImage: {
  55. width,
  56. height,
  57. position: 'absolute',
  58. },
  59. overlay: {
  60. flex: 1,
  61. justifyContent: 'center',
  62. alignItems: 'center',
  63. paddingHorizontal: 32,
  64. backgroundColor: 'rgba(0, 0, 0, 0.4)',
  65. },
  66. button: {
  67. backgroundColor: '#FF6B00',
  68. paddingVertical: 14,
  69. paddingHorizontal: 36,
  70. borderRadius: 12,
  71. marginBottom: 16,
  72. width: '100%',
  73. alignItems: 'center',
  74. },
  75. buttonText: {
  76. color: '#FFF',
  77. fontSize: 16,
  78. fontWeight: 'bold',
  79. },
  80. buttonOutline: {
  81. borderWidth: 2,
  82. borderColor: '#FFF',
  83. paddingVertical: 14,
  84. paddingHorizontal: 36,
  85. borderRadius: 12,
  86. width: '100%',
  87. alignItems: 'center',
  88. },
  89. buttonOutlineText: {
  90. color: '#FFF',
  91. fontSize: 16,
  92. fontWeight: 'bold',
  93. },
  94. });