mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Fix timestamp not rendering properly when RTL and LTR are mixed together (#1539)
* fix * changelog
This commit is contained in:
parent
ae3f7ba373
commit
3ef15b9b0d
@ -31,9 +31,9 @@ struct FormattedBodyText: View {
|
|||||||
container.foregroundColor = UIColor.compound.textPrimary
|
container.foregroundColor = UIColor.compound.textPrimary
|
||||||
return container
|
return container
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private var attributedComponents: [AttributedStringBuilderComponent] {
|
private var attributedComponents: [AttributedStringBuilderComponent] {
|
||||||
var adjustedAttributedString = attributedString + AttributedString(additionalWhitespacesSuffix)
|
var adjustedAttributedString = AttributedString(layoutDirection.isolateLayoutUnicodeString) + attributedString + AttributedString(additionalWhitespacesSuffix)
|
||||||
|
|
||||||
// Required to allow the underlying TextView to use body font when no font is specifie in the AttributedString.
|
// Required to allow the underlying TextView to use body font when no font is specifie in the AttributedString.
|
||||||
adjustedAttributedString.mergeAttributes(defaultAttributesContainer, mergePolicy: .keepCurrent)
|
adjustedAttributedString.mergeAttributes(defaultAttributesContainer, mergePolicy: .keepCurrent)
|
||||||
@ -89,7 +89,10 @@ struct FormattedBodyText: View {
|
|||||||
var bubbleLayout: some View {
|
var bubbleLayout: some View {
|
||||||
TimelineBubbleLayout(spacing: 8) {
|
TimelineBubbleLayout(spacing: 8) {
|
||||||
ForEach(attributedComponents, id: \.self) { component in
|
ForEach(attributedComponents, id: \.self) { component in
|
||||||
if component.isBlockquote {
|
// Ignore if the string contains only the layout correction
|
||||||
|
if String(component.attributedString.characters) == layoutDirection.isolateLayoutUnicodeString {
|
||||||
|
EmptyView()
|
||||||
|
} else if component.isBlockquote {
|
||||||
// The rendered blockquote with a greedy width. The custom layout prevents the
|
// The rendered blockquote with a greedy width. The custom layout prevents the
|
||||||
// infinite width from increasing the overall width of the view.
|
// infinite width from increasing the overall width of the view.
|
||||||
MessageText(attributedString: component.attributedString.mergingAttributes(blockquoteAttributes))
|
MessageText(attributedString: component.attributedString.mergingAttributes(blockquoteAttributes))
|
||||||
|
1
changelog.d/pr-1539.bugfix
Normal file
1
changelog.d/pr-1539.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve timestamp rendering when mixed LTR and RTL languages are present in the message.
|
Loading…
x
Reference in New Issue
Block a user