Socket
Socket
Sign inDemoInstall

react-formr

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-formr - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

2

package.json
{
"name": "react-formr",
"version": "1.1.4",
"version": "1.1.5",
"description": "Form managing component for React & React Native",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -57,3 +57,3 @@ # react-formr

borderWidth: 1,
width: 100,
width: "100%",
}}

@@ -67,5 +67,4 @@ onChangeText={(e) => onHandleChange("phone", e)}

onPress={() => handleSubmit(console.log)}
title="Learn More"
title="Submit"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>

@@ -89,1 +88,14 @@ </>;

| `onChange` | Function | ()=>{} | Function for observing fields changes | |
## Form control function args
To control form fields, The `Formr` component will provide a function that include
| Name | Type | Usage | Descripion | Example |
| ---------------- | ------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| `onHandleChange` | `Function` | `onHandleChange( key:string, value:string )` | To set value of the field, call this function with arguments: `key` - which input field to update. `value` to that field | ` <TextInput onChangeText={ (text)=> onHandleChange("email":text) } />` |
| `onHandleBlur` | `Function` | `onHandleBlur( key:string )` | To set which field is blurred, call this function with key on blurrEvent | `<TextInput onBlur={ ()=> onHandleBlur("email") } />` |
| `handleSubmit` | `Function` | `handleSubmit( callback:(values)=>{} )` | This handle submit button & validation flow. This is used to submit form. | `<Button title="Submit" onPress={ ()=> handleSubmit( (values)=> submitFormToApi(values) ) } />` |
| `values` | `{ [key:string]:string, ... }` | `values={ values[key] }` | Objct of field values, can be used for value input for the `TextInput` | `<TextInput value={values.email} />` |
| `valid` | `{ [key:string]:boolean, ... }` | | Its is This object contains validation results,`true`:valid and `false`:validation fail. | `{!valid.email && <Text> This fields is invalid </Text>}` |
| `touched` | `{ [key:string]:boolean, ... }` | | Its is used to show error message on validation fail. | `{touched.email && !valid.email && <Text> This fields is invalid </Text>}` |
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc