diff --git a/examples/react-native-expo/.env.example b/examples/react-native-expo/.env.example index ac824288..9e2ab3e6 100644 --- a/examples/react-native-expo/.env.example +++ b/examples/react-native-expo/.env.example @@ -1,3 +1,4 @@ +EXPO_PUBLIC_QUILTT_CLIENT_ID="GET_THIS_ID_FROM_YOUR_DASHBOARD" EXPO_PUBLIC_QUILTT_AUTH_TOKEN="GET_THIS_TOKEN_FROM_YOUR_SERVER" EXPO_PUBLIC_CONNECTOR_ID="GET_THIS_ID_FROM_YOUR_DASHBOARD" EXPO_PUBLIC_HTTPS_APP_LINK="YOUR_APP_LINK" diff --git a/examples/react-native-expo/app/(tabs)/_layout.tsx b/examples/react-native-expo/app/(tabs)/_layout.tsx index 997403f4..69688e03 100644 --- a/examples/react-native-expo/app/(tabs)/_layout.tsx +++ b/examples/react-native-expo/app/(tabs)/_layout.tsx @@ -11,6 +11,10 @@ export default function TabLayout() { return ( { + router.canGoBack() ? router.back() : router.push('(tabs)') + } + return ( { console.log(metadata.connectionId) - router.navigate('/index') + navigateBack() + }} + onExitAbort={() => { + navigateBack() }} - onExitAbort={() => router.navigate('/index')} onExitError={(metadata: ConnectorSDKCallbackMetadata) => { console.log(metadata.connectorId) - router.navigate('/index') + navigateBack() }} /> ) } - -const styles = StyleSheet.create({ - container: { - gap: 8, - marginBottom: 8, - minHeight: '100%', - width: '100%', - }, -}) diff --git a/examples/react-native-expo/app/(tabs)/index.tsx b/examples/react-native-expo/app/(tabs)/index.tsx index 8601a0d7..61308629 100644 --- a/examples/react-native-expo/app/(tabs)/index.tsx +++ b/examples/react-native-expo/app/(tabs)/index.tsx @@ -5,8 +5,39 @@ import { PageView } from '@/components/PageView' import { ThemedText } from '@/components/ThemedText' import { ThemedView } from '@/components/ThemedView' import { ButtonLink } from '@/components/ButtonLink' +import { useQuery, gql } from '@quiltt/react-native' +import { useEffect } from 'react' +import { Colors } from '@/constants/Colors' + +const SAMPLE_QUERY = gql` + query SampleQuery { + profile { + id + name + email + } + connections(filter: { status: [INITIALIZING, SYNCING, SYNCED] }) { + id + institution { + id + name + } + } + } +` export default function HomeScreen() { + const { data, error, loading } = useQuery<{ + profile: { id: string; name: string; email: string } + connections: { id: string; institution: { id: string; name: string } }[] + }>(SAMPLE_QUERY as any) // TODO: Fix type error + + useEffect(() => { + if (error) { + console.error(error) + } + }, [error]) + return ( Launch Connector + + {loading ? ( + Loading... + ) : ( + + + Profile + ID: {data?.profile?.id} + Name: {data?.profile?.name} + Email: {data?.profile?.email} + + {data?.connections && data?.connections?.length >= 1 ? ( + + Connections + {data.connections.map((item, index) => ( + + ID: {item.institution.id} + Name: {item.institution.name} + + ))} + + ) : null} + + )} ) } const styles = StyleSheet.create({ container: { - gap: 8, - marginBottom: 8, + gap: 4, + marginBottom: 16, + }, + title: { + fontSize: 24, + fontWeight: 'bold', + marginTop: 8, + }, + listItem: { + gap: 2, + borderBottomColor: Colors.light.muted, + borderBottomWidth: 1, + paddingVertical: 8, + }, + listItemLast: { + gap: 2, + borderBottomColor: Colors.light.muted, + borderBottomWidth: 0, + paddingVertical: 8, }, }) diff --git a/examples/react-native-expo/app/+not-found.tsx b/examples/react-native-expo/app/+not-found.tsx index 3630a723..401178fc 100644 --- a/examples/react-native-expo/app/+not-found.tsx +++ b/examples/react-native-expo/app/+not-found.tsx @@ -3,12 +3,11 @@ import { StyleSheet } from 'react-native' import { ThemedText } from '@/components/ThemedText' import { ThemedView } from '@/components/ThemedView' -import { Colors } from '@/constants/Colors' export default function NotFoundScreen() { return ( <> - + This screen doesn't exist. @@ -29,6 +28,5 @@ const styles = StyleSheet.create({ link: { marginTop: 15, paddingVertical: 15, - color: Colors.light.tint, }, }) diff --git a/examples/react-native-expo/app/_layout.tsx b/examples/react-native-expo/app/_layout.tsx index 4bc07139..18df4b04 100644 --- a/examples/react-native-expo/app/_layout.tsx +++ b/examples/react-native-expo/app/_layout.tsx @@ -8,6 +8,7 @@ import { QuilttProvider } from '@quiltt/react-native' import { useColorScheme } from '@/hooks/useColorScheme' import * as Linking from 'expo-linking' +const QUILTT_CLIENT_ID = process.env.EXPO_PUBLIC_QUILTT_CLIENT_ID const QUILTT_AUTH_TOKEN = process.env.EXPO_PUBLIC_QUILTT_AUTH_TOKEN // Prevent the splash screen from auto-hiding before asset loading is complete. @@ -44,7 +45,7 @@ export default function RootLayout() { return ( - + diff --git a/examples/react-native-expo/assets/images/quiltt-logo-partial.png b/examples/react-native-expo/assets/images/quiltt-logo-partial.png index d5a5fc6b..786aa8bd 100644 Binary files a/examples/react-native-expo/assets/images/quiltt-logo-partial.png and b/examples/react-native-expo/assets/images/quiltt-logo-partial.png differ diff --git a/examples/react-native-expo/components/ButtonLink.tsx b/examples/react-native-expo/components/ButtonLink.tsx index 18f38844..5b5bb6af 100644 --- a/examples/react-native-expo/components/ButtonLink.tsx +++ b/examples/react-native-expo/components/ButtonLink.tsx @@ -2,11 +2,14 @@ import { Link } from 'expo-router' import type { ComponentProps } from 'react' import { StyleSheet, Text } from 'react-native' import { Colors } from '@/constants/Colors' +import { useThemeColor } from '@/hooks/useThemeColor' type ButtonLinkProps = ComponentProps export function ButtonLink({ href, style, children, ...props }: ButtonLinkProps) { - const mergedStyle = [styles.button, style] + const tintColor = useThemeColor({}, 'tint') + + const mergedStyle = [{ ...styles.button, backgroundColor: tintColor }, style] return ( {children} diff --git a/examples/react-native-expo/components/PageView.tsx b/examples/react-native-expo/components/PageView.tsx index a97a003d..ad541d1c 100644 --- a/examples/react-native-expo/components/PageView.tsx +++ b/examples/react-native-expo/components/PageView.tsx @@ -1,8 +1,8 @@ import { Image, StyleSheet } from 'react-native' - import { ParallaxScrollView } from '@/components/ParallaxScrollView' import { ThemedText } from '@/components/ThemedText' import { ThemedView } from '@/components/ThemedView' +import { useThemeColor } from '@/hooks/useThemeColor' type PageViewProps = { children: React.ReactNode @@ -10,9 +10,10 @@ type PageViewProps = { } export const PageView = ({ children, title }: PageViewProps) => { + const muted = useThemeColor({}, 'muted') return ( } @@ -39,10 +40,12 @@ const styles = StyleSheet.create({ gap: 8, }, logo: { - height: 178, - width: 290, + height: 128, + width: 360, bottom: 0, left: 0, + top: 0, + right: 0, position: 'absolute', }, }) diff --git a/examples/react-native-expo/components/ParallaxScrollView.tsx b/examples/react-native-expo/components/ParallaxScrollView.tsx index 04721f53..0f0084fd 100644 --- a/examples/react-native-expo/components/ParallaxScrollView.tsx +++ b/examples/react-native-expo/components/ParallaxScrollView.tsx @@ -61,7 +61,7 @@ const styles = StyleSheet.create({ flex: 1, }, header: { - height: 250, + height: 128, overflow: 'hidden', }, content: { diff --git a/examples/react-native-expo/components/ThemedText.tsx b/examples/react-native-expo/components/ThemedText.tsx index 8906b76c..0a2b8ba0 100644 --- a/examples/react-native-expo/components/ThemedText.tsx +++ b/examples/react-native-expo/components/ThemedText.tsx @@ -1,6 +1,7 @@ import { Text, type TextProps, StyleSheet } from 'react-native' import { useThemeColor } from '@/hooks/useThemeColor' +import { Colors } from '@/constants/Colors' export type ThemedTextProps = TextProps & { lightColor?: string @@ -16,6 +17,7 @@ export function ThemedText({ ...rest }: ThemedTextProps) { const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text') + const tintColor = useThemeColor({ light: lightColor, dark: darkColor }, 'tint') return (