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:
- On first render: height = 82.389238
- 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)
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:
So maybe,
could help for unexpected behaviors (at least, I am suffering them)