Fix display name and date alignment#14304
Conversation
|
@Santhosh-Sellavel @MariaHCD One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@Expensify/design or @shawnborton does it looks as expected? WebDesktopAndroidiOSAndroid mWebiOS mWeb |
|
@luacmartins PR Screenshots are not loading can you check? |
| height: 24, | ||
| height: 20, | ||
| lineHeight: variables.lineHeightXLarge, | ||
| paddingBottom: 4, |
There was a problem hiding this comment.
I think we want to get rid of the padding bottom. However, for image attachments, if the image attachment is the first thing in the message group (it comes right after the sender name) we should give it some top margin of say 4-8px.
There was a problem hiding this comment.
I just read the Slack thread linked to the issue and it seems like we also want to do some cleanup on the negative margins used for the message text, as well as add some padding for images. I'll add that to this PR.
That being said, I'm having issues aligning the sender name & date at the baseline. alignItems: 'baseline' is supported in RN and works well on browsers, but the Pressable component wrapping the sender name text is throwing off the alignment on iOS/android native since it's baseline is different from the text baseline. Here's how they behave:
I've spent some time trying to work around this issue, but no luck so far. Any suggestions?
There was a problem hiding this comment.
Take a look at the discussion from this one: #14148
We actually learned that baseline doesn't always work on Android so we might want to avoid that.
There was a proposal that seemed to fix the alignment by always making sure the big text (sender) and small text (timestamp) had the same lineheight and height. So maybe we could try that first?
There was a problem hiding this comment.
So after seeing this, it does feel like the sender is too close to the message, but maybe that's because the negative margin is still there. So let me know once you start playing around with that stuff too.
There was a problem hiding this comment.
There was a proposal that seemed to fix the alignment by always making sure the big text (sender) and small text (timestamp) had the same lineheight and height. So maybe we could try that first?
I tried this and the other solutions in that issue but none of them seem to work. Maybe I'm holding something wrong?
I'd appreciate any other suggestions as I'm struggling to find a solution that doesn't add any padding/margins to the text.
There was a problem hiding this comment.
@shawnborton I updated the branch with the following:
- Added
lineHeight: 20pxto the senders name and removed the bottom padding - Added
lineHeight: 16pxandpaddingTop: 4pxto the timestamp
Now the header + single line message sums up to 40px and both seem to be aligned at the baseline:

In addition, I removed the negative margin from chatItemMessage and added a conditional 8px top margin to attachments when displayed with the header:
Let me know what you think!
There was a problem hiding this comment.
@aneequeahmad let's see what @shawnborton says about my changes above!
There was a problem hiding this comment.
That feels pretty great to me! Thanks for pushing through this one and getting to a good solution!
There was a problem hiding this comment.
@luacmartins Code changes looks good to me too. That's a pretty neat solution. @shawnborton Thank-you for your suggestion.
There was a problem hiding this comment.
Thank you both for the help!
MariaHCD
left a comment
There was a problem hiding this comment.
Fixed the screenshots in the OP :) The padding bottom does look a bit too much in @Santhosh-Sellavel's screenshots but it looks fine when I tested locally on:
Web:
Desktop:
|
@Santhosh-Sellavel all yours for review! |
Screenshots/VideosThe latest screenshots does it looks good? cc: @shawnborton @luacmartins @MariaHCD |
Reviewer Checklist
|
|
@luacmartins Can you update the latest screenshots in the PR? |
|
@Santhosh-Sellavel done! |
|
@luacmartins have you checked this #14304 (comment)? Seem still something is off to me, is it just to me? |
|
|
@shawnborton I just checked this branch it seems fine at my end. Strange. |
|
Hmm @Santhosh-Sellavel any idea what's causing this? It seems like between this issue and the other alignment issue, we're getting a lot of inconsistencies in various platforms/screenshots. |
|
hmm I'm seeing a small alignment issue on mWeb Chrome and Safari 🤔 Not sure what's causing it yet. |
|
@luacmartins i just debugged and fixed the issue. Actually there is not need to add Also verified it doesn't cause regression on Web. cc: @shawnborton Code Changes: chatItemMessageHeaderTimestamp: {
flexShrink: 0,
color: themeColors.textSupporting,
fontSize: variables.fontSizeSmall,
- paddingTop: 4,
- lineHeight: variables.lineHeightNormal,
+ paddingTop: 2,
},
|
|
I find all platforms are off, i.e compare this screenshots with screenshots in the PR description. @MariaHCD Can you post what you see on Web & Desktop? Honestly, I'm confused about what's happening here, before worrying about Inconsistent between platforms, there is an inconsistency between author screenshots & reviewer screenshots 😕 . cc: @shawnborton |
|
I updated the PR and screenshots using this suggestion. Ready for another review! |
|
That feels pretty good to me. It might not be perfectly baseline aligned, but I think it's a good improvement and it feels consistent across platforms. |
|
Here are new screenshots can you confirm this looks @shawnborton @luacmartins |
|
Yup, this feels pretty good to me! |
|
@Santhosh-Sellavel seems like this looks good now. Can you complete the checklist please? |
|
Yes will do! |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
LGTM thanks, everyone!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.2.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.63-0 🚀
|



































Details
Fix the display name and date alignments
Fixed Issues
$ #14269
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android