Flipboard / Flipboard/react-canvas
meatureText may return `undefined` length for first line while the width of the first word out of the given width
- Dominant language
- JavaScript
- Stars
- 13.2k
- Forks
- 909
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/Flipboard/react-canvas/blob/master/lib/measureText.js#L75
``` js
if (textMetrics.width > width || (lastBreak && lastBreak.required)) {
measuredSize.height += lineHeight;
measuredSize.lines.push({width: lastMeasuredWidth, text: currentLine.trim()});
```
Should be:
``` js
if (textMetrics.width > width || (lastBreak && lastBreak.required)) {
if (currentLine.length > 0) {
measuredSize.height += lineHeight;
measuredSize.lines.push({width: lastMeasuredWidth, text: currentLine.trim()});
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.