Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

409
Views
cómo activar la validación en React Hook Form en React Native Expo Web

¿Cómo puedo activar manualmente la validación de formularios en React Hook Form? Me gustaría lograr el efecto de handleSubmit, pero en el controlador de eventos de pulsación de tecla y handleSubmit no parece funcionar fuera de onPress. En el controlador onPress, mi código se ve así

 <Button color={enter ? COLORS.greys["gray-100"] : COLORS.TERTIARY} textColor={COLORS.FONT_COLOR} onPress={handleSubmit((data) => onSubmit(data))} > Enter </Button>

y cuando hago clic en este botón y los campos no son válidos, aparece el mensaje de error, quiero hacer lo mismo si el usuario hace clic en Entrar, pero este código no funciona

 const changeView = (e: KeyboardEvent) => { if (e.key === "Enter") { handleSubmit((data) => onSubmit(data)); } }; useEffect(() => { document.body.addEventListener("keydown", changeView); return () => { document.body.removeEventListener("keydown", changeView); }; }, []);

Utilizo el enlace getValues con onSubmit para que funcione, pero si los campos no son válidos, el formulario no se valida.

 const changeView = (e: KeyboardEvent) => { if (e.key === "Enter") { onSubmit(getValues()); } };

¿Cómo puedo validar el formulario en el controlador del detector de eventos?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

puede usar fromik para formar la biblioteca y sí la biblioteca para la validación, esto es útil

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!