question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose row count information

See original GitHub issue

Hi,

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.

https://github.com/commercetools/ui-kit/blob/86a85e642d0d47089c3ddd7094974c58badbed56/src/components/inputs/multiline-text-input/multiline-text-input.js#L30-L40

In v8 though, the onHeightChange only exposes the height value.

Ideally, what we need is the internally calculated rowHeight

https://github.com/Andarist/react-textarea-autosize/blob/757355da9d9810b7855621b0093cf26e323d48cd/src/calculateNodeHeight.ts#L50

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:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Jun 29, 2020

A second argument ({ rowHeight: number }) to the onHeightChange callback seems OK to me.

1reaction
Andaristcommented, Jun 2, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Server Row Count for all Tables in a Database
In this article we look at 4 different ways to get rows counts for all tables in a SQL Server database.
Read more >
How can I count the numbers of rows that a MySQL query ...
Getting a count of rows matching some criteria...​​ Just use COUNT(*) - see Counting Rows in the MySQL manual. For example: SELECT COUNT(*)...
Read more >
Row Counts of Tables in a SQL Schema & Database - Yugabyte
Aggregate row counts per schema​​ This can be achieved by using the following query. SELECT table_schema, SUM(row_count) AS total_rows FROM ( ...
Read more >
How to add a 'count' for the number of rows in a list report in ...
Enter text: 'Row Count: '; Select the Page object, and set the Query property to the query that contains the dataitem; Set the...
Read more >
SQL Magic Trick: Getting Row Count Without Fetching All Rows
Yes, Oracle gives us %ROWCOUNT, but that only tells us '…how many rows affected so far.' So when you start to fetch the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found