32 lines
785 B
TypeScript
32 lines
785 B
TypeScript
/*
|
|
* 진입점 — 토큰 복원 대기 후 인증 상태에 따라 로그인/탭 홈으로 분기.
|
|
*/
|
|
import { Redirect } from 'expo-router';
|
|
import React from 'react';
|
|
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
|
import { useAuth } from '../context/AuthContext';
|
|
import { colors } from '../theme';
|
|
|
|
export default function Index() {
|
|
const { ready, token } = useAuth();
|
|
|
|
if (!ready) {
|
|
return (
|
|
<View style={styles.center}>
|
|
<ActivityIndicator color={colors.primary600} size="large" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return <Redirect href={token ? '/(tabs)' : '/login'} />;
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
center: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
backgroundColor: colors.neutral050,
|
|
},
|
|
});
|