import { useSignIn } from '@clerk/clerk-expo' import { router } from 'expo-router' import React from 'react' import { StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native' export default function LoginScreen() { const { signIn, setActive, isLoaded } = useSignIn() const [username, setUsername] = React.useState('') const [password, setPassword] = React.useState('') async function handleSignIn() { if (!isLoaded) return try { const signInAttempt = await signIn.create({ identifier: username, password }) if (signInAttempt.status === 'complete') { await setActive({ session: signInAttempt.createdSessionId }) router.replace('/') } } catch (e) { console.log(JSON.stringify(e)) } } return ( Login Username Password { handleSignIn() }} > Login Don't have an account? { router.navigate('/sign-up') }} > Sign Up {' '} ) } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#25292e', justifyContent: 'center', alignItems: 'center' }, text: { color: '#fff' }, textCenter: { color: '#ffffff', alignSelf: 'center', marginBottom: 6 }, textlabel: { color: '#fff', marginBottom: 3 }, input: { backgroundColor: '#fff', borderRadius: 5, padding: 10, marginBottom: 15 }, button: { backgroundColor: '#1e90ff', padding: 12, borderRadius: 5, alignItems: 'center', marginBottom: 15 }, signup: { alignItems: 'center' } })