Skip to content

Commit

Permalink
fix: remove double usage of same code
Browse files Browse the repository at this point in the history
  • Loading branch information
antonfisher committed Sep 12, 2017
1 parent 40d4d50 commit ee99ce4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,14 @@ export default class TimeField extends React.Component {
render() {
const {value} = this.state;
const {onChange, style, showSeconds, input, colon, ...props} = this.props;
const onChangeHandler = ((event) => this.onInputChange(event, (v) => onChange(v)));

if (input) {
return React.cloneElement(input, {
...props,
value,
style,
onChange: ((event) => this.onInputChange(event, (v) => onChange(v)))
onChange: onChangeHandler
});
}

Expand All @@ -183,7 +184,7 @@ export default class TimeField extends React.Component {
type="text"
{...props}
value={value}
onChange={(event) => this.onInputChange(event, (v) => onChange(v))}
onChange={onChangeHandler}
style={{width: (showSeconds ? 54 : 35), ...style}}
/>
);
Expand Down

0 comments on commit ee99ce4

Please sign in to comment.