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 TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch) #38359

Closed

Conversation

fabOnReact
Copy link
Contributor

@fabOnReact fabOnReact commented Jul 15, 2023

Summary:

This PR fixes visual regression introduced with #37465 (comment). Detailed explanation available in the summary of PR #37465.

Adding paragraphStyle.maximumLineHeight to a iOS UITextField displays the text under the UITextField (ios-screenshot-1, ios-screenshot-2, ios-screenshot-3).

The PR implements the logic from RCTTextShadowView #postprocessAttributedText in RCTBaseTextInpuShadowView #uiManagerWillPerformMounting.

fixes #28012 fixes #33986 fixes Expensify/App#15640
Related #35741 #31112

Changelog:

[IOS] [FIXED] - Fix TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch)

Test Plan:

Extensive test included in the PR comments #37465 (comment) and Expensify/App#17767 (comment)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 15, 2023
@analysis-bot
Copy link

analysis-bot commented Jul 15, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 16,525,138 -2
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 19,899,939 +6
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 43826fa
Branch: main

@fabOnReact fabOnReact changed the title Fix TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch) Fix Text vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch) Nov 7, 2023
@fabOnReact fabOnReact changed the title Fix Text vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch) Fix TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch) Nov 12, 2023
@fabOnReact
Copy link
Contributor Author

Update 16/12/2023

Re-based and re-tested (previous test here Expensify/App#17767 (comment))

before

after

@fabOnReact
Copy link
Contributor Author

fabOnReact commented Dec 16, 2023

CI failures are caused by CI configs. They are not related to the changes in the PR.

@fabOnReact
Copy link
Contributor Author

CI Failure not related to PR

Using SSH Config Dir '/root/.ssh'
git version 2.30.2
Cloning git repository
Cloning into '.'...
Warning: Permanently added the ECDSA host key for IP address '140.82.113.4' to the list of known hosts.
remote: Enumerating objects: 1470555, done.        
remote: Counting objects: 100% (73/73), done.        
remote: Compressing objects: 100% (55/55), done.        
remote: Total 1470555 (delta 23), reused 53 (delta 14), pack-reused 1470482        
Receiving objects: 100% (1470555/1470555), 847.09 MiB | 4.94 MiB/s, done.
Connection to github.com closed by remote host.
Resolving deltas: 100% (863101/863101), done.
Checking objects: 100% (4194304/4194304), done.

exit status 255

@fabOnReact
Copy link
Contributor Author

Hello @dmytrorykun. How can I help to get this PR merged? Thanks a lot

@facebook-github-bot
Copy link
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 2, 2024
@facebook-github-bot
Copy link
Contributor

@dmytrorykun merged this pull request in 349d550.

@haileyok
Copy link
Contributor

haileyok commented Feb 6, 2024

@fabOnReact Jumping in real quick to say thanks for this one!

@NickGerleman
Copy link
Contributor

@fabOnReact @dmytrorykun @cipolleschi this caused a change when merged which broke the RNTester UI test we have for lineheight style on multiline textinput, for iOS Paper.

Before/after

image

References:

iOS Fabric Android Fabric
image image

From the description it looks like this change was replicating some logic from Fabric, but now in this example, we renderer differently between old arch and new arch? Do we know why the RNTester textStyles example rendering is now different between the two, and if one of these has an issue?

I'm going to assign this failure to @dmytrorykun internally to follow up, and either update screenshots, or pursue a fix.

lunaleaps pushed a commit that referenced this pull request Feb 20, 2024
…iOS without changing Text baseline (Paper - old arch) (#38359)

Summary:
This PR fixes visual regression introduced with #37465 (comment)

Adding paragraphStyle.maximumLineHeight to a iOS UITextField displays the text under the UITextField ([ios-screenshot-1][1], [ios-screenshot-2][2], [ios-screenshot-3][3]).

The PR implements the logic from RCTTextShadowView [#postprocessAttributedText](https://github.com/facebook/react-native/blob/9ab27e8895d6934e72ebdc601d169578ab9628f1/packages/react-native/Libraries/Text/Text/RCTTextShadowView.m#L165-L167) in RCTBaseTextInpuShadowView [#uiManagerWillPerformMounting](https://github.com/facebook/react-native/blob/4c944540f732c6055d447ecaf37d5c8f3eec1bc4/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m#L130-L192).

[1]: https://user-images.githubusercontent.com/24992535/238834159-566f7eef-ea2d-4fd4-a519-099b0a12046c.png "ios-screenshot-1"
[2]: https://user-images.githubusercontent.com/24992535/238834184-feb454a9-6504-4832-aec8-989f1d027861.png "ios-screenshot-2"
[3]: https://user-images.githubusercontent.com/24992535/238834283-cf572f94-a641-4790-92bf-bbe43afb1443.png "ios-screenshot-3"

[4]: https://github.com/Expensify/App/assets/24992535/06726b45-7e35-4003-9fcc-50c8d0dff0f6
[5]: https://github.com/Expensify/App/assets/24992535/d9745d29-8863-4170-bcc3-e78fa7e550d2

fixes #28012 fixes #33986
Related #35741 #31112

## Changelog:

[IOS] [FIXED] - Fix TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch)

Pull Request resolved: #38359

Test Plan: Extensive test included in the PR comments #37465 (comment) and Expensify/App#17767 (comment)

Reviewed By: cipolleschi

Differential Revision: D52325261

Pulled By: dmytrorykun

fbshipit-source-id: d072a598bfaafbbffc41005b1fda1795cf3d8ab9
fabOnReact added a commit to fabOnReact/react-native-live-markdown that referenced this pull request May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
5 participants