1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
import { Link } from 'expo-router';
import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
import theme from '@/theme';
import { useRegister } from '@/features/auth/hooks/useRegister';
import { StatusMessage } from '@/shared/ui/StatusMessage';
const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme;
export default function RegisterScreen() {
// hook de registro
const {
displayName,
email,
password,
setDisplayName,
setEmail,
setPassword,
submit,
isSubmitting,
error,
} = useRegister();
return (
<View style={styles.container}>
{/* contenido central acotado */}
<View style={styles.content}>
{/* icono superior */}
<View style={styles.iconBox}>
<MaterialIcons name="business" size={28} color={colors.white} />
</View>
{/* titulo principal */}
<Text style={styles.title}>Crear cuenta</Text>
{/* subtitulo */}
<Text style={styles.subtitle}>Únete a App Oficina hoy mismo</Text>
{/* tarjeta del formulario */}
<View style={styles.formCard}>
{/* campo nombre */}
<Text style={styles.label}>Nombre completo</Text>
<TextInput
style={styles.input}
placeholder="Ej: Juan Pérez"
placeholderTextColor={colors.textSecondary}
value={displayName}
onChangeText={setDisplayName}
/>
{/* campo correo */}
<Text style={styles.label}>Correo electrónico</Text>
<TextInput
style={styles.input}
placeholder="tu@email.com"
placeholderTextColor={colors.textSecondary}
autoCapitalize="none"
keyboardType="email-address"
value={email}
onChangeText={setEmail}
/>
{/* campo contraseña */}
<Text style={styles.label}>Contraseña</Text>
<TextInput
style={styles.input}
placeholder="Mínimo 8 caracteres"
placeholderTextColor={colors.textSecondary}
secureTextEntry
value={password}
onChangeText={setPassword}
/>
{/* mensaje de error */}
{error ? <StatusMessage message={error} /> : null}
{/* boton principal */}
<Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
<Text style={styles.buttonText}>
{isSubmitting ? 'Registrando...' : 'Crear cuenta'}
</Text>
</Pressable>
</View>
{/* enlace inferior a login */}
<Link href="/(auth)/login" style={styles.link}>
¿Ya tienes cuenta? <Text style={styles.linkHighlight}>Inicia sesión</Text>
</Link>
</View>
</View>
);
}
const styles = StyleSheet.create({
// contenedor principal de la pantalla
container: {
flex: 1,
backgroundColor: colors.background,
},
// contenido central acotado y centrado
content: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: spacing.xl,
paddingTop: spacing.xl,
paddingBottom: spacing.xl,
gap: spacing.lg,
maxWidth: layout.contentWidth,
width: '100%',
alignSelf: 'center',
},
// caja azul del icono superior
iconBox: {
width: 56,
height: 56,
borderRadius: radius.lg,
backgroundColor: colors.primary,
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'center',
...shadows.card,
},
// titulo principal
title: {
fontSize: 36,
fontWeight: fontWeight.semibold,
color: colors.text,
textAlign: 'center',
},
// subtitulo explicativo
subtitle: {
fontSize: typography.md,
color: colors.textSecondary,
textAlign: 'center',
lineHeight: 22,
},
// tarjeta del formulario de registro
formCard: {
width: '100%',
backgroundColor: colors.surface,
borderRadius: radius.xxl,
borderWidth: 1,
borderColor: colors.border,
padding: spacing.lg,
gap: spacing.md,
...shadows.card,
},
// texto de etiqueta de los inputs
label: {
fontSize: typography.sm,
color: colors.text,
fontWeight: fontWeight.medium,
},
// input de formulario
input: {
borderWidth: 1,
borderColor: colors.border,
borderRadius: radius.md,
paddingHorizontal: spacing.lg,
paddingVertical: spacing.md,
backgroundColor: colors.background,
color: colors.text,
},
// boton principal
button: {
backgroundColor: colors.primary,
paddingVertical: spacing.lg,
borderRadius: radius.md,
alignItems: 'center',
justifyContent: 'center',
marginTop: spacing.sm,
},
// texto del boton principal
buttonText: {
color: colors.white,
fontWeight: fontWeight.semibold,
fontSize: typography.md,
},
// enlace inferior
link: {
marginTop: spacing.sm,
fontSize: typography.md,
color: colors.textSecondary,
textAlign: 'center',
},
// parte destacada del enlace
linkHighlight: {
color: colors.primary,
fontWeight: fontWeight.medium,
},
});
|