-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix display name and date alignment #14304
Merged
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
53bcc26
align baseline
luacmartins f79aa03
use correct height and padding for date
luacmartins 1ce1fdf
Merge branch 'main' into cmartins-alignBaseline
luacmartins e55a447
rm height
luacmartins fe68b02
add lineheight
luacmartins 95f0fe2
Merge branch 'main' into cmartins-alignBaseline
luacmartins a2246fe
update styles
luacmartins c2620ae
rm negative margin from messages
luacmartins fd35c68
add padding to single images
luacmartins 50e1ed5
fix console error
luacmartins 0d6b102
use margin
luacmartins 1746629
get isAttachment from server
luacmartins 75842b7
move logic to conditional
luacmartins 276d598
Merge branch 'main' into cmartins-alignBaseline
luacmartins ac94ca3
adjust margins
luacmartins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 thePressable
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:iOS
android
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawnborton I updated the branch with the following:
lineHeight: 20px
to the senders name and removed the bottom paddinglineHeight: 16px
andpaddingTop: 4px
to the timestampNow 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aneequeahmad let's see what @shawnborton says about my changes above!
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both for the help!