Skip to content
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: App changes positions of Ui elements when phone language RTL #7594

Merged
merged 26 commits into from
Feb 25, 2022

Conversation

ahmdshrif
Copy link
Contributor

@ahmdshrif ahmdshrif commented Feb 6, 2022

Details

Fixed Issues

$ #7476

Tests

  • Verify that no errors appear in the JS console

QA Steps

  1. Set phone language to any RTL ( Settings -> Languages & input -> Languages ) chose Arabic for example
  2. Open the app
  3. Login & Browse
  4. make sure the UI element is in its normal position
  5. make sure the normal text also does not align to right instead of left
  6. got to text input and use English keyboard (RTL language not supported)
  7. make sure text input aligns to left
  8. test on android and ios . and flow all previous steps.
  • Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Screen Shot 2022-02-07 at 2 22 50 AM

Mobile Web

Screenshot_20220207-211827_Chrome.jpg

Desktop

Screen Shot 2022-02-07 at 2 30 40 AM

iOS

Screen Shot 2022-02-07 at 2 02 02 AM
55b-d8534034caed.png)

Screen.Recording.2022-02-13.at.3.42.50.PM.mov

Android

Screen Shot 2022-02-07 at 1 45 17 AM

@ahmdshrif
Copy link
Contributor Author

ahmdshrif commented Feb 7, 2022

ios have an issue with force LTR which is text does not align to left
so I add textAlign left as default props to our base text and TextInputs component.

@ahmdshrif ahmdshrif marked this pull request as ready for review February 7, 2022 00:21
@ahmdshrif ahmdshrif requested a review from a team as a code owner February 7, 2022 00:21
@MelvinBot MelvinBot requested review from marcaaron and parasharrajat and removed request for a team, parasharrajat and marcaaron February 7, 2022 00:21
@parasharrajat
Copy link
Member

parasharrajat commented Feb 7, 2022

ios have an issue with force LTR which is text does not align to left
so I add textAlign left as default props to our base text and TextInputs component.

Could you please share your research on this? I would like to know more about this before accepting textAlign:left as a solution.

You have missed Mobile Web screenshots. Please add them.

@marcaaron
Copy link
Contributor

@parasharrajat let me know when you are ready to approve the PR and I will jump in.

@ahmdshrif
Copy link
Contributor Author

ahmdshrif commented Feb 7, 2022

@parasharrajat Ok i add screen for mobile web .

i share many resources in issue any one of them work fine in android .
On ios all elment is work fine expet the text alignment .

I do some search on this issue and i find that i can go with 3 directions

1_ using js and react native libs (i share this in proposal)
Same result .

2- using react native liberary from objectC
What i use now and not work for text alignment.

3- i search on how native do this (without react )
There option for uiview to force app to work from left to right .
And we can add default attribute to text to alignment left .
I use both and not work for text alignment.

[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];

"Changing to right to left RTL programmatically - Stack Overflow" https://stackoverflow.com/questions/35151038/changing-to-right-to-left-rtl-programmatically

"iOS9 - Force left to right | Apple Developer Forums" https://developer.apple.com/forums/thread/9130

So i add the default text alignment to left
And this fix this issue on ios .
this just default value will not effect any thing.

@parasharrajat
Copy link
Member

Did you try I18nManager.forceRTL(false) ? May be that works?

@ahmdshrif
Copy link
Contributor Author

Yes sure .
This is the first option i talk about .

@ahmdshrif
Copy link
Contributor Author

I find this issue on ios it looklike what we have now .
Lable text not get align correctly .

https://developer.apple.com/forums/thread/663724

@parasharrajat
Copy link
Member

parasharrajat commented Feb 7, 2022

So you mean this does not work against the alignment issue. If yes, I will test the code now to see if alignment is correct everywhere.

@ahmdshrif
Copy link
Contributor Author

Yes
It force the layout to work ltr
But not the text

@parasharrajat
Copy link
Member

parasharrajat commented Feb 8, 2022

Testing shortly. on my list 2/5.

@parasharrajat
Copy link
Member

Didn't get time to test it on all platforms today. I will do this first thing in the morning.

@ahmdshrif
Copy link
Contributor Author

ok @parasharrajat

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add proper QA steps for all possible platforms. They should indicate how to switch to RTL on the device.

Also, Is it safe to switch RTL? I don't know Arabic so it could be difficult for me to navigate the device to switch back to English.

src/components/Text.js Show resolved Hide resolved
src/components/TextInputFocusable/index.ios.js Outdated Show resolved Hide resolved
src/components/TextInputWithFocusStyles.js Outdated Show resolved Hide resolved
src/components/TextInputWithFocusStyles.js Outdated Show resolved Hide resolved
src/components/TextInputFocusable/index.ios.js Outdated Show resolved Hide resolved
src/components/TextInputWithPrefix/index.js Outdated Show resolved Hide resolved
@ahmdshrif
Copy link
Contributor Author

I can help if you need to switch back to English . but the easy way is to test on Emulator and you can wipe data if you can't switch back.

@ahmdshrif
Copy link
Contributor Author

we can test this on a call if you need help with Arabic.

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed a couple of comments from previous review. Try to go through them again.

index.js Outdated Show resolved Hide resolved
@ahmdshrif
Copy link
Contributor Author

done all changes .

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. But there are a few more places to be updated.

@ahmdshrif Could you please run a full check on the IOS app to see if everything is correctly aligned? Please record the video and attach it to the description only for IOS.

Picker is not aligned correctly. Profile page.
image

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more tweaks.

src/components/BaseInput/index.js Outdated Show resolved Hide resolved
src/components/BaseInput/index.js Outdated Show resolved Hide resolved
ahmdshrif and others added 2 commits February 24, 2022 17:18
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
@ahmdshrif
Copy link
Contributor Author

@parasharrajat ok done

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing again...

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmdshrif It looks good. The only things are :
Update QA steps to reflect that:

  1. Keep the Keyboard language to English. Arabic is not supported.
  2. Test on Both Android and IOS.

@ahmdshrif
Copy link
Contributor Author

@parasharrajat ok done.
thakns

parasharrajat
parasharrajat previously approved these changes Feb 24, 2022
Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ahmdshrif ahmdshrif requested a review from marcaaron February 24, 2022 19:37
forwardedRef: () => {},
};

const BaseInput = props => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry I hate to do this, but BaseInput is a pretty generic name and BaseTextInput is already taken... can we call this RNTextInput.js instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok done. thanks .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience here 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. 😃

@marcaaron marcaaron merged commit 2be5a0e into Expensify:main Feb 25, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

OSBotify commented Mar 1, 2022

🚀 Deployed to staging by @marcaaron in version: 1.1.41-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 failure ❌

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2022

🚀 Deployed to staging by @marcaaron in version: 1.1.41-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 failure ❌

@mvtglobally
Copy link

Team is having a bit hard time validating this PR on Desktop as it requires device language change and introducing navigation issues to flip language back as options shift.
We validated Web/mWeb/IOS and Android. It would be great if someone can validate internally Desktop

@ahmdshrif
Copy link
Contributor Author

#7922 (comment) same suggestion here.

@francoisl
Copy link
Contributor

Hi @mvtglobally, were you able to test with the suggestion here?

@mvtglobally
Copy link

@francoisl yes, checked off both PRs

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @francoisl in version: 1.1.41-6 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@mollfpr
Copy link
Contributor

mollfpr commented Jan 27, 2023

Coming from #13802, there's a code that is causing that regression. Setting textAlign props to the TextInput makes the ... missing on iOS. Explanation proposal here. Thanks!

@parasharrajat
Copy link
Member

TextAlign:left was necessary for forcing RTL mode. Why do we need ... on the text input if the text is long? It should be scrollable not clipped with an ellipsis.

@sakluger
Copy link
Contributor

@parasharrajat the fix only adds the ... on iOS, where that is the standard pattern for text longer than the field. All other platforms (web, desktop app, android) all have scrollable text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants