Material: RTL UITextField

Created on 2 Oct 2018  路  10Comments  路  Source: CosmicMind/Material

Hey guys congrats for the work.
i am facing a problem since ios12 and the new version that you guys release, my textfield in rtl break alignments as you can see above,

captura de ecra 2018-10-02 as 13 11 03

captura de ecra 2018-10-02 as 13 11 10

captura de ecra 2018-10-02 as 13 11 17

captura de ecra 2018-10-02 as 13 11 24

Do you already face this issue ? On iOS 11 and old version of the framework I don't have problems.
Thanks.

good first issue help wanted investigate material

Most helpful comment

@pedroOliveiraptc You have following line:

UIView.appearance().semanticContentAttribute = .forceRightToLeft

It makes some changes internal to UITextField:
image
From: #WWDC15 App Frameworks

We give padding as much as the height of the textField if leftView has non-nil value. Since leftView is swapped with rightView internally when you have .forceRightToLeft, accessing leftView returns non-nil value (value of rightView) therefore we add padding. You workaround this by setting rightView to nil:

let textField = TextField()
textField.rightView = nil // so that when it gets swapped with leftView, leftView still stays nil

Actually we don' support RTL yet, so we don't test our framework against such cases.

btw, you can use development branch, it has cool updates such as Theming (#1115) and Dialog (#1173) :)

All 10 comments

Hey @pedroOliveiraptc, Thank you. Can you try the development branch, and let us know if the issue persists. If so, please send a reproducible issue so we can investigate it. Thank you!

@danieldahan thanks I will try.

Hey @pedroOliveiraptc, Thank you. Can you try the development branch, and let us know if the issue persists. If so, please send a reproducible issue so we can investigate it. Thank you!

Hello the placeholder its ok, but the input text and the component line it self are not aligned.
captura de ecra 2018-10-03 as 08 57 55

@pedroOliveiraptc Can you share the code for us to achieve the same result on our computer?

@pedroOliveiraptc Can you share the code for us to achieve the same result on our computer?

i will create a sample app to share.
thanks.

@pedroOliveiraptc Are you still facing this issue? If so, please reopen this and submit a sample app. Thank you!

Hello sorry for the delay, the link for sample project

https://drive.google.com/file/d/1gl4BQvgH2QvU5FrU0FM3ViHDwUVVr_7U/view

Thank you we'll look into soon.

@pedroOliveiraptc You have following line:

UIView.appearance().semanticContentAttribute = .forceRightToLeft

It makes some changes internal to UITextField:
image
From: #WWDC15 App Frameworks

We give padding as much as the height of the textField if leftView has non-nil value. Since leftView is swapped with rightView internally when you have .forceRightToLeft, accessing leftView returns non-nil value (value of rightView) therefore we add padding. You workaround this by setting rightView to nil:

let textField = TextField()
textField.rightView = nil // so that when it gets swapped with leftView, leftView still stays nil

Actually we don' support RTL yet, so we don't test our framework against such cases.

btw, you can use development branch, it has cool updates such as Theming (#1115) and Dialog (#1173) :)

@OrkhanAlikhanov I created an issue for us to support RTL. https://github.com/CosmicMind/Material/issues/1179, let's follow that issue for the RTL feature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MacMeDan picture MacMeDan  路  28Comments

mohpor picture mohpor  路  43Comments

ijameelkhan picture ijameelkhan  路  23Comments

tato469 picture tato469  路  17Comments

timoschwarzer picture timoschwarzer  路  19Comments