react-native-read-more
react-native-read-more copied to clipboard
Handle Read More/ Read Less from outside.
Is there any prop available to handle read more / read less from outside. like on button press or something.
@saad9624-tribalScale you can use the onExpand
and onCollapse
callback props
"optional callback executed when expanded"
I didnt find any option to call this function from outside of ReadMore component. It's just executing when expanded.
@saad9624-tribalScale none of the methods can be called from outside. Can you explain what is the use case that you're trying to achieve ?
I am trying to expand and collapse from onPress event of custom button. Is it doable?
@saad9624-tribalScale at the moment its not supported
I am trying to do this externally because customComponent is not very customizable.
@saad9624-tribalScale in this file https://github.com/fawaz-ahmed/react-native-read-more/blob/master/example/src/ReadMore.js line 182
The toggle
method, you need to call this from outside.
Pass a ref to ReadMore and try calling this method.
Otherwise you can raise a PR, I can merge it.
Sure, Thanks.
@fawaz-ahmed I had difficulties passing a ref, so I created a pr which adds a collapsed
prop (https://github.com/fawaz-ahmed/react-native-read-more/pull/70). Hope this could solve the problem.