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.

TextInput multiline is jumpy and flaky when pressing new line

See original GitHub issue

Description

When you set mutline to true and enter/delete new lines, the scrolling is really flaky. Notice that this app was instantiated with npx react-native init myapp --template react-native-template-typescript

Android

https://user-images.githubusercontent.com/21032419/155330305-e22acaae-0e77-422b-af85-c565f0e81073.mov

iOS

https://user-images.githubusercontent.com/21032419/155330662-c1bd6d24-d02a-4c6d-a6d4-8ce2010537cf.mov

Version

0.67.2

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 11.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 72.38 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/projects/samalapit/sellers/mobile-app/node_modules/.bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2021.12.06.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/aprilmintacpineda/.rvm/gems/ruby-3.0.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.2 => 0.67.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

import { TextInput } from 'react-native';
<TextInput
  style={{
    borderWidth: 1,
    borderColor: '#000'
  }}
  multiline
/>

Adding scrollEnabled={false} will somehow fix the issue but:

  • it’s not viable if you need the scrolling to be enabled.
  • It only fixes it for iOS, Android will still have a problem especially when delete new lines fast as seen in the video above.

Snack, code example, screenshot, or link to a repository

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
Omelyancommented, Jul 15, 2022

oh, this has been around for years. yes it’s a regular text input that flickers in a very basic scenario so user can tell for sure if the app was made using RN)) the problem seems to be due to lack of space to render the string, or some like that, so I made a wrapper that measures the size of text and sets a min height (+some extra actually) for the input. Not perfect, bu now I’m using it.

1reaction
efstathiosntonascommented, Mar 3, 2022

@aprilmintacpineda ignore the first quote on your comment above, I confused the issues 🥴.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable inserting new line in multiline TextInput when ...
I want to build a chat app which is multiline TextInput and user can send the message when the enter is pressed ......
Read more >
GitLab Flavored Markdown (GLFM)
A line break is inserted (a new paragraph starts) if the previous text is ended with two newlines, like when you press Enter...
Read more >
A complete guide to TextInput in React Native - LogRocket Blog
Learn how to implement React Native's TextInput component, customize it to ... The TextInput component can also accept multi-line text.
Read more >
Make a text multi-line - Customily Knowledge Base
When a text box has enough height to fit multiple lines, it is multi-line by default. However, in order to jump to the...
Read more >
Break the line when reached to end of TextInput view-React ...
How to disable inserting new line in multiline TextInput when enter is pressed in React Native · How to place a component at...
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