import { StyleSheet, Text, TextInput, Pressable, View } from 'react-native' import { useState } from 'react' import { handleLogin } from '../utils/helpers' const Login = ({ setSession, showError }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const disabled = (e, p) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) || p.length < 6; return ( Login to Notes Account can be created through apps.pruss.it website setEmail(e.nativeEvent.text.toLowerCase())} /> setPassword(e.nativeEvent.text)} /> handleLogin({ email, password, setSession, showError })} style={{...styles.button, opacity: disabled(email, password) ? .3 : 1}} disabled={disabled(email, password)} > Login ); }; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', height: '100%' }, title: { color: 'white', fontSize: 26, marginBottom: 40, }, text: { color: 'white', marginBottom: 50, }, input: { height: 50, width: 280, padding: 10, marginBottom: 20, color: 'white', backgroundColor: '#444', borderColor: '#aaa', borderWidth: 1, borderStyle: 'solid', borderRadius: 10, }, button: { width: 100, height: 40, backgroundColor: '#666', borderRadius: 5, marginTop: 40, alignItems: 'center', justifyContent: 'center', }, buttonText: { color: 'white', } }); export default Login;