Skip to content

Commit

Permalink
feat: add screen title, text styling, Button components
Browse files Browse the repository at this point in the history
Adding styling to text for user info and using Button component for standard styling.
Adding layout styling for signed out view to flex buttons, updating links to Buttons
for standard styling.

Signed-off-by: Kenton Duprey <[email protected]>
  • Loading branch information
kduprey committed Sep 4, 2024
1 parent fccdb0d commit 60479e1
Showing 1 changed file with 60 additions and 22 deletions.
82 changes: 60 additions & 22 deletions app/(home)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,64 @@
import { SignedIn, SignedOut, useUser } from "@clerk/clerk-expo";
import { Link } from "expo-router";
import { Text, View } from "react-native";
import { SignedIn, SignedOut, useAuth, useUser } from "@clerk/clerk-expo";
import { Stack, router } from "expo-router";
import { Button, Text, View } from "react-native";

export default function Page() {
const { user } = useUser();
const { user } = useUser();
const { signOut } = useAuth();

return (
<View>
<SignedIn>
<Text>Welcome, {user?.emailAddresses[0].emailAddress}</Text>
</SignedIn>
<SignedOut>
<View>
<Text>Clerk 🤝 Expo</Text>
<Link href="/sign-in">
<Text>Sign In</Text>
</Link>
<Link href="/sign-up">
<Text>Sign Up</Text>
</Link>
</View>
</SignedOut>
</View>
);
return (
<View>
<Stack.Screen options={{ title: "Home" }} />
<SignedIn>
<Text
style={{
padding: 10,
fontSize: 24,
}}
>
Welcome, {user?.emailAddresses[0].emailAddress}
</Text>
<Button
title="Sign Out"
onPress={() => {
signOut().then(() => {
router.replace("/");
});
}}
/>
</SignedIn>
<SignedOut>
<View
style={{
display: "flex",
flexDirection: "column",
padding: 10,
gap: 10,
}}
>
<Text
style={{
fontSize: 24,
fontWeight: "bold",
textAlign: "center",
}}
>
Clerk 🤝 Expo
</Text>
<Button
title="Sign In"
onPress={() => {
router.push("/sign-in");
}}
/>
<Button
title="Sign Up"
onPress={() => {
router.push("/sign-up");
}}
/>
</View>
</SignedOut>
</View>
);
}

0 comments on commit 60479e1

Please sign in to comment.