Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ module.exports =

if (this.state.inputFocus) {
this.refs.input.focus();
}

if (this.state.selectionStart || this.state.selectionStart === 0) {
this.refs.input.selectionStart = this.state.selectionStart;
}

if (this.state.selectionEnd || this.state.selectionEnd === 0) {
this.refs.input.selectionEnd = this.state.selectionEnd;
if (this.state.selectionStart || this.state.selectionStart === 0) {
this.refs.input.selectionStart = this.state.selectionStart;
}

if (this.state.selectionEnd || this.state.selectionEnd === 0) {
this.refs.input.selectionEnd = this.state.selectionEnd;
}
}

this.checkValidity();
Expand Down
16 changes: 8 additions & 8 deletions src/NumericInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,16 @@ class NumericInput extends Component
// this.state.inputFocus to true)
if (this.state.inputFocus) {
this.refs.input.focus()
}

// Restore selectionStart (if any)
if (this.state.selectionStart || this.state.selectionStart === 0) {
this.refs.input.selectionStart = this.state.selectionStart
}
// Restore selectionStart (if any)
if (this.state.selectionStart || this.state.selectionStart === 0) {
this.refs.input.selectionStart = this.state.selectionStart
}

// Restore selectionEnd (if any)
if (this.state.selectionEnd || this.state.selectionEnd === 0) {
this.refs.input.selectionEnd = this.state.selectionEnd
// Restore selectionEnd (if any)
if (this.state.selectionEnd || this.state.selectionEnd === 0) {
this.refs.input.selectionEnd = this.state.selectionEnd
}
}

this.checkValidity()
Expand Down