feat: React Native(Expo) 앱 추가 — 탭 구조와 오늘 화면
- Expo SDK 57 + expo-router, react-query, Uniwind(Tailwind v4), SecureStore 토큰 - Metro 가 앱의 react(19.2.3)만 쓰게 고정 (루트에는 웹용 react 19.3.0) - 탭 5개·위 막대·시간대 하늘 배경·밤 테마, 오늘 히어로·각 순위·행사/TOP5/계절 띠 - 남은 이전 작업은 TODO.md 앱 마이그레이션 표
This commit is contained in:
1 parent
2ab2271d61
commit
e52f93fdbb
56 files changed
+1211
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import type { BottomTabBarProps } from 'expo-router/tabs';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
import { TabIcon, type TabName } from '@/components/svg';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
const LABELS: Record<string, [TabName, string]> = {
|
||||
sky: ['sky', '노을'],
|
||||
gak: ['gak', '각'],
|
||||
index: ['today', '오늘'],
|
||||
week: ['week', '주말·행사'],
|
||||
season: ['season', '계절·상식'],
|
||||
};
|
||||
|
||||
/** 아래 탭 막대. 가운데 오늘 탭은 막대 위로 솟은 큰 주황 동그라미 */
|
||||
export function TabBar({ state, navigation }: BottomTabBarProps) {
|
||||
const { bottom } = useSafeAreaInsets();
|
||||
const { kind } = useSky();
|
||||
const [ink, ink3, orange] = useCSSVariable(['--color-ink', '--color-ink3', '--color-orange']).map(String);
|
||||
const night = kind === 'night';
|
||||
return (
|
||||
<View
|
||||
className="flex-row border-t px-1 pt-[7px]"
|
||||
style={{ paddingBottom: 8 + bottom, backgroundColor: night ? 'rgb(18 24 60 / 0.92)' : 'rgb(255 255 255 / 0.85)', borderColor: night ? 'rgb(255 255 255 / 0.08)' : 'rgb(255 255 255 / 0.4)' }}
|
||||
>
|
||||
{state.routes.map((route, i) => {
|
||||
const [icon, label] = LABELS[route.name] ?? ['today', route.name];
|
||||
const focused = state.index === i;
|
||||
const onPress = () => {
|
||||
const event = navigation.emit({ type: 'tabPress', target: route.key, canPreventDefault: true });
|
||||
if (!focused && !event.defaultPrevented) navigation.navigate(route.name);
|
||||
};
|
||||
if (icon === 'today')
|
||||
return (
|
||||
<Pressable key={route.key} onPress={onPress} accessibilityRole="tab" accessibilityState={{ selected: focused }} className="-mt-6 flex-1 items-center gap-1">
|
||||
<View className="size-[68px] items-center justify-center rounded-full" style={{ backgroundColor: night ? 'rgb(18 24 60 / 0.9)' : 'rgb(255 255 255 / 0.85)' }}>
|
||||
<LinearGradient colors={['#ffb067', '#ff7a45', '#d4552a']} locations={[0, 0.55, 1]} start={{ x: 0.3, y: 0 }} end={{ x: 0.7, y: 1 }} style={{ width: 60, height: 60, borderRadius: 30, alignItems: 'center', justifyContent: 'center', boxShadow: '0 8px 18px rgb(255 122 69 / 0.45)' }}>
|
||||
<TabIcon name="today" size={30} color="#fff" strokeWidth={2.6} />
|
||||
</LinearGradient>
|
||||
</View>
|
||||
<Text className="text-[12px] font-extrabold" style={{ color: focused ? orange : ink3 }}>
|
||||
{label}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
return (
|
||||
<Pressable key={route.key} onPress={onPress} accessibilityRole="tab" accessibilityState={{ selected: focused }} className="flex-1 items-center gap-0.5">
|
||||
<TabIcon name={icon} size={25} color={focused ? ink : ink3} strokeWidth={focused ? 2.4 : 1.9} />
|
||||
<Text className="text-[11px] font-extrabold" style={{ color: focused ? ink : ink3 }}>
|
||||
{label}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user