fix(mobile): align account creation with settings styles
This commit is contained in:
1 file changed
+69
-60
@@ -5,7 +5,6 @@ import { useEffect, useRef, useState } from "react"
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Switch,
|
||||
@@ -16,6 +15,7 @@ import { SafeAreaView } from "react-native-safe-area-context"
|
||||
import { toast } from "sonner-native"
|
||||
|
||||
import { Button, Input, LoadingView } from "@/components/ui/primitives"
|
||||
import { colors, spacing } from "@/lib/theme"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
|
||||
export default function CreateAccountScreen() {
|
||||
@@ -74,15 +74,6 @@ export default function CreateAccountScreen() {
|
||||
<SafeAreaView edges={["bottom", "left", "right"]} style={styles.screen}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
headerLeft: () => (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
onPress={() => router.back()}
|
||||
style={styles.back}
|
||||
>
|
||||
<Text style={styles.text}>‹ Users</Text>
|
||||
</Pressable>
|
||||
),
|
||||
gestureEnabled: !submitting,
|
||||
}}
|
||||
/>
|
||||
@@ -100,48 +91,60 @@ export default function CreateAccountScreen() {
|
||||
>
|
||||
<ScrollView
|
||||
contentContainerStyle={styles.form}
|
||||
removeClippedSubviews={false}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
keyboardDismissMode="on-drag"
|
||||
>
|
||||
<Text style={styles.text}>Name</Text>
|
||||
<Input
|
||||
accessibilityLabel="Name"
|
||||
value={name}
|
||||
onChangeText={setName}
|
||||
autoCapitalize="words"
|
||||
autoComplete="off"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
<Text style={styles.text}>Email</Text>
|
||||
<Input
|
||||
accessibilityLabel="Email"
|
||||
value={email}
|
||||
onChangeText={setEmail}
|
||||
keyboardType="email-address"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
autoComplete="off"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
<Text style={styles.text}>Password</Text>
|
||||
<Input
|
||||
accessibilityLabel="Password"
|
||||
value={password}
|
||||
onChangeText={setPassword}
|
||||
secureTextEntry
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
autoComplete="new-password"
|
||||
placeholder="At least 8 characters"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
<View style={styles.field}>
|
||||
<Text style={styles.label}>Name</Text>
|
||||
<Input
|
||||
accessibilityLabel="Name"
|
||||
value={name}
|
||||
onChangeText={setName}
|
||||
autoCapitalize="words"
|
||||
autoComplete="off"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.field}>
|
||||
<Text style={styles.label}>Email</Text>
|
||||
<Input
|
||||
accessibilityLabel="Email"
|
||||
value={email}
|
||||
onChangeText={setEmail}
|
||||
keyboardType="email-address"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
autoComplete="off"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.field}>
|
||||
<Text style={styles.label}>Password</Text>
|
||||
<Input
|
||||
accessibilityLabel="Password"
|
||||
value={password}
|
||||
onChangeText={setPassword}
|
||||
secureTextEntry
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
autoComplete="new-password"
|
||||
placeholder="At least 8 characters"
|
||||
editable={!submitting}
|
||||
style={styles.input}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.row}>
|
||||
<Text style={styles.text}>Grant admin access</Text>
|
||||
<Switch
|
||||
accessibilityLabel="Grant admin access"
|
||||
trackColor={{
|
||||
false: colors.dark.muted,
|
||||
true: colors.dark.primary,
|
||||
}}
|
||||
thumbColor={colors.dark.foreground}
|
||||
value={isAdmin}
|
||||
onValueChange={setIsAdmin}
|
||||
disabled={submitting}
|
||||
@@ -156,7 +159,10 @@ export default function CreateAccountScreen() {
|
||||
title={submitting ? "Creating account…" : "Create account"}
|
||||
disabled={submitting}
|
||||
onPress={() => void handleCreate()}
|
||||
tint={{ background: "#fff", foreground: "#000" }}
|
||||
tint={{
|
||||
background: colors.dark.primary,
|
||||
foreground: colors.dark.primaryForeground,
|
||||
}}
|
||||
/>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
@@ -167,25 +173,28 @@ export default function CreateAccountScreen() {
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
screen: { flex: 1, backgroundColor: "#000" },
|
||||
form: { padding: 24, gap: 12 },
|
||||
text: { color: "#fff", fontSize: 16 },
|
||||
form: { padding: spacing.lg, gap: spacing.lg },
|
||||
field: { gap: spacing.sm },
|
||||
label: {
|
||||
color: colors.dark.mutedForeground,
|
||||
fontSize: 12,
|
||||
fontWeight: "600",
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: 0.6,
|
||||
},
|
||||
text: { color: colors.dark.foreground, fontSize: 16, flexShrink: 1 },
|
||||
input: {
|
||||
backgroundColor: "#000",
|
||||
color: "#fff",
|
||||
borderRadius: 0,
|
||||
borderWidth: 0,
|
||||
borderBottomWidth: 1,
|
||||
borderColor: "#555",
|
||||
paddingHorizontal: 0,
|
||||
marginBottom: 12,
|
||||
backgroundColor: colors.dark.muted,
|
||||
color: colors.dark.foreground,
|
||||
borderColor: colors.dark.border,
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
paddingVertical: 12,
|
||||
gap: spacing.md,
|
||||
minHeight: 48,
|
||||
},
|
||||
back: { minHeight: 44, justifyContent: "center" },
|
||||
message: { padding: 24 },
|
||||
error: { color: "#ff7777" },
|
||||
message: { padding: spacing.lg },
|
||||
error: { color: colors.dark.destructive, fontSize: 14, lineHeight: 20 },
|
||||
})
|
||||
Reference in new issue
Block a user