-
Notifications
You must be signed in to change notification settings - Fork 1.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
Allow passing of inputRef to RAC Checkbox/Switch #5967
Conversation
Build successful! π |
Build successful! π |
|
||
/** | ||
* Merges multiple refs into one. Works with either callback or object refs. | ||
*/ | ||
export function mergeRefs<T>(...refs: ForwardedRef<T>[]): ForwardedRef<T> { | ||
export function mergeRefs<T>(...refs: Array<ForwardedRef<T> | MutableRefObject<T>>): ForwardedRef<T> { |
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.
had to update the typing for this but not super sure about this change
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.
react-aria/utils is in TS strict, so we're pretty well protected here
that said, I think it's the right change
|
||
/** | ||
* Merges multiple refs into one. Works with either callback or object refs. | ||
*/ | ||
export function mergeRefs<T>(...refs: ForwardedRef<T>[]): ForwardedRef<T> { | ||
export function mergeRefs<T>(...refs: Array<ForwardedRef<T> | MutableRefObject<T>>): ForwardedRef<T> { |
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.
react-aria/utils is in TS strict, so we're pretty well protected here
that said, I think it's the right change
Build successful! π |
Build successful! π |
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.
Just small code nit, but otherwise this looks fine to me. Thanks for coming up with the update!
Build successful! π |
Build successful! π |
Build successful! π |
## API Changes
unknown top level export { type: 'any' } @react-aria/utilsmergeRefs mergeRefs<T> {
- refs: Array<ForwardedRef<T>>
+ refs: Array<ForwardedRef<T> | MutableRefObject<T>>
returnVal: undefined
} |
Opening to start a discussion about how we would like to handle inputRef since we ran into some issues with π Checkbox/Switch.
In RAC, inputRef is constructed within the component so that in our π implementation of Checkbox/Switch we have no way of passing an inputRef down to the input. We can't use
Context
because Checkbox/Switch don't use our<Input>
component.If this is something we want, I can make adjustments to the ref support PR in π .
β Pull Request Checklist:
π Test Instructions:
π§’ Your Project: