Open
Conversation
osdiab
commented
Mar 4, 2020
| function useComponentSize(ref) { | ||
| var _useState = useState(getSize(ref ? ref.current : {})) | ||
| function useComponentSize(elemOrRef) { | ||
| const el = elemOrRef && ( |
Author
There was a problem hiding this comment.
remove this statement altogether, and rename elemOrRef to el to make this a breaking change that drops support for RefObject inputs.
This would be better to make it clearer to users that passing in a RefObject is asking for trouble since it won't trigger a re-render
osdiab
commented
Mar 4, 2020
| } | ||
|
|
||
| export default function useComponentSize<T = any>(ref: React.RefObject<T>): ComponentSize | ||
| export default function useComponentSize<T = any>(ref: T | React.RefObject<T>): ComponentSize |
Author
There was a problem hiding this comment.
Remove the React.RefObject<T> type if we make this a breaking change
osdiab
commented
Mar 4, 2020
| } | ||
|
|
||
| declare export default function useComponentSize<T>(ref: React.Ref<T>): ComponentSize; No newline at end of file | ||
| declare export default function useComponentSize<T>(ref: T | React.Ref<T>): ComponentSize; No newline at end of file |
Author
There was a problem hiding this comment.
Remove the React.Ref<T> type if we make this a breaking change
Author
There was a problem hiding this comment.
separately, idk where the flow types are since idk how flow works, but is this supposed to be RefObject? shrug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17 and retained support for
Refinstance even though it's a red herring - won't work properly for the reasons explained in the issue