npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-use-form-lite

v1.7.0

Published

Un hook personalizado y ligero para gestionar formularios en React Native de manera sencilla y eficiente. Facilita la captura y manejo de datos en formularios sin complicaciones, optimizando el proceso de integración y mejora la legibilidad del código.

Readme

react-native-use-form-lite

npm version GitHub Repo npm

Es una librería moderna, intuitiva, liviana, escalable y sobre todo flexible para manejar formularios en React Native de forma rápida y sencilla.

Vista previa

🚀 Demo

🌍 ¿Qué es react-native-use-form-lite?

react-native-use-form-lite es una librería de React Native que proporciona un pequeño hook (useFormLite) que facilita la captura y manejo de datos en formularios de React Native, eliminando la necesidad de escribir manualmente funciones de onChangeText, onValueChange, etc., para cada campo.

Ideal para proyectos que necesitan formularios dinámicos sin complicaciones.

✨ ¿Qué problema soluciona?

  • ✅ Simplifica la administración de estados en formularios.
  • ✅ Evita crear múltiples funciones onChange para cada input.
  • ✅ Soporta diferentes tipos de inputs (TextInput, Picker, Switch, etc.).
  • ✅ Mejora la legibilidad y escalabilidad de tus formularios.
  • ✅ Facilita el mantenimiento de formularios medianos a grandes.

📦 Instalación

npm install react-native-use-form-lite

🔧 Uso Básico

import { StyleSheet, View, TextInput, Switch, Button } from 'react-native';
import { useFormLite } from 'react-native-use-form-lite';
import { Picker } from '@react-native-picker/picker'; // npm install @react-native-picker/picker

const MyForm = () => {
  const { formData, register, resetForm, getEmptyFields } = useFormLite({
    name:'',
    email: '',
    isActive: false,
    selectedOption: '',
  });

  const handleSubmit = () => {

    // Imprime los datos del formulario en la consola al enviar
    console.log(formData);

    // Obtener campos vacios
    const emptyFields = getEmptyFields();
    console.log(emptyFields);
  };

  return (
    <>
      <TextInput placeholder="Name" {...register('name')} />
      <TextInput placeholder="Correo electrónico" {...register('email')} />
      <Switch {...register('isActive', { type: 'switch' })} />
      <Picker {...register('selectedOption', { type: 'select' })}>
        <Picker.Item label="Colombia" value="CO" />
        <Picker.Item label="México" value="MX" />
        <Picker.Item label="Venezuela" value="VE" />
      </Picker>
      <Button title="Enviar" onPress={handleSubmit} />
      <Button title="Resetear" onPress={resetForm} />
    </>
  );
};

🧩 API del Hook useFormLite

formData

Estado actual del formulario:

{
  name: 'Urian Viera',
  email: '[email protected]',
  isActive: true,
  selectedOption: 'US'
}

register(fieldName, options?)

Conecta un campo con el estado del formulario.

<TextInput {...register('name')} />
<Switch {...register('isActive', { type: 'switch' })} />
<Picker {...register('selectedOption', { type: 'select' })} />

resetForm()

Restablece el formulario a su estado inicial.

getEmptyFields()

Retorna un array con los nombres de los campos vacíos.

🧠 ¿Cómo funciona register?

Según el tipo de input:

  • TextInputtype: 'text' (predeterminado)
  • Pickertype: 'select'
  • Switchtype: 'switch'

Esto permite que los eventos onChangeText o onValueChange se asocien automáticamente.

✅ Ventajas

  • Ligero y fácil de usar.
  • Compatible con múltiples componentes de React Native.
  • Sin dependencias externas innecesarias.
  • Escrito en TypeScript para mejor DX.

📈 Ideal para:

  • Formularios pequeños y medianos.
  • Proyectos que buscan simplicidad.
  • Casos donde no se necesita una librería pesada de formularios.

👨‍💻 Desarrollador

Urian Viera
🌐 urianviera.com
📺 YouTube
💌 [email protected]
¡Apóyame en PayPal!

📜 Licencia

Distribuido bajo la licencia MIT.

🙌 Agradecimientos

¡Gracias a todos los Devs 👨‍💻 que han utilizado y contribuido al desarrollo de react-native-use-form-lite! Su apoyo y retroalimentación son fundamentales para mejorar continuamente este paquete.