-
Notifications
You must be signed in to change notification settings - Fork 610
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
[ListItem] Added Dynamic Text functionality with tertiaryText prop #89
Conversation
Codecov Report@@ Coverage Diff @@
## master #89 +/- ##
======================================
Coverage 85.3% 85.3%
======================================
Files 13 13
Lines 592 592
Branches 78 78
======================================
Hits 505 505
Misses 87 87 Continue to review full report at Codecov.
|
No problem @mbenjamin618 :) It's much more better :) Now, we could talk about this. Could you try to explain how should this work? I mean:
Just want to say It's not clear now :) Is there a way how to make it better? |
src/ListItem/ListItem.react.js
Outdated
const numberOfLines = !tertiaryText ? | ||
getNumberOfSecondaryTextLines(this.state.numberOfLines) : 1; | ||
|
||
const secondLineNumber = typeof tertiaryText === 'undefined' ? numberOfLines : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about null
? or empty string? or false? think !tertiaryText
it's better in this case ...
I see what you're saying. I think that changing Line 272 is basically saying: if there isn't a tertiaryText prop then the numberOfLines prop for the Text will be the numberOfLines const on 255, but if there is a tertiaryText prop then the second line should only ever be 1 line. Similarly, line 273 does that same thing. I attached a picture with 4 different examples of cards I made with both two and three lines of text/. This is the code for it:
|
I see, sounds good .. but still if we need to think about it so much, what about people who no nothing about this library? :) I have this idea: <ListItem
centerElement={{
primaryText: 'Always one line',
secondaryText: { text: 'more than one line', numberOfLines: 'dynamic' },
tertiaryText: { text: 'one line', numberOfLines: 1 },
}}
/> I think it's so clear. But, I have to say it looks like we almost provide the same api as RN does but in another form :) Maybe your solution is better. What do you think? |
I like the idea you wrote, but that wasn't the intention of my update. With mine, even though it looks similar to what is already implemented, it gives the user the capability to start a new line of text on a third line instead of it automatically wrapping. My code doesn't support taking in the props the way you wrote it, but it might be something to look into further when I have more time. |
Deleted the previous pull request, only one commit now. Sorry for the confusion!