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

[TextInput] lineheight cuts off content on iOS #41240

Open
TLaMars opened this issue Oct 30, 2023 · 7 comments
Open

[TextInput] lineheight cuts off content on iOS #41240

TLaMars opened this issue Oct 30, 2023 · 7 comments
Labels
Component: TextInput Related to the TextInput component. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Newer Patch Available Platform: iOS iOS applications.

Comments

@TLaMars
Copy link

TLaMars commented Oct 30, 2023

Description

The TextInput on iOS cuts off content at dashes (-) if it has the lineHeight style applied to it. This happens when content is to long and therefore isn't completely visible in the input without moving through it.

If the lineHeight isn't applied it is not cut off at the dash (-) and the content will end with ellipsis (...).

We tried removing everything from the input and found out in that way it was the lineHeight that causes this issue.

This only happens on iOS and not on Android.

React Native Version

0.71.13

Output of npx react-native info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 55.56 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    Watchman: 2023.10.02.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.13.0 - /Users/thomaslamars/.rvm/gems/ruby-2.7.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.9971841
    Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
  Languages:
    Java: 18.0.2.1 - /Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: ^0.71.13 => 0.71.13 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

It is reproducible by making an TextInput with just lineHeight on it with the styling.
Than as value pass a really long string or type a really long string with dashes.
Get out of focus with the input and see that the value in the input gets truncated.

import { TextInput, SafeAreaView, StyleSheet } from 'react-native';

export default function App() {
  const value = "Thisisareallylong emailwithdashes-init@thawdisisasnackwhichisanexample.com"

  return (
    <SafeAreaView style={styles.container}>
      <TextInput value={value} style={{ lineHeight: 20 }} />
    </SafeAreaView>
  );
}

Snack, screenshot, or link to a repository

Snack url

Reproducible on Snack with expo 49 and react native version 0.72.4
https://snack.expo.dev/l0o3kNldL

@github-actions
Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.71.14. 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.

@github-actions github-actions bot added Newer Patch Available Component: TextInput Related to the TextInput component. Platform: iOS iOS applications. labels Oct 30, 2023
@cipolleschi
Copy link
Contributor

@TLaMars thanks for the issue. Are you using the old architecture or the new one?

@TLaMars
Copy link
Author

TLaMars commented Oct 30, 2023

@cipolleschi we are using the old architecture

@frankcalise
Copy link
Collaborator

Adding screenshots for clarity, thanks for the Snack!

iOS Android

@akumarclick
Copy link

@frankcalise , Did you find any solution? I am also facing the same issue.

@akumarclick
Copy link

My issue was happening due to textAlign: 'center' . I was able to resolve it with a this little hack.
Screenshot 2023-12-27 at 4 30 24 PM

@abhinandhand
Copy link

abhinandhand commented Mar 2, 2024

When line height is given I do face this same issue on iOS.

image

@cortinico cortinico added the Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: TextInput Related to the TextInput component. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Newer Patch Available Platform: iOS iOS applications.
Projects
None yet
Development

No branches or pull requests

6 participants