Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Incorrect Text Alignment for Label's FormattedText when FlowDirection = RightToLeft #3311

Closed
OmerHmead opened this issue Jul 15, 2018 · 10 comments · Fixed by #13197
Closed
Assignees
Labels
3.1.0 regression on 3.1.0 a/rtl e/3 🕒 3 help wanted We welcome community contributions to any issue, but these might be a good place to start! i/regression p/iOS 🍎 t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!

Comments

@OmerHmead
Copy link

Description

Steps to Reproduce

  1. Create new project;
  2. Add the following xaml to the main page ;
<StackLayout VerticalOptions="Center">
    <Label BackgroundColor="Yellow" FlowDirection="RightToLeft">
      <Label.FormattedText>
        <FormattedString>
          <Span Text="Formatted"></Span>
          <Span Text=" "></Span>
          <Span Text="Text"></Span>
        </FormattedString>
      </Label.FormattedText>
    </Label>
    <Label  Text="Normal Text" BackgroundColor="Pink" FlowDirection="RightToLeft"/>
  </StackLayout>

Expected Behavior

The text should be aligned to the right

Actual Behavior

The text is aligned to the left.

Basic Information

  • Version with issue: (Latest) 3.1.0.637273
  • IDE: Visual Studio 2017
  • Platform Target Frameworks:
    • iOS: (Tested on) 11.4
  • Affected Devices: All

Screenshots

image

@pauldipietro pauldipietro added this to New in Triage Jul 15, 2018
@PureWeen
Copy link
Contributor

This looks like it will be fixed in an upcoming release

I tested using our nightly
https://blog.xamarin.com/try-the-latest-in-xamarin-forms-with-nightly-builds/

And we should have a 3.2 pre-release out soon that looks to also have this issue resolved

image

Triage automation moved this from New to Closed Jul 17, 2018
@samhouts samhouts removed this from Closed in Triage Aug 16, 2018
@Omarkth
Copy link

Omarkth commented Oct 7, 2019

Hi, looks like this has bug is a regression, it was working up until 3.4

4.2.X
image

It's even worse in 4.3-pre3 where even the normal text stopped responding to the set FlowDirection
4.3-pre3
image

@samhouts samhouts reopened this Oct 7, 2019
@samhouts samhouts added this to New in Triage via automation Oct 7, 2019
@jfversluis
Copy link
Member

Added a repro project, seems to not work at all anymore for both iOS and Android

Repro3311.zip

@jfversluis jfversluis added e/3 🕒 3 and removed s/unverified New report that has yet to be verified labels Oct 8, 2019
@jfversluis jfversluis moved this from New to Ready For Work in Triage Oct 8, 2019
@samhouts samhouts added this to To do in iOS Ready For Work Oct 14, 2019
@samhouts samhouts removed this from Ready For Work in Triage Oct 14, 2019
@samhouts samhouts added this to To do in Sprint 161 Oct 28, 2019
@samhouts samhouts added this to To do in Sprint 162 Nov 18, 2019
@samhouts samhouts moved this from To do to Continued in next sprint in Sprint 161 Nov 18, 2019
@samhouts samhouts added this to To do in Sprint 163 Dec 7, 2019
@samhouts samhouts moved this from To do to Continued in next sprint in Sprint 162 Dec 7, 2019
@samhouts samhouts moved this from To do to Returned to backlog in Sprint 163 Jan 3, 2020
@samhouts samhouts added the 3.1.0 regression on 3.1.0 label Jun 17, 2020
@samhouts samhouts added inactive Issue is older than 6 months and needs to be retested and removed inactive Issue is older than 6 months and needs to be retested labels Jul 17, 2020
@samhouts samhouts added help wanted We welcome community contributions to any issue, but these might be a good place to start! up-for-grabs We welcome community contributions to any issue, but these might be a good place to start! and removed help wanted We welcome community contributions to any issue, but these might be a good place to start! labels Jul 17, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 14, 2020
@samhouts samhouts added inactive Issue is older than 6 months and needs to be retested help wanted We welcome community contributions to any issue, but these might be a good place to start! and removed inactive Issue is older than 6 months and needs to be retested labels Sep 18, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@samhouts
Copy link
Member

samhouts commented Nov 5, 2020

This issue doesn't seem to have had any activity in a long time. We're working on prioritizing issues and resolving them as quickly as we can. To help us get through the list, we would appreciate an update from you to let us know if this is still affecting you on the latest version of Xamarin.Forms, since it's possible that we may have resolved this as part of another related or duplicate issue. If we don't see any new activity on this issue in the next 30 days, we'll evaluate whether this issue should be closed. Thank you!

@samhouts samhouts added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Nov 5, 2020
@samhouts samhouts added this to Needs Info in Triage Nov 5, 2020
@Elashi
Copy link
Contributor

Elashi commented Nov 14, 2020

I am still having the problem on iOS devices

@Elashi
Copy link
Contributor

Elashi commented Nov 23, 2020

Any news about this issue?

@Redth Redth removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Nov 30, 2020
@rachelkang
Copy link
Contributor

@Elashi are you having issues with RTL for just the FormattedText on iOS, or also for the normal Label?

@Elashi
Copy link
Contributor

Elashi commented Dec 1, 2020

I have issues with RTL only when I use <Label.FormattedText> and only in iOS

@Redth Redth moved this from Needs Info to New in Triage Dec 1, 2020
@Redth Redth moved this from New to Ready For Work in Triage Dec 1, 2020
@sjorsmiltenburg
Copy link

@Elashi do you have a workaround?

@Elashi
Copy link
Contributor

Elashi commented Jan 20, 2021

Yes, not to use <Label.FormattedText>. I just use multiple <Labe>s instead now.
Instead of using one single big label with a lot of <Span>s in it , I use multiple <Label>s
Actually , <Span>s have another problem. If you add Tap gesture handler to it, it will not catch it if you tap on it, you have to tap bellow the actual <Span> to be handled correctly.
do NOT use <Span> !

Triage automation moved this from Ready For Work to Closed Jan 27, 2021
iOS Ready For Work automation moved this from To do to Done Jan 27, 2021
rmarinho pushed a commit that referenced this issue Jan 27, 2021
…3311 fixes #12473 fixes #8157

* Add Issue3311.cs

* Update Issue331.cs test file

* Fix RTL issue on FormattedText

* Add relevant RTL FormattedText test

* Update Issue3311.cs

* Add Issue12473

* Add BackgroundColor to test labels for clarit

* Add LabelTest for RTL Label with LineHeight

* Add missing closing EmbeddedResource tag

* Remove UITest template code

* Update RTL tests to be more thorough

* UpdateHorizontalTextAlignment on UpdateFormattedText

Fix RTL issue that arises when certain text properties are set on a Label w/ RTL and FormattedText (i.e. FontAttributes, FontSize, LineHeight, TextColor, TextTransform, etc)

* Remove TextType from tests

TextType on FormattedText labels causes app crash. This separate issue will be fixed in a follow-up PR
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.1.0 regression on 3.1.0 a/rtl e/3 🕒 3 help wanted We welcome community contributions to any issue, but these might be a good place to start! i/regression p/iOS 🍎 t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!
Projects
Triage
  
Closed
Sprint 161
  
Continued in next sprint
Sprint 162
  
Continued in next sprint
Sprint 163
  
Returned to backlog
Development

Successfully merging a pull request may close this issue.

9 participants