Skip to content

iOS: Singleline TextInput auto grow: text gets cut while typing #46838

@hannojg

Description

@hannojg

Description

When having a single-line <TextInput /> it will automatically grow its width by the length of text entered.
However, it can be observed that there is a slight flickering while entering text.
When examined frame by frame you can see that the text input gets cut.

This doesn’t happen in a clean iOS app using UIKit and UITextView. My expectation is that, as we are using UITextView in <TextInput /> on iOS, it neither happens in react native.

Steps to reproduce

  1. Open the reproducer snack
  2. Run on your iPhone or simulator
  3. Record your screen
  4. Rapidly type text
  5. You might notice a slight feel of flickering while typing
  6. In the screen recording, if you step frame by frame, you may notice that while the text is entered the text input gets cut

React Native Version

0.75.4

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0
  CPU: (12) arm64 Apple M2 Pro
  Memory: 147.94 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: ~/.nvm/versions/node/v20.17.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v20.15.1/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.17.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/hannomargelo/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "31"
      - "32"
      - "33"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
    System Images:
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Wear OS 4 ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-33 | Google APIs ATD ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ATD ARM 64
    Android NDK: 26.1.10909125
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.7
    path: /Users/hannomargelo/.jenv/shims/javac
  Ruby:
    version: 2.7.6
    path: /Users/hannomargelo/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No relevant logs.

Reproducer

https://snack.expo.dev/@hannojg/rntextinput-autogrow-issue

Screenshots and Videos

❌ React Native TextInput ✅ UIKit UITextView
reproduction_rn2.mov
Simulator.Screen.Recording.-.iPhone.16.Pro.Max.-.2024-10-04.at.15.12.27.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputRelated to the TextInput component.Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions