Skip to content

Commit

Permalink
Exclude withRequiredValidator from input props.
Browse files Browse the repository at this point in the history
  • Loading branch information
NewOldMax committed Jun 28, 2018
1 parent 17f1fef commit 81bc5c5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
9 changes: 4 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ npm install react-material-ui-form-validator@next

### Versions
+ 0.x, 1.x - supports material-ui <= 0.x
+ up to 2.0.0-beta.9 - supports material-ui >= 1.x (you can install it by ``npm i [email protected]``)
+ from 2.0.0-beta.10 - supports @material-ui/core (you can install it by ``npm i react-material-ui-form-validator@next``)
+ ^2.0.0 - supports material-ui >= 1.x

Implementation of [react-form-validator-core](https://www.npmjs.com/package/react-form-validator-core) for [material-ui v1](https://material-ui-next.com/)

Supported types:
+ Text ([TextValidator](https://github.com/NewOldMax/react-material-ui-form-validator/blob/v1/src/TextValidator.jsx))
+ Select ([SelectValidator](https://github.com/NewOldMax/react-material-ui-form-validator/blob/v1/src/SelectValidator.jsx))
+ Text ([TextValidator](https://github.com/NewOldMax/react-material-ui-form-validator/blob/master/src/TextValidator.jsx))
+ Select ([SelectValidator](https://github.com/NewOldMax/react-material-ui-form-validator/blob/master/src/SelectValidator.jsx))

Some rules can accept extra parameter, example:
````javascript
Expand Down Expand Up @@ -215,4 +214,4 @@ export default CheckboxValidatorElement;
### Contributing
This component covers all my needs, but feel free to contribute.
This component covers all my needs, but feel free to contribute.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-material-ui-form-validator",
"version": "2.0.0-beta.10",
"description": "Simple validator for forms designed with material-ui components.",
"version": "2.0.0",
"description": "Simple validator for forms designed with material-ui v1 components.",
"main": "./lib/index.js",
"scripts": {
"build": "babel ./src -d ./lib --presets=es2015,react,stage-2",
Expand All @@ -27,7 +27,7 @@
"react-form-validator-core": "0.4.4"
},
"peerDependencies": {
"@material-ui/core": "latest",
"@material-ui/core": "^1.0.0",
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
"prop-types": "^15.0.0"
Expand Down
1 change: 1 addition & 0 deletions src/SelectValidator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class SelectValidator extends ValidatorComponent {
requiredError,
helperText,
validatorListener,
withRequiredValidator,
...rest
} = this.props;
const { isValid } = this.state;
Expand Down
12 changes: 10 additions & 2 deletions src/TextValidator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import { ValidatorComponent } from 'react-form-validator-core';
export default class TextValidator extends ValidatorComponent {

render() {
// eslint-disable-next-line
const { errorMessages, validators, requiredError, helperText, validatorListener, withRequiredValidator, ...rest } = this.props;
/* eslint-disable no-unused-vars */
const {
errorMessages,
validators,
requiredError,
helperText,
validatorListener,
withRequiredValidator,
...rest
} = this.props;
const { isValid } = this.state;
return (
<TextField
Expand Down

0 comments on commit 81bc5c5

Please sign in to comment.