Files
o2o-weather/mobile/src/app/_layout.tsx
T

31 lines
910 B
TypeScript

import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import { useCallback, useEffect } from 'react';
import '@/global.css';
import { WebShell } from '@/components/web-shell';
SplashScreen.preventAutoHideAsync();
/** 웹이 뜨지 않아도 시작 화면에 갇히지 않게 하는 최대 대기 시간 */
const SPLASH_MAX_MS = 8000;
/** 앱은 날씨각 웹을 띄우는 껍데기 하나뿐이다. 화면 이동은 모두 웹이 한다 */
export default function RootLayout() {
const hideSplash = useCallback(() => {
SplashScreen.hideAsync().catch((e: unknown) => console.warn('[splash] 숨기지 못함', e));
}, []);
useEffect(() => {
const t = setTimeout(hideSplash, SPLASH_MAX_MS);
return () => clearTimeout(t);
}, [hideSplash]);
return (
<>
<StatusBar style="dark" />
<WebShell onReady={hideSplash} />
</>
);
}