"use client" /* * File: NameScreen.tsx * Description: Name input screen with gradient background and shared components. * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import type React from "react" import { useState } from "react" import { View, Text, StyleSheet, TextInput } from "react-native" import { Button } from "../../../../shared/src/components/Button" import OnboardingContainer from "./OnboardingContainer" import IconContainer from "./IconContainer" import { Colors, Spacing, Typography } from "../../../../shared/src/theme" import { showError } from "../../../../shared/src/utils/helpers/Toast" import Icon from "react-native-vector-icons/Feather" interface NameScreenProps { onContinue: (firstName: string, lastName: string, username: string) => void onBack: () => void } const NameScreen: React.FC = ({ onContinue, onBack }) => { const [firstName, setFirstName] = useState("") const [lastName, setLastName] = useState("") const [username, setUsername] = useState("") const [loading, setLoading] = useState(false) const handleContinue = () => { if (!firstName.trim() || !lastName.trim() || !username.trim()) { showError("Validation Error", "First name, last name, and username are required.") return } if (firstName.trim().length < 2 ) { showError("Validation Error", "Names must be at least 2 characters long.") return } if (username.trim().length < 3) { showError("Validation Error", "Username must be at least 3 characters long.") return } // Basic username validation (alphanumeric and underscores only) const usernameRegex = /^[a-zA-Z0-9_]+$/ if (!usernameRegex.test(username.trim())) { showError("Validation Error", "Username can only contain letters, numbers, and underscores.") return } setLoading(true) setTimeout(() => { setLoading(false) onContinue(firstName.trim(), lastName.trim(), username.trim()) }, 1000) } return ( What's your name? Please enter your details to get started.