From 368ee9422fc22a15f743e4880cae2cd4a862e585 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Mon, 25 Jan 2016 11:48:13 +0800 Subject: [PATCH] feat: deprecate Validation --- components/validation/index.jsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/components/validation/index.jsx b/components/validation/index.jsx index 00589d9285..198cca8668 100644 --- a/components/validation/index.jsx +++ b/components/validation/index.jsx @@ -1,3 +1,25 @@ +import React from 'react'; import Validation from 'rc-form-validation'; +import warning from 'warning'; -export default Validation; +export default class AntValidation extends React.Component { + validate(callback) { + this.refs.validation.validate(callback); + } + + reset() { + this.refs.validation.reset(); + } + + forceValidate(fields, callback) { + this.refs.validation.forceValidate(fields, callback); + } + + render() { + warning(false, '`Validation` is deprecated, please use `Form` which has supported validation after antd@0.12.0.'); + return ; + } +} + +AntValidation.Validator = Validation.Validator; +AntValidation.FieldMixin = Validation.FieldMixin;