Skip to content
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

measure, sometimes, returns different heights #51

Open
VictorioMolina opened this issue Nov 13, 2021 · 0 comments
Open

measure, sometimes, returns different heights #51

VictorioMolina opened this issue Nov 13, 2021 · 0 comments

Comments

@VictorioMolina
Copy link

VictorioMolina commented Nov 13, 2021

I have experienced random bugs with node.measure(). Sometimes, unexpectedly and between re-renders, it returns different sizes for the same node.

I have been thinking that the problem was mine, but nope, styles are always the same, the content to be rendered is always the same, but... magically, measure returns slightly different sizes caused by decimals.

So... maybe you can Math.floor() the text height when calculating.

I am talking about really minimal height differences, for example:

  1. On first render: height = 82.389238
  2. On second render: height = 82.389133

So maybe,

setShowReadMoreButton(Math.floor(collapsedHeight) < Math.floor(fullHeight));

could help for unexpected behaviors (at least, I am suffering them)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant