ExpandableText
ExpandableText copied to clipboard
Add show less button feature to ExpandableText
Description This pull request introduces a new feature to the ExpandableText component: users can collapse the expanded text by clicking a "Show Less" button.
Key Changes:
- Show Less Button:
- I added a lessButtonText property, which displays as "Show Less" when the text is expanded.
- The button toggles between "Show More" (collapsed state) and "Show Less" (expanded state).
- Improved Button Logic:
- Refined logic to determine button visibility through shouldShowMoreButton and shouldShowLessButton.
- The button text dynamically updates based on isExpanded, with animations applied during state transitions.
Additional Details:
- Updated animations apply when toggling between expanded and collapsed states.
- Maintained backward compatibility, so existing functionality is unaffected if collapseEnabled is not used.
These changes provide more flexibility and control for the ExpandableText component, especially in scenarios where users may need to collapse content to save space on the screen.