You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to inconsistencies of NSLayoutManager configuration across RN, <Text /> and <TextInput /> components do handle line height in a slightly different way. More specifically, the resulting line heights of a <Text /> component seem to be correct, while <TextInput />s one is off by some fraction.
The reproduction is really trivial – please see the snack attached. Notice how the two columns of texts are perfectly aligned on the web and is not really aligned on iOS, although both elements share the same style attribute.
The same issue happens on Android, but it is probably caused by something different, as the amount by which the texts are off is smaller.
Steps to reproduce
Set custom line height to a <TextInput /> component
Measure the actual line height (using a screenshot)
You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
Oh yeah, very much looks like it is. I can prepare a PR disabling the font leading everywhere – we currently have a patch applied to our app and it seems to resolve the issue.
Description
Due to inconsistencies of NSLayoutManager configuration across RN,
<Text />
and<TextInput />
components do handle line height in a slightly different way. More specifically, the resulting line heights of a<Text />
component seem to be correct, while<TextInput />
s one is off by some fraction.The offending places seem to be https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm#L52 and
https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm#L274 – notice both are missing setting
usesFontLeading
toNO
(contrary, it gets set in other places, e.g. https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm#L223).The reproduction is really trivial – please see the snack attached. Notice how the two columns of texts are perfectly aligned on the web and is not really aligned on iOS, although both elements share the same style attribute.
The same issue happens on Android, but it is probably caused by something different, as the amount by which the texts are off is smaller.
Steps to reproduce
<TextInput />
componentReact Native Version
0.73.6
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/YI-C2DqB4yUmxW9Eb0cWW
Screenshots and Videos
The text was updated successfully, but these errors were encountered: