@@ -12,6 +12,7 @@ import { NAV_THEME } from "@/lib/constants";
1212import { useColorScheme } from "@/lib/useColorScheme" ;
1313import { getItem , setItem } from "@/lib/storage" ;
1414import { Platform } from "react-native" ;
15+ import { useFrameworkReady } from "@/hooks/useFrameworkReady" ;
1516
1617const NAV_FONT_FAMILY = "Inter-Black" ;
1718const LIGHT_THEME : Theme = {
@@ -75,6 +76,8 @@ export default function RootLayout() {
7576 const { colorScheme, setColorScheme } = useColorScheme ( ) ;
7677 const [ isColorSchemeLoaded , setIsColorSchemeLoaded ] = React . useState ( false ) ;
7778
79+ useFrameworkReady ( ) ;
80+
7881 React . useEffect ( ( ) => {
7982 ( async ( ) => {
8083 const theme = getItem ( "theme" ) ;
@@ -104,28 +107,24 @@ export default function RootLayout() {
104107 }
105108
106109 return (
107- < >
108- < DatabaseProvider >
109- < ThemeProvider value = { colorScheme === "dark" ? DARK_THEME : LIGHT_THEME } >
110- < StatusBar style = { colorScheme === "dark" ? "light" : "dark" } />
111- < GestureHandlerRootView style = { { flex : 1 } } >
112- < BottomSheetModalProvider >
113- < Stack >
114- < Stack . Screen name = "(tabs)" options = { { title : "Habits" , headerShown : false } } />
115- < Stack . Screen options = { {
116- headerShadowVisible : false ,
117- } } name = "habits/archive" />
118- < Stack . Screen options = { {
119- headerShadowVisible : false ,
120- } } name = "habits/[id]" />
121- </ Stack >
122- </ BottomSheetModalProvider >
123- </ GestureHandlerRootView >
124- </ ThemeProvider >
125-
126- </ DatabaseProvider >
110+ < DatabaseProvider >
111+ < ThemeProvider value = { colorScheme === "dark" ? DARK_THEME : LIGHT_THEME } >
112+ < StatusBar style = { colorScheme === "dark" ? "light" : "dark" } />
113+ < GestureHandlerRootView style = { { flex : 1 } } >
114+ < BottomSheetModalProvider >
115+ < Stack >
116+ < Stack . Screen name = "(tabs)" options = { { title : "Habits" , headerShown : false } } />
117+ < Stack . Screen options = { {
118+ headerShadowVisible : false ,
119+ } } name = "habits/archive" />
120+ < Stack . Screen options = { {
121+ headerShadowVisible : false ,
122+ } } name = "habits/[id]" />
123+ </ Stack >
124+ </ BottomSheetModalProvider >
125+ </ GestureHandlerRootView >
126+ </ ThemeProvider >
127127 < PortalHost />
128- </ >
129-
128+ </ DatabaseProvider >
130129 ) ;
131130}
0 commit comments