Skip to content

measure, sometimes, returns different heights #51

@victoriomolina

Description

@victoriomolina

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions