-
Notifications
You must be signed in to change notification settings - Fork 113
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
the more cannot show, when the text is from state #13
Comments
Hi @shilihuan |
Hi @eriveltonelias I faced this same issue today after receiving a string from a fetch I put it in a state and then I passed the state in the readmore component like this
It is not displaying read more and read less while I have correctly binded the methods for these in constructor while read more is displaying only when I am passing a hardcoded string like Lorem Ipsum |
Hey @HarshitMadhav Can you provide a runnable repro on https://snack.expo.io/ ? |
then in render
|
thanks for providing the repro! I'll investigate. |
@eriveltonelias Actually the problem is with the first render of component. The first render of read more text component does not show |
Any solution for that? I'm facing the same problem, when I receive the text from state the show more button is not displaying but if I put hardcoded text it works normally. |
+1 |
Hi, Is there something we can provide that helps fixing this? I ran into the same issue and would love to help fixing the problem. Thanks for looking into this! |
Hello, Actually the problem is that, the component does not re-render itself when text updated. So i have fixed this by creating a method and called it when i have to update text. Like in shouldComponentUpdate of parent. or in callback of any request etc. updateComponent = async () => { Actually i resets the state first and recalculated the values as in componentDidMount(). |
thanks guys! I'll send a fix this weekend. |
ALL I did was I did a extra setState() to re render. |
@eriveltonelias Thank you for considering this issue. |
@eriveltonelias soon please |
That would be amazing @eriveltonelias ! Thank you for your work. |
@eriveltonelias did you have the chance to take a look at it? Thank you! |
is it hard to fix it? |
If someone will have this issue, just add some unique key={SOME_ID} from state to rerender component. |
@eriveltonelias |
solved it ? @eriveltonelias |
I also face same issue and Fix it by using in render |
Hello, I have same issue when i use readmore component with text value which is come from api then it not display see more otherwise as static text it working. Please guide me for solution |
reset array before updating it . like => let responseFromApi=[{ any thing },{ any thing }] don't direct update your state like |
Im using flatlist to render the item from the api but here the show more shows only on the first item any help |
// the more cannot show and onReady function is not execute; , this.state.introduction data is from a fetch , I don't know how to fix it,
<ReadMore numberOfLines={2} renderTruncatedFooter={this._renderTruncatedFooter} renderRevealedFooter={this._renderRevealedFooter} onReady={this._handleTextReady}> <Text style={styles.introduce}> // the more cannot show and onReady function is not execute; , this.state.introduction data is from a fetch , I don't know how to fix it, {this.state.introduction} {/*{'wodasdkasdkasbdjabswoaoda我爱的那首搭上打瞌睡大街上大巴见死不救博大精深不对劲啊是djabsdjabsjdbasjdbasjbdjasbjshshhshshshshshhshshhshshshshshsh'}*/} // the more can show </Text> </ReadMore>
The text was updated successfully, but these errors were encountered: