-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autofocus --> autoFocus #2002
autofocus --> autoFocus #2002
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for this change and ensure we maintain coverage
src/Select.js
Outdated
if (this.props.autofocus) { | ||
this.focus(); | ||
if (typeof this.props.autofocus !== 'undefined' && typeof console !== 'undefined') { | ||
console.warn('Warning: The autofocus prop will be deprecated in react-select1.0.0 in favor of autoFocus to match React\'s autoFocus prop'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation here
089fd96
to
b0d9f1f
Compare
@JedWatson indentation fixed and tests added |
b0d9f1f
to
58aecaa
Compare
Wouldn't it be better to use a custom function for deprecation warning that returns an |
Thanks for the feedback @jochenberger, what's the purpose of returning an Error object in this case? |
IMHO, returning an |
src/Select.js
Outdated
@@ -1048,7 +1051,8 @@ Select.propTypes = { | |||
addLabelText: PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input | |||
arrowRenderer: PropTypes.func, // Create drop-down caret element | |||
autoBlur: PropTypes.bool, // automatically blur the component when an option is selected | |||
autofocus: PropTypes.bool, // autofocus the component on mount | |||
autofocus: PropTypes.bool, // [DEPRECATED] autofocus the component on mount | |||
autoFocus: PropTypes.bool, // autofocus the component on mount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gwyneplaine please fix the in-line indentation here, should be using spaces for consistency
@jochenberger what makes you say that returning an error is more idiomatic react? we're explicitly continuing to support the |
@jochenberger I'm going to merge this as-is for now, I may have misunderstood what you meant with the error so please feel free to open another PR with how you meant for this to be implemented. I checked up on whether we should check for |
p.s. thanks @gwyneplaine 😁 |
I'm fine with that. I thought that returning an
I think that the warning will also appear in production. Maybe that should be changed. |
Add typo for `autoFocus` prop. Add `deprecated` comment for `autofocus`. See changes to the [PR](JedWatson/react-select#2002).
Add type for `autoFocus` props. Add `deprecated` comment for `autofocus`. See changet to the [PR](JedWatson/react-select#2002).
autoFocus
prop added, deprecation warning added for use ofautofocus
prop