New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

form-validation-react-native

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

form-validation-react-native

Form Validator for IOS and Android

npmnpm
Version
1.6.1
Version published
Weekly downloads
21
2000%
Maintainers
1
Weekly downloads
 
Created
Source

Form Validation for React Native

Form validation react native is a simple library to validate your form in React Native App. It is easy to use and it includes text box, checkbox, radio button and dropdown field. It will validate all your field on the click of button.

1. Installation

Mak sure you have @react-native-picker/picker

NPM
npm install form-validation-react-native
Yarn
yarn add form-validation-react-native

2. Use it in your app

As of right now this will only work in IOS and Android. Soon we will cover Expo.

import {DropdownQuestion, TextBoxQuestion, FormButton, useForm} from "form-validation-react-native";
    <View>
        <TextBoxQuestion question={question.firstName} onChange={handleChange} onBlur={handleBlur}/>
        <DropdownQuestion question={question.country} onChange={handleChange} onBlur={handleBlur}/>
        <TextBoxQuestion question={question.email} onChange={handleChange} onBlur={handleBlur}/>
        <FormButton onPress={handleOnButtonPress} title={"Any Name"} />
    </View>

3. You don't need any state to see your changes. All input field will set as object in one state, and you can use it however you like.

  • Let's see how to implement this.

    console.log(values);
    }; // This function will take form submission by passing in useForm.
    
    const initialState = {email: 'email@gmail.com',tos: 'Yes',
    phone: '1234567890', country: 'USA', countries: [{value: 'Italy', label: 'Italy', isChecked: true}]}; // 
    const { handleSubmit, handleChange, handleBlur, values, errors } = useForm(validate, submitFunction, initialState);```
    

Keywords

form

FAQs

Package last updated on 27 Aug 2022

Did you know?

Socket

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.

Install

Related posts