-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/clerk web + shared + mobile #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5bde57c
60ec0bb
8860a44
f1572ac
3aeb818
ff61b60
b34d21b
e5db37f
71db057
8ec5112
2313fcd
9cd090a
7993abf
04ba537
470609e
c0241bb
9b283aa
4300a2e
878f1ae
559bd12
8a1fe65
ceeeb8a
103a2bf
c9629e1
d4ed3d8
52c6054
79b744b
66451d6
d80c454
d863ea3
3fef9d7
0039f41
23c6e43
2ce9786
144c7a6
c7581ee
0b98013
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,8 @@ | |
| "userInterfaceStyle": "automatic", | ||
| "newArchEnabled": true, | ||
| "ios": { | ||
| "supportsTablet": true | ||
| "supportsTablet": true, | ||
| "bundleIdentifier": "com.anonymous.mobile" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this needed? Lmk if it was just a part of an install
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. part of an install I believe, because I did not add it manually |
||
| }, | ||
| "android": { | ||
| "adaptiveIcon": { | ||
|
|
@@ -38,7 +39,8 @@ | |
| "backgroundColor": "#000000" | ||
| } | ||
| } | ||
| ] | ||
| ], | ||
| "expo-secure-store" | ||
| ], | ||
| "experiments": { | ||
| "typedRoutes": true, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,20 @@ | ||
| import { | ||
| DarkTheme, | ||
| DefaultTheme, | ||
| ThemeProvider, | ||
| } from "@react-navigation/native"; | ||
| import { Stack } from "expo-router"; | ||
| import { StatusBar } from "expo-status-bar"; | ||
| import { SafeAreaProvider } from "react-native-safe-area-context"; | ||
| import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
| import "react-native-reanimated"; | ||
| import "../global.css"; | ||
| import { | ||
| DarkTheme, | ||
| DefaultTheme, | ||
| ThemeProvider, | ||
| } from "@react-navigation/native"; | ||
|
|
||
| import { tokenCache } from "@clerk/clerk-expo/token-cache"; | ||
| import { ClerkProvider, ClerkLoaded, useAuth } from "@clerk/clerk-expo"; | ||
| import { useColorScheme } from "@/hooks/use-color-scheme"; | ||
| import { setConfig } from "@shared"; | ||
| import { useEffect } from "react"; | ||
|
|
||
| // Client explicity created outside component to avoid recreation | ||
| const queryClient = new QueryClient({ | ||
|
|
@@ -27,25 +31,43 @@ export const unstable_settings = { | |
| anchor: "(tabs)", | ||
| }; | ||
|
|
||
| // Component to configure auth provider and the api base url | ||
| function AppConfigurator() { | ||
| const { getToken } = useAuth() | ||
| useEffect(() => { | ||
| setConfig({ API_BASE_URL: process.env.EXPO_PUBLIC_API_BASE_URL ?? '', getToken }) | ||
| }, [getToken]) | ||
|
|
||
| return null | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I see why you did it this way originally, if the getToken updates (cases like logouts), we want to also update our provider. Sorry for the misdirection, I think this useEffect approach works better relative to our new structure. |
||
|
|
||
| export default function RootLayout() { | ||
| const colorScheme = useColorScheme(); | ||
|
|
||
| return ( | ||
| <QueryClientProvider client={queryClient}> | ||
| <SafeAreaProvider> | ||
| <ThemeProvider | ||
| value={colorScheme === "dark" ? DarkTheme : DefaultTheme} | ||
| > | ||
| <Stack> | ||
| <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> | ||
| <Stack.Screen | ||
| name="modal" | ||
| options={{ presentation: "modal", title: "Modal" }} | ||
| /> | ||
| </Stack> | ||
| <StatusBar style="auto" /> | ||
| </ThemeProvider> | ||
| </SafeAreaProvider> | ||
| </QueryClientProvider> | ||
| <ClerkProvider | ||
| publishableKey={process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!} | ||
| tokenCache={tokenCache} | ||
| > | ||
| <ClerkLoaded> | ||
| <AppConfigurator /> | ||
| <QueryClientProvider client={queryClient}> | ||
| <SafeAreaProvider> | ||
| <ThemeProvider | ||
| value={colorScheme === "dark" ? DarkTheme : DefaultTheme} | ||
| > | ||
| <Stack> | ||
| <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> | ||
| <Stack.Screen | ||
| name="modal" | ||
| options={{ presentation: "modal", title: "Modal" }} | ||
| /> | ||
| </Stack> | ||
| <StatusBar style="auto" /> | ||
| </ThemeProvider> | ||
| </SafeAreaProvider> | ||
| </QueryClientProvider> | ||
| </ClerkLoaded> | ||
| </ClerkProvider> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { StyleSheet, Text, View } from "react-native"; | ||
|
|
||
| export default function Page() { | ||
| return ( | ||
| <View className="flex-1 items-center p-6"> | ||
| <View className="flex-1 justify-center max-w-4xl mx-auto"> | ||
| <Text className="text-6xl font-bold">Hello</Text> | ||
| <Text className="text-4xl text-gray-700">World</Text> | ||
| </View> | ||
| </View> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,34 @@ | ||
| import { render } from '@testing-library/react-native'; | ||
| import { ThemedText } from '../themed-text'; | ||
| import { render } from "@testing-library/react-native"; | ||
| import { ThemedText } from "../themed-text"; | ||
|
|
||
| describe('ThemedText', () => { | ||
| it('renders text content', () => { | ||
| describe("ThemedText", () => { | ||
| it("renders text content", () => { | ||
| const { getByText } = render(<ThemedText>Hello World</ThemedText>); | ||
| expect(getByText('Hello World')).toBeTruthy(); | ||
| expect(getByText("Hello World")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('applies title className', () => { | ||
| it("applies title className", () => { | ||
| const { getByText } = render(<ThemedText type="title">Title</ThemedText>); | ||
| const element = getByText('Title'); | ||
| expect(element.props.className).toContain('text-[32px]'); | ||
| expect(element.props.className).toContain('font-bold'); | ||
| const element = getByText("Title"); | ||
| expect(element.props.className).toContain("text-[32px]"); | ||
| expect(element.props.className).toContain("font-bold"); | ||
| }); | ||
|
|
||
| it('applies custom className', () => { | ||
| it("applies custom className", () => { | ||
| const { getByText } = render( | ||
| <ThemedText className="text-red-500">Custom</ThemedText> | ||
| <ThemedText className="text-red-500">Custom</ThemedText>, | ||
| ); | ||
| const element = getByText('Custom'); | ||
| expect(element.props.className).toContain('text-red-500'); | ||
| const element = getByText("Custom"); | ||
| expect(element.props.className).toContain("text-red-500"); | ||
| }); | ||
|
|
||
| it('passes through props', () => { | ||
| it("passes through props", () => { | ||
| const { getByTestId } = render( | ||
| <ThemedText testID="test-text" numberOfLines={2}>Test</ThemedText> | ||
| <ThemedText testID="test-text" numberOfLines={2}> | ||
| Test | ||
| </ThemedText>, | ||
| ); | ||
| const element = getByTestId('test-text'); | ||
| const element = getByTestId("test-text"); | ||
| expect(element.props.numberOfLines).toBe(2); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this * for now, ideally you don't want to limit this to be localhost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think fiber does not allow the "*" when you require credentials, if I change it to the star the server crashes