react-formr
Advanced tools
Comparing version 1.1.4 to 1.1.5
{ | ||
"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>}` | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25176
99