You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browser and its version: google chrome 56.0.2924.87
What did you do? Please provide steps to re-produce your problem.
I created a customized Form control Switch based on antd Switch. And I got a warning.
code:
import{SwitchasSwitchAntd}from'antd';import{Form,Button}from'antd';constFormItem=Form.Item;classSwitchextendsReact.Component{constructor(props){super(props);constchecked=(this.props.value==1) ? true : false;letdefaultProps={checkedChildren: '开',unCheckedChildren: '关'}console.log('this.props: ',this.props);this.state={
...defaultProps,
...this.props,
checked
};}handleChange(checked){this.setState({checked});constvalue=checked ? 1 : 0;constonChange=this.props.onChange;onChange&&onChange(value);}render(){return(<SwitchAntd{...this.state}onChange={::this.handleChange}/>);}}classMyFormextendsReact.Component{handleSubmit=(e)=>{e.preventDefault();this.props.form.validateFields((err,values)=>{if(!err){console.log('Received values of form: ',values);}});}render(){const{ getFieldDecorator }=this.props.form;constprops={checkedChildren: '上线',unCheckedChildren: '下线'};// Only show error after a field is touched.return(<FormonSubmit={this.handleSubmit}><FormItem>{getFieldDecorator('open',{initialValue: 1})(<Switch{...props}/>)}</FormItem><FormItem><Buttontype="primary"htmlType="submit">
查看
</Button></FormItem></Form>);}}constWrappedMyForm=Form.create()(MyForm);// write your demo code here, below is an example ReactDOM.render(<WrappedMyForm/>,mountNode);
What do you expected?
No warning.
What happen?
Got a warning.
Re-producible online demo
Please paste my code on riddle or some online code running platform.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.
lockbot
locked as resolved and limited conversation to collaborators
May 1, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
🐛 BugAnt Design Team had proved that this is a bug.
Environment(required)
What did you do? Please provide steps to re-produce your problem.
I created a customized Form control Switch based on antd Switch. And I got a warning.
code:
What do you expected?
No warning.
What happen?
Got a warning.
Re-producible online demo
Please paste my code on riddle or some online code running platform.
The text was updated successfully, but these errors were encountered: