| 150 | } |
| 151 | |
| 152 | export 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 | |
| 184 | const styles = StyleSheet.create({ |
| 185 | modalRoot: { |