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

onTruncate callback not being called after rendering the ellipsis #100

Open
nikkodsg opened this issue Dec 20, 2022 · 0 comments
Open

onTruncate callback not being called after rendering the ellipsis #100

nikkodsg opened this issue Dec 20, 2022 · 0 comments

Comments

@nikkodsg
Copy link

nikkodsg commented Dec 20, 2022

I have a use case where in the content composed of tags is truncated when reaching 3 lines/rows. Each tags can be added or removed by the user after the initial load (mounted). I use the value of "truncated" from the onTruncate callback to handle some outside logic that's why it's important to get the correct value of it.

I was expecting that when the component truncates the content and renders the ellipsis, it will call the onTruncate callback with a value of "true" since it was truncated. Take note that this happens after the initial load and when the content is being updated.

To Reproduce

Please take a look at this sample demo: https://codesandbox.io/s/lucid-joliot-lljlit?file=/src/App.js

  1. Open the console.
  2. Add tags by clicking any tags from the bottom box. Add until you reached the maximum content (3 lines) before it truncated. 3. Watch the value of "truncated" logged.
  3. You will see that after it renders the "More" button, the value of "truncated" from the console is still "false"
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