index.tsx 2.5 KB

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