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

On page load, component renders over many lines #12

Open
philest opened this issue Oct 23, 2017 · 6 comments
Open

On page load, component renders over many lines #12

philest opened this issue Oct 23, 2017 · 6 comments

Comments

@philest
Copy link

philest commented Oct 23, 2017

Observed Behavior 1-2 seconds after page-load:
screenshot 2017-10-23 12 26 18

Expected Behavior:
screenshot 2017-10-23 12 27 02

@philest
Copy link
Author

philest commented Oct 23, 2017

@pablosichert

@philest
Copy link
Author

philest commented Oct 23, 2017

Update: In other cases, it hangs in the broken state permanently, until the window is resized. This is a pretty serious bug and can make the component unusuable:

screenshot 2017-10-23 14 05 20

@cxreiff
Copy link

cxreiff commented Dec 15, 2017

I'm getting the same issue, and some lines are being hidden completely.

screen shot 2017-12-14 at 4 26 20 pm

@Jachaplin
Copy link

Jachaplin commented Nov 4, 2018

@philest @jaxuru @pablosichert
The root of the problem is that it randomly adds br tags in the text. Just wrap the code in a div tag with a class name of your choice and then do this in your CSS file:

.your-className br {
display: none;
}

.your-className span {
margin-right: 4px;
}

@timrossinfo
Copy link

I had a similar issue and tracked it down to using letter-spacing in our CSS, which is a known limitation of react-truncate: pablosichert/react-truncate#59

@Slitthe
Copy link

Slitthe commented May 29, 2019

I've fixed it by storing a ref to the Truncate component within the ShowMore component and then calling the truncate function manually after the Truncate is loaded

componentDidUpdate() { this.truncateRef.current.calcTargetWidth(); }

It might cause some performance loss though, but it seems insignificant for now.

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

5 participants