mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
fix: add .focus for TimePicker, ref: #3790
This commit is contained in:
parent
21a0779692
commit
760a5ffc90
@ -60,6 +60,7 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
||||
};
|
||||
|
||||
context: TimePickerContext;
|
||||
timePickerRef: any;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -97,6 +98,14 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
||||
return timePickerLocale;
|
||||
}
|
||||
|
||||
saveTimePicker = (timePickerRef) => {
|
||||
this.timePickerRef = timePickerRef;
|
||||
}
|
||||
|
||||
focus() {
|
||||
this.timePickerRef.focus();
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = assign({ format: 'HH:mm:ss' }, this.props);
|
||||
delete props.defaultValue;
|
||||
@ -116,6 +125,7 @@ export default class TimePicker extends React.Component<TimePickerProps, any> {
|
||||
return (
|
||||
<RcTimePicker
|
||||
{...props}
|
||||
ref={this.saveTimePicker}
|
||||
className={className}
|
||||
value={this.state.value}
|
||||
placeholder={props.placeholder === undefined ? this.getLocale().placeholder : props.placeholder}
|
||||
|
Loading…
Reference in New Issue
Block a user