Skip to content

Commit 40eece3

Browse files
authored
Update Input.jsx
1 parent e4c4a8d commit 40eece3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/input/Input.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,15 @@ export default class Input extends Component {
7070

7171
handleBlur(e: SyntheticEvent): void {
7272
const { onBlur } = this.props
73-
if (this.props.trim) this.handleTrim(e)
73+
if (this.props.trim) this.handleTrim()
7474
if (onBlur) onBlur(e)
7575
}
7676

77-
handleTrim(e: SyntheticEvent): void {
77+
handleTrim(): void {
78+
this.refs.input.value = this.refs.input.value.trim()
7879
if(this.props.onChange) {
7980
// this's for controlled components
80-
this.props.onChange(e.target.value.trim())
81-
} else {
82-
// this's for uncontrolled components
83-
this.refs.input.value = this.refs.input.value.trim()
81+
this.props.onChange(this.refs.input.value.trim())
8482
}
8583
}
8684

0 commit comments

Comments
 (0)