feat: add expo mobile application source code

This commit is contained in:
2026-05-21 16:06:35 +07:00
parent 76d7a5c5c6
commit 0c65a7811b
77 changed files with 20356 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { useState } from 'react';
export function useForm<T>(initialValues: T) {
const [values, setValues] = useState<T>(initialValues);
const [errors, setErrors] = useState<Partial<Record<keyof T, string>>>({});
const handleChange = (name: keyof T, value: string) => {
setValues({
...values,
[name]: value,
});
// Clear error when user types
if (errors[name]) {
setErrors({
...errors,
[name]: undefined,
});
}
};
const setFieldError = (name: keyof T, error: string) => {
setErrors({
...errors,
[name]: error,
});
};
return {
values,
errors,
handleChange,
setFieldError,
setValues,
};
}