-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Labs] Pass inputRef to <Suggest> & <MultiSelect> #2079
Conversation
this.input = ref; | ||
|
||
const { tagInputProps = {} } = this.props; | ||
const inputProps: HTMLInputProps = tagInputProps.inputProps || {}; |
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.
const { tagInput: { inputProps = {} } } = this.props
should do the trick
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.
But if tagInputProps is undefined, will this line brake?
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.
truth, it will. then do the same thing twice.
= {}
is the new || {}
(and so much more typesafe)
const { tagInputProps = {} } = this.props;
const { inputProps = {} } = tagInputProps;
const { tagInputProps = {} } = this.props; | ||
const inputProps: HTMLInputProps = tagInputProps.inputProps || {}; | ||
// can't use safeInvoke cuz inputProps.ref can be `string | function` | ||
const refHandler = inputProps.ref; |
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.
@AlexMarvelo why does this file use .ref
while the one below uses .inputRef
?
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.
Described in PR description, point 2
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.
this PR for 2.0 added TagInput.inputRef
prop: https://github.com/palantir/blueprint/pull/2034/files#diff-534314697ccd64472fc61bbacae83ae1R34
i'm inclined to wait for 2.0 for this whole thing. is that acceptable?
Are there any problems here? |
sorry @AlexMarvelo i'm fully focused on getting 2.0 out the door this week, so this PR is low priority. left some comments but I've got my plate quite full. |
@AlexMarvelo please update this PR against latest develop when you have a chance so we can get a green build. |
Follow #2216. This PR can be closed |
sure thing @alxmiron. feel free to close your own PRs in the future 😄 |
Changes proposed in this pull request:
inputProps.inputRef
prop toSuggest
component, in same way as inSelect
.tagInputProps.inputProps.ref
toMultiSelect
component. (inputProps
is passed toTagInput
, that does not acceptinputRef
, because uses nativeinput
tag instead ofInputGroup
)Passing custom ref handler to input will allow more flexible opportunity to build own extended components on top of blueprint components.