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

add a prop to know nbOfLines so we can disable or not controlled collapse #78

Closed
pierroo opened this issue Feb 8, 2023 · 3 comments · Fixed by #81
Closed

add a prop to know nbOfLines so we can disable or not controlled collapse #78

pierroo opened this issue Feb 8, 2023 · 3 comments · Fixed by #81

Comments

@pierroo
Copy link

pierroo commented Feb 8, 2023

I am using the controlled collapse, so that when the user taps on the entire parent view it expand the contained text.
But as of now there is no way to know whether or not there is any need to expand (ie nbOfLines > the number we set as props), which leads to a useless tap to expand. (in my case it triggers other functions, like adjusting the css top etc; so I really don't want to have it triggered when not needed)

Let me know if unclear :)

EDIT: and while at it, anyway to also return the "size" (width and height) of the collapsed text?
I guess you compute it somehow to adjust the animated height and width upon expanding?
This size would help me to "place" (top / bottom etc) the actually expanding text.

@fawaz-ahmed
Copy link
Owner

Thanks for bringing this up @pierroo , would it be fine if onReady callback passes this information in arguments ?

@pierroo
Copy link
Author

pierroo commented Feb 9, 2023

Absolutely, that's exactly where I was hoping to get those information from.
Thank you!

@fawaz-ahmed
Copy link
Owner

fawaz-ahmed commented Apr 5, 2023

Hi @pierroo , I've manged to add params to onReady callback ({ canExpand, expandedLinesCount }).
As for the size, the text component will fill the parent component width and the height can be proportional to expandedLinesCount * font size. Hope this helps.
Upgrade to ver 3.0.3 to see the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants