
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
react-native-use-form-lite
Advanced tools
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.
Es una librería moderna, intuitiva, liviana, escalable y sobre todo flexible para manejar formularios en React Native de forma rápida y sencilla.
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.
onChange
para cada input.TextInput
, Picker
, Switch
, etc.).npm install react-native-use-form-lite
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} />
</>
);
};
useFormLite
formData
Estado actual del formulario:
{
name: 'Urian Viera',
email: 'urian@example.com',
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.
register
?Según el tipo de input:
TextInput
→ type: 'text'
(predeterminado)Picker
→ type: 'select'
Switch
→ type: 'switch'
Esto permite que los eventos onChangeText
o onValueChange
se asocien automáticamente.
Urian Viera
🌐 urianviera.com
📺 YouTube
💌 urian1213viera@gmail.com
☕ ¡Apóyame en PayPal!
Distribuido bajo la licencia MIT.
¡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.
FAQs
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.
The npm package react-native-use-form-lite receives a total of 3 weekly downloads. As such, react-native-use-form-lite popularity was classified as not popular.
We found that react-native-use-form-lite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.