Skip to content

Commit

Permalink
fix: allow deleting storage item
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Aug 27, 2024
1 parent 17a9dbe commit df5bef7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "../lib/applyGlobalPolyfills";
import "~/global.css";
import { Text } from '~/components/ui/text';
import { Theme, ThemeProvider } from "@react-navigation/native";
import { router, SplashScreen, Stack } from "expo-router";
import { Link, router, SplashScreen, Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import * as React from "react";
import { SafeAreaView } from "react-native";
Expand Down Expand Up @@ -78,6 +78,11 @@ export default function RootLayout() {
return null;
}

async function reset() {
await AsyncStorage.removeItem("hasOnboarded");
router.navigate("/")
}

return (
<SWRConfig value={swrConfiguration}>
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
Expand All @@ -86,6 +91,9 @@ export default function RootLayout() {
<SafeAreaView className="w-full h-full">
<Stack />
<Toast config={toastConfig} position="bottom" />
<Button size="lg" onPress={reset}>
<Text>Delete</Text>
</Button>
</SafeAreaView>
</ThemeProvider>
</SWRConfig>
Expand Down

0 comments on commit df5bef7

Please sign in to comment.