Skip to content

[iOS TextInput]: When multiline is set and adding new line - scroll changes it's position and causes jumps #39660

Closed as not planned
@Tymofiev

Description

@Tymofiev

Description

When multiline TextInput has lots of text and scroll is enabled and is scrolled down a bit - there are jumps when changing cursor position and inserting line breaks before other line breaks, it kind of jumps between two places. What I have noticed is that is return back to where the cursor is after adding another line break or other character.

I have looked through all open and related to TextInput issues and could not find anything similar to this.

React Native Version

0.72.5

Output of npx react-native info

System:
  OS: macOS 13.5.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 77.23 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.14.1
    path: ~/.nvm/versions/node/v18.14.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v18.14.1/bin/yarn
  npm:
    version: 9.3.1
    path: ~/.nvm/versions/node/v18.14.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/illyatymofiiev/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9619390
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.6
    path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.1.0
    path: /Users/illyatymofiiev/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. Render TextInput with multiline property.
  2. Insert some text with line breaks inside, so scroll appears and top text lines are scrolled up.
  3. Change cursor position to the top visible part of the TextInput and start inserting some line breaks.
  4. Notice scroll postition change and jumpy behaviour.

This only happens when inserting line breaks before line breaks, when insert line breaks before any other character - it seem to work fine.

I could reproduce it on either simulator or real device. There is the same issue on the version 0.71.8.

Snack, screenshot, or link to a repository

https://snack.expo.dev/8y09rVmAy

There is a screen recording of the same snack with example of how to reproduce this.
https://github.com/facebook/react-native/assets/44410158/e4c1f0f2-4e18-482b-9e22-a5565ecde6c7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputRelated to the TextInput component.Needs: Triage 🔍Platform: iOSiOS applications.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