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,54 @@
|
||||
import '@/lib/api';
|
||||
import { BagelFatOne_400Regular } from '@expo-google-fonts/bagel-fat-one';
|
||||
import { Jua_400Regular, useFonts } from '@expo-google-fonts/jua';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { Tabs } from 'expo-router/tabs';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from 'react';
|
||||
import { View } from 'react-native';
|
||||
|
||||
import '@/global.css';
|
||||
import { SkyBg } from '@/components/sky-bg';
|
||||
import { TabBar } from '@/components/tab-bar';
|
||||
import { TopBar } from '@/components/top-bar';
|
||||
import { queryClient } from '@/lib/query-client';
|
||||
import { RegionProvider } from '@/lib/region';
|
||||
import { SkyProvider, useSky } from '@/lib/sky';
|
||||
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
|
||||
function Shell() {
|
||||
const { kind } = useSky();
|
||||
return (
|
||||
<View className="flex-1">
|
||||
<SkyBg />
|
||||
<StatusBar style={kind === 'night' ? 'light' : 'dark'} />
|
||||
<Tabs initialRouteName="index" tabBar={(props) => <TabBar {...props} />} screenOptions={{ header: () => <TopBar />, sceneStyle: { backgroundColor: 'transparent' } }}>
|
||||
{/* 메인인 오늘 탭을 가운데에 */}
|
||||
<Tabs.Screen name="sky" />
|
||||
<Tabs.Screen name="gak" />
|
||||
<Tabs.Screen name="index" />
|
||||
<Tabs.Screen name="week" />
|
||||
<Tabs.Screen name="season" />
|
||||
</Tabs>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default function RootLayout() {
|
||||
const [loaded, error] = useFonts({ Jua_400Regular, BagelFatOne_400Regular });
|
||||
useEffect(() => {
|
||||
if (loaded || error) SplashScreen.hideAsync();
|
||||
}, [loaded, error]);
|
||||
if (!loaded && !error) return null;
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SkyProvider>
|
||||
<RegionProvider>
|
||||
<Shell />
|
||||
</RegionProvider>
|
||||
</SkyProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="오늘의 각" />;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { getFeedOptions, getWeatherTodayOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { kst, loadOf } from '@nalssigak/shared/lib';
|
||||
import { atSlot, PREVIEW } from '@nalssigak/shared/lib/today';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { RefreshControl, ScrollView } from 'react-native';
|
||||
|
||||
import { Hero } from '@/components/today/hero';
|
||||
import { EventsBand, SeasonBand, Stories, StoriesSkel, TopBand } from '@/components/today/rails';
|
||||
import { Sec, StateBox } from '@/components/ui';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
export default function TodayScreen() {
|
||||
const { region } = useRegion();
|
||||
const feed = useQuery(getFeedOptions({ query: { region: region.code } }));
|
||||
const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }));
|
||||
const { preview } = useSky();
|
||||
const f = feed.data;
|
||||
const stories = atSlot(f?.stories ?? [], preview);
|
||||
const sloted = preview != null && stories !== f?.stories;
|
||||
const bands = f?.bands;
|
||||
const nowAt = f?.hero?.now_at;
|
||||
const load = loadOf(feed);
|
||||
const refresh = () => Promise.all([feed.refetch(), today.refetch()]);
|
||||
|
||||
return (
|
||||
<ScrollView key={region.code} contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={feed.isRefetching && !feed.isPlaceholderData} onRefresh={refresh} />} style={{ opacity: feed.isPlaceholderData ? 0.6 : 1 }}>
|
||||
<Hero hero={f?.hero} today={today.data} ranked={stories} feedLoad={load} todayLoad={loadOf(today)} />
|
||||
<Sec title="오늘의 각" sub="누르면 계산 근거를 보여 줘요" more="/gak" />
|
||||
{stories.length ? <Stories items={stories} /> : load === 'loading' ? <StoriesSkel /> : <StateBox load={load} onRetry={() => feed.refetch()} empty="오늘 계산된 각이 없어요." />}
|
||||
{!!bands?.events?.length && <EventsBand events={bands.events} />}
|
||||
{!!bands?.top5?.length && <TopBand items={sloted ? stories.filter((g) => g.active) : bands.top5} sub={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} />}
|
||||
{!!bands?.season?.length && <SeasonBand news={bands.season} />}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="계절·상식" />;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="노을" />;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="주말·행사" />;
|
||||
}
|
||||
Reference in new issue
Block a user