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

Add fragmentLinePadding for multiline shadow view to track TextView correctly #1332

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

christophpurrer
Copy link

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Shadow views are used to calculate the container's size using NSTextContainer + NSLayoutManager + NSTextStorage according to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html.

However, when typing certain text, the TextView itself overflows, but its container doesn't.
This means our shadow view isn't tracking the TextView correctly.
Root cause was that we added a 1px lineFragmentPadding in #640, but we didn't add the save padding in our shadow view.

Changelog

[macOS] [Fixed] - Add fragmentLinePadding for multiline shadow view to track TextView correctly

Test Plan

  • Shrink app to minimum width
  • Type some text which overflows

Before

b.mov

After

a.mov

…orrectly

Shadow views are used to calculate the container's size using NSTextContainer + NSLayoutManager + NSTextStorage according to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html.

However, when typing certain text, the TextView itself overflows, but its container doesn't.
This means our shadow view isn't tracking the TextView correctly.
Root cause was that we added a 1px lineFragmentPadding in microsoft#640, but we didn't add the save padding in our shadow view.

Test Plan:
- Shrink app to minimum width
- Type some text which overflows
@Saadnajmi Saadnajmi merged commit 2b31eb9 into microsoft:main Aug 9, 2022
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Feb 13, 2023
…orrectly (microsoft#1332)

Shadow views are used to calculate the container's size using NSTextContainer + NSLayoutManager + NSTextStorage according to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html.

However, when typing certain text, the TextView itself overflows, but its container doesn't.
This means our shadow view isn't tracking the TextView correctly.
Root cause was that we added a 1px lineFragmentPadding in microsoft#640, but we didn't add the save padding in our shadow view.

Test Plan:
- Shrink app to minimum width
- Type some text which overflows

Co-authored-by: Alex Chiu <ackchiu@fb.com>
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Mar 10, 2023
…orrectly (microsoft#1332)

Shadow views are used to calculate the container's size using NSTextContainer + NSLayoutManager + NSTextStorage according to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html.

However, when typing certain text, the TextView itself overflows, but its container doesn't.
This means our shadow view isn't tracking the TextView correctly.
Root cause was that we added a 1px lineFragmentPadding in microsoft#640, but we didn't add the save padding in our shadow view.

Test Plan:
- Shrink app to minimum width
- Type some text which overflows

Co-authored-by: Alex Chiu <ackchiu@fb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants