Skip to content

Commit f159137

Browse files
author
James K Nelson
committed
Fix autoFocus
As `autoFocus` is listed in `propTypes`, the `_.omit` call on line 95 was removing it from `this.props` and thus causing the variable to always be `null`. I've tested this by hand in a project I'm using NumberPicker in. I've spent some time trying to write a test, but given that React implements `autoFocus` itself instead of passing it to the underlying HTML element, I couldn't figure out how to do this.
1 parent 828f25c commit f159137

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/NumberPicker.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ let NumberPicker = React.createClass({
9191
className
9292
, onKeyPress
9393
, onKeyUp
94-
, autoFocus
9594
, ...props } = _.omit(this.props, Object.keys(propTypes))
9695
, val = this.constrainValue(this.props.value)
9796

@@ -144,7 +143,7 @@ let NumberPicker = React.createClass({
144143
tabIndex={props.tabIndex}
145144
placeholder={this.props.placeholder}
146145
value={val}
147-
autoFocus={autoFocus}
146+
autoFocus={this.props.autoFocus}
148147
editing={this.state.focused}
149148
format={this.props.format}
150149
parse={this.props.parse}

0 commit comments

Comments
 (0)