Expose row count information
See original GitHub issueHi,
we’re trying to migrate to v8 but we realized that the change in onHeightChange
function arguments is causing us to miss on a key feature.
Background
In our UI components library we have a component called MultilineTextInput
, which uses the resizable textarea component. One of the features of this component is that when there is value in more than one line, we show an expand/collapse button.
You can see a live example here: https://uikit.commercetools.com/?path=/story/components-inputs--multilinetextinput
To do that, we rely on the valueRowCount
exposed by the component.
In v8 though, the onHeightChange
only exposes the height
value.
Ideally, what we need is the internally calculated rowHeight
And to calculate the row count:
const valueRowCount = Math.floor(height / rowHeight);
Proposal
I’m not sure what the best solution here would be. Maybe we can introduce a new callback prop that specifically exposes this value.
What do you think? Do you see any other solution?
I’m happy to work on a PR if we decide how to proceed.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (16 by maintainers)
Top GitHub Comments
A second argument (
{ rowHeight: number }
) to theonHeightChange
callback seems OK to me.It’s not available right now, I was just wondering if that would be enough for you to handle your use case. In general, I have deliberately removed this extra argument in v8 so I could gather feedback and use cases from consumers of this package so I could add it back knowing more and potentially providing a better API.