question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] TextInput does not scroll to reveal what's being typed

See original GitHub issue

If a user inputs a large text into a TextInput it’s stopping the caret at the last visible position without showing what’s being typed by the user.

React Native version:

info Fetching system and libraries information...
System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 534.96 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    Watchman: 4.7.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.1, 24.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
      System Images: android-26 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64
  IDEs:
    Android Studio: 3.0 AI-171.4443003
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5

Steps To Reproduce

  1. Create a TextInput and set either prop: value or defaultValue
  2. Add fontSize and lineHeight to the field’s style.
<TextInput
  defaultValue='some default value'
  style={{ fontSize: 28, lineHeight: 32 }}
/>

Our investigations have discovered this is an iOS only issue. It appears to happen only for devices without the notch. These were the ones we were able to observe the issue happening:

  • iPhone 8 (12.4)
  • iPhone 8+ (12.1.2)
  • iPhone 7+ (11.4.1)
  • iPhone 6S+ (11.4.1)
  • iPhone SE (9.3.2)

The issue does not occur for Android. We were also able to notice the correct behavior happening on iPhone X and XS Max.

Describe what you expected to happen

The TextInput should scroll to the side revealing what the user is typing.

Example

Run this on iOS: https://snack.expo.io/Sk3hmoHBB

simulator

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

4reactions
chrisdrackettcommented, Mar 6, 2020

it seems to me this can be related to both lineHeight and fontSize. For example in my app if the size is 14 it scrolls correctly with a line height set. If I set the size to 16 it will not scroll until I remove the lineHeight.

2reactions
fjcaetanocommented, Jan 21, 2020

The issue persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ios - Mobile Safari - Input caret does not scroll along with ...
This is indeed a WebKit bug and there seems to be no known workaround. ... I was found - on scrolling event to...
Read more >
Swift TextField Not Horizontally Scrolling - Apple Developer
Hi, I had written a program a while back that includes numerous textfields. Previously, when typing in those fields, if the input was...
Read more >
TextInput · React Native
When the clear button should appear on the right side of the text view. This property is supported only for single-line TextInput component....
Read more >
How do I scroll left or right in a text input field on my iPhone?
If you're using an iPhone with Force Touch you can force press down anywhere on the keyboard to bring up the typing cursor....
Read more >
Move view when keyboard is shown (guide)
Most likely you have worked on an app with multiple textfields, and when the keyboard show up, there's a chance that your text...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found