diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 130ad77e..5c0c35ee 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -61,6 +61,7 @@ export default class Picker extends Component {
id: PropTypes.string,
inputIcon: PropTypes.node,
clearIcon: PropTypes.node,
+ customInput: PropTypes.element,
};
static defaultProps = {
@@ -332,9 +333,11 @@ export default class Picker extends Component {
inputReadOnly,
inputIcon,
popupStyle,
+ customInput,
} = this.props;
const { open, value } = this.state;
const popupClassName = this.getPopupClassName();
+ const Input = customInput || ;
return (
-
+ {React.cloneElement(Input, {
+ className: [Input.className, `${prefixCls}-input`].join(' ').trim(),
+ ref: this.saveInputRef,
+ placeholder: placeholder,
+ name: name,
+ onKeyDown: this.onKeyDown,
+ disabled: disabled,
+ value: (value && value.format(this.getFormat())) || '',
+ autoComplete: autoComplete,
+ onFocus: onFocus,
+ onBlur: onBlur,
+ autoFocus: autoFocus,
+ onChange: noop,
+ readOnly: !!inputReadOnly,
+ id: id,
+ })}
{inputIcon || }
{this.renderClearButton()}
diff --git a/tests/TimePicker.spec.jsx b/tests/TimePicker.spec.jsx
index e896c783..8bf7a73e 100644
--- a/tests/TimePicker.spec.jsx
+++ b/tests/TimePicker.spec.jsx
@@ -113,6 +113,13 @@ describe('TimePicker', () => {
});
expect(picker.find('.rc-time-picker').text()).toBe('test-select');
});
+
+ it ('support custom input element', () => {
+ const picker = renderPicker({
+ customInput: ,
+ });
+ expect(picker.find('.custom-wrapper')).toBeDefined();
+ });
});
describe('render panel to body (without seconds)', () => {