Repository navigation
Closed
Description
Hi, guys! Did someone facing the same issue with lineHeight on iOS ? any solution ?
React Native version: "0.61.5"
Code:
import React from 'react'
import { View, TextInput, StyleSheet } from 'react-native'
export default function Example () {
return (
<View style={styles.wrapper}>
<TextInput style={styles.input} placeholder='Hello World!' />
</View>
)
}
const styles = StyleSheet.create({
wrapper: {
height: '100%',
width: '100%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'lightgray'
},
input: {
height: 32,
minWidth: 120,
lineHeight: 32,
borderWidth: 1,
backgroundColor: 'white',
padding: 0,
fontSize: 14
}
})
same on 0.62.2 version
rn info:
System:
OS: macOS 10.15.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 404.19 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.2.0 - ~/.nvm/versions/node/v14.2.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v14.2.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 13.0.2 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ^16.13.1 => 16.13.1
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Reacted by Raviraj, Mikel Ros, Domas Bitvinskas, John Haley, Max Korp, thisisgit, saskaak, acrazing, Filipe Degrazia, Alexandre Daubricourt and 7 more
Reacted by Mikhail Drakus, Filipe Degrazia and Kornel Kocsis
Metadata
Metadata
Assignees
Labels
No labels



Activity
label-actions commentedon Apr 1, 2020
react-native infoin a console.mikelros commentedon Apr 17, 2020
Same here. Hope it's fixed soon 👍
Esxiel commentedon Jul 13, 2020
Here to confirm that the problem persists in 0.63.0 as well
stale commentedon Oct 12, 2020
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
askel4dd commentedon Dec 1, 2020
Applied changes from #29262 using patch-package to fix this, like so:
React Native 0.63.3
saskaak commentedon May 4, 2021
@askel4dd That doesn't seem to fix the issue.
It seems that the problem only happens on iOS with large
fontSize-lineHeightdifferences. (In the original examplefontSize: 14andlineHeight: 32.) The workaround for me right now is to setlineHeight: nulland use a wrapperViewto achieve correct positioning.dann1609 commentedon Mar 26, 2022
the issue is still present.
filiptdz commentedon Sep 2, 2022
For the past few years I've just avoided using
lineHeighton React Native, as it's more trouble than it's worth. However, while you can add padding to a single line there's no decent hack for multiline text. Hopefully there's a solution soon.Akronae commentedon Feb 7, 2023
Same boat here
17 remaining items
fabOnReact commentedon May 1, 2023
Example from Issue #28012
Text is not correctly aligned when using lineHeight and height in a TextInput.
Before applying the fix
main.branch.mp4
After applying the fix
correct.caret.position.mp4
correct.caret.position.2.mp4
reduce cursor size for multiline(TextInput) (react#36484)
fix: make cursor center for different line height (react#36586)
bryanprimus commentedon Aug 5, 2023
Is there a workaround for this? still happening in RN
v0.72.3kimjson commentedon Dec 28, 2023
@bryanltobing you can try applying this fix using patch-package
Fix TextInput vertical alignment issue when using lineHeight prop on …
Fix TextInput vertical alignment issue when using lineHeight prop on …
Fix TextInput vertical alignment issue when using lineHeight prop on …