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

Wrong lines calculation when width specified and having responsive container #138

Open
kis opened this issue Oct 1, 2020 · 3 comments
Open

Comments

@kis
Copy link

kis commented Oct 1, 2020

When container is responsive and it's size depends on window size and we specify truncate text with lines and width params we have wrong lines calculation (having more or less actual lines than we specified)

@lolochka
Copy link

lolochka commented Oct 1, 2020

I have also faced this problem for text inside a responsive element (there should be 3 lines)

Screenshot 2020-10-01 at 14 05 43

@arturTsal
Copy link

I have faced the same issue, does anybody know any solution or hack maybe?

@pawelangelow
Copy link

pawelangelow commented Oct 6, 2020

I'm having a similar problem. As far as I can tell it's due to the different fonts. In my case, I'm usingopen-sans. My guess:

  1. Initially the page is loading with some default font
  2. The component is rendered, so the width of the parent is calculated. For the calculation, the width kind of respects the font which is used.
  3. Fonts are loaded, the content's width is changing, but there's nobody to tell the component to re-render.
  4. I have an extra line of text, as @lolochka screenshot.

Check #16 and check @bjcancin solution. It seems to work, although there is an awful re-render.

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

4 participants