-
Notifications
You must be signed in to change notification settings - Fork 129
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
Text generated is "too long" #4
Comments
Thank you for the screenshots - from your description I assume that re-sizing the window (without toggling chrome device mode) also results in re-rendering and correctly truncating the text, is that correct? It would be helpful to know which children you provided to the component. Does the child re-render while Was there any error in the console? |
There were no errors in the console, and no children were passed to the component, just jsx-interpolated text ( If I don't toggle chrome device mode, then resizing the window won't do anything, since it's set to the mobile width -- and my use case is mobile devices, so I didn't try on a regular browser window. |
I have moved on to another module, react-ellipsify, that provided the desired behavior along with the text-expansion feature I desired, so my available time to help you troubleshoot has unfortunately been cut short for the time being. |
Having revealed this bug is helpful anyway - so thanks for the contribution 🌞 I have found an explanation for the observed behavior:
Why is this causing trouble with react-truncate?
How can you fix it?
A note on the text-expansion: This is something that you could easily implement using react-truncate. In the link you provide to |
Here you have a gist for an example |
Here is a screenshot of what I mean - you can see that on the original load, using a mobile device tool on Chrome, the text goes too far. (it should be aligned, to the left and to the right, with the blue bar underneath).
Fun fact, if I turn off the mobile device tool and then turn it on again, this happens:
So the code is doing the right thing, mostly. Let me know if you need more stuff from me.
The text was updated successfully, but these errors were encountered: