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

Not resizing on dynamically received data #16

Open
juliankigwana opened this issue Apr 5, 2021 · 0 comments
Open

Not resizing on dynamically received data #16

juliankigwana opened this issue Apr 5, 2021 · 0 comments

Comments

@juliankigwana
Copy link

juliankigwana commented Apr 5, 2021

If the content of container is being changed dynamically then the hook does not recalculate the font size.

Looking back through the closed issues, I found this one, what says this was resolved back in v2.3.0 with the example given here example 4.

However, I am not convinced the solution solves the problem. While altering the text, the example does change the size of the font, but it does so using the previously rendered text, not the current text. This isn't obvious if you enter/delete using the provided text input, because the text is being resized to a similar number of characters. For example if your text is 20 characters long, adding another character will be it 21, and the font size calculation will happen on the original 20 which is close enough for it not to be a problem. So as you type the calculation is always done on the previous text, and so the problem appears to be resolved.

The problem becomes evident when the dynamic text is a different character length than the original. You can see the problem if you copy/paste characters into the input. See below
Screen Recording (Google Chrome)

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

1 participant