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

react-native-chocoforms

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-chocoforms

A package that aims to speed up form creation in react native

latest
Source
npmnpm
Version
1.1.65
Version published
Weekly downloads
6
100%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-chocoforms

A package that aims to automate form generation in react native. Doing so by passing a single configuration object to the component.

Example App

This package includes an example Expo app that demonstrates all the input types and validation options available in ChocoFormTS. To run the example app:

  • Install the package: npm install react-native-chocoforms
  • Navigate to the example directory: cd node_modules/react-native-chocoforms/example
  • Install dependencies: npm install
  • Start the Expo server: npm start

For more details, see the Example App README.

props

Component props

ParameterTypeDescription
formobjectRequired. Your form configuration object, details below
onFormChangefunctionRequired. Callback function that receives the updated form as a parameter
langenUS/esMXRequired. Language in which the validation messages will be shown
inputStyleobjectOptional. Style applied to each input in the form before interacted
inputStyleTouchedobjectOptional. Style applied to each input in the form when it is touched
inputStyleBluredobjectOptional. Style applied to each input in the form when it is blurred

Example of the configuration object

this.state= {
    form: {
        controls: {
            UserName: {
                elementType: 'input', // what kind of input should it render (input, currency, time, date, select)
                elementConfig: { // Everything here will be copied to the input directly
                    placeholder: 'Username',
                    autoCapitalize: 'words'
                },
                label: 'Username*', // Label descriptive of the input
                value: '',
                errorMessage: '', // Error message of this specific input, managed by the component
                validation: { // All validations
                    required: true,
                    isEmail: true, //Basic validation for an email format aaaa@bbb.cc
                    isPhone: false, // 10 digit number validation
                    isEmailOrPhone: false, // If it's either an email or a phone it's valid
                    limitAllowedCharacters: true, // Characters used must be one of these: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.1234567890
                    isPassword: false, // Checks for a min length of 6 characters, an uppercase and a number
                    minLength: false, // Minimun length of characters for the input to be valid
                    maxLength: false, // Max length of characters for the input to be valid
                    equalsTo: 'NameOfSomeOtherControlInTheConfiguration', // Validates that this input has the same value as another input in the controls part of the configuration
                    isUrl: false // Regex validation for an url
                },
            },
            RoleID: {
                elementType: 'select',
                elementConfig: {
                    placeholder: 'Role',
                },
                label: 'Role*',
                value: '',
                text: '', // For 'select' only
                options: [{   // For 'select' only
                    id: 1,
                    text: 'example'
                },{
                    id: 2,
                    text: 'example 2'
                }],
                errorMessage: '',
                validation: {
                    required: true
                },
            },
            Password: {
                elementType: 'input',
                elementConfig: {
                    placeholder: 'Password',
                    autoCapitalize: 'none'
                },
                label: 'Password*',
                value: '',
                errorMessage: '',
                validation: {
                    required: true,
                    isPassword: true
                },
            },
        },
        isValidForm: false, // Will determine if the form is inline with the validations in the config object.
        generalError:{
            show: true,
            text: 'Some custom error you want to show'
        }
    }
}

Badges

MIT License

Keywords

custom forms

FAQs

Package last updated on 25 Jun 2025

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