MCPcopy Create free account
hub / github.com/TanStack/db / RootLayout

Function RootLayout

examples/react-native/shopping-list/app/_layout.tsx:152–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150}
151
152export default function RootLayout() {
153 const [refreshKey, setRefreshKey] = useState(0)
154 const refreshApp = useCallback(() => {
155 queryClient.clear()
156 setRefreshKey((current) => current + 1)
157 }, [])
158
159 return (
160 <SafeAreaProvider>
161 <QueryClientProvider client={queryClient} key={refreshKey}>
162 <ShoppingProvider key={refreshKey}>
163 <StatusBar style="dark" translucent={false} />
164 <Stack
165 screenOptions={{
166 ...(Platform.OS === `android`
167 ? {
168 statusBarTranslucent: false,
169 statusBarStyle: `dark` as const,
170 }
171 : {}),
172 headerRight: () => <HeaderControls onAppRefresh={refreshApp} />,
173 }}
174 >
175 <Stack.Screen name="index" options={{ title: `Shopping Lists` }} />
176 <Stack.Screen name="list/[id]" options={{ title: `List` }} />
177 </Stack>
178 </ShoppingProvider>
179 </QueryClientProvider>
180 </SafeAreaProvider>
181 )
182}
183
184const styles = StyleSheet.create({
185 modalRoot: {

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected