Skip to content

[Android] Content jump in multiline TextInput when adding/removing line of text due to delayed layout update happening after content update #46813

Open

Description

@tomekzaw

Description

When adding a new line of text in multiline TextInput component (e.g. after pressing Enter), there's a slight delay between updating the content of the text and updating the height of the component (i.e. layout) on Android with New Architecture enabled, on both New and Old Architecture.

This causes a content jump (to the top and back to the bottom) visible for one or more frames.

Before adding newline (correct):
Screenshot 2024-10-03 at 16 45 31

After pressing "Enter" (incorrect frame):
Screenshot 2024-10-03 at 16 45 39

After one or more frames (correct):
Screenshot 2024-10-03 at 16 45 47

Video recording:

Screen.Recording.2024-10-03.at.16.39.54.mov

Note that there's also an issue with measuring the height of the last line of the text if it's empty but it's already fixed by @j-piasecki in #42331 as well as by @NickGerleman in #46613 but the issue with content jump still persists.

Steps to reproduce

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

import React from 'react';

export default function App() {
  return (
    <View style={styles.container}>
      <TextInput multiline style={styles.input} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
  },
  input: {
    fontSize: 20,
    borderWidth: 1,
    borderColor: 'black',
    width: 300,
    marginTop: 100,
    padding: 0,
  },
});

React Native Version

0.76.0-rc.3

Affected Platforms

Runtime - Android

Areas

Fabric - The New Renderer

Output of npx react-native info

System:
  OS: macOS 15.0
  CPU: (12) arm64 Apple M3 Pro
  Memory: 99.83 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v18.19.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman:
    version: 2024.09.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/tomekzaw/.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:
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /Users/tomekzaw/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0-alpha.2
    wanted: 15.0.0-alpha.2
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0-rc.3
    wanted: 0.76.0-rc.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

No crash or failure

Reproducer

https://github.com/tomekzaw/repro-new-arch-android-textinput

Screenshots and Videos

Screen.Recording.2024-10-03.at.16.39.54.mov

Activity

  1. added
    Type: New Architecture
    on Oct 3, 2024
  2. added
    Component: TextInput
    on Oct 3, 2024
  3. changed the title [-]TextInput content jump when adding/removing line of text due to delayed layout update happening after content update[/-] [+]Multiline TextInput content jump when adding/removing line of text due to delayed layout update happening after content update[/+] on Oct 3, 2024
  4. changed the title [-]Multiline TextInput content jump when adding/removing line of text due to delayed layout update happening after content update[/-] [+]Content jump in multiline `TextInput` when adding/removing line of text due to delayed layout update happening after content update[/+] on Oct 3, 2024
  5. changed the title [-]Content jump in multiline `TextInput` when adding/removing line of text due to delayed layout update happening after content update[/-] [+][Android] Content jump in multiline `TextInput` when adding/removing line of text due to delayed layout update happening after content update[/+] on Oct 14, 2024
  6. added
    Platform: Android
    on Oct 14, 2024
  7. react-native-bot commented on Apr 13, 2025

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  8. react-native-bot commented on Apr 13, 2025

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  9. added
    Stale
    on Apr 13, 2025
  10. tomekzaw commented on Apr 13, 2025

    @tomekzaw
    ContributorAuthor

    I believe this is still an issue.

  11. removed
    Stale
    on Apr 14, 2025
  12. added
    Issue: Author Provided Repro
    and removed on Jun 11, 2025
  13. tomekzaw commented on Jul 9, 2025

    @tomekzaw
    ContributorAuthor

    Here are the screenshots from the Expensify app:

    Frame 1 (before editing) Frame 2 (incorrect height) Frame 3 (correct height)
    Image Image Image
  14. removed
    Type: New Architecture
    on Jul 10, 2025
  15. added a commit that references this issue on Jul 10, 2025
  16. rterence commented on Jul 24, 2026

    @rterence

    Still reproducible on React Native 0.86.0 (New Architecture, Hermes), so this has survived from 0.76 through to 0.86.

    Same symptom as the original report: adding a line to a multiline TextInput re-flows the text against the previous height for a frame before settling.

    One detail that might help confirm the diagnosis — the jump stops entirely once the field reaches a maxHeight cap. Once the height stops changing there's no delayed layout to catch up on, and no jump. That fits the "layout update lands after the content update" explanation rather than anything to do with text measurement.

    Two notes on where the fix stands, since it took a bit of digging to work out:

    • @nocommit Make ReactTextChangedEvent syncronous #52534 (make ReactTextChangedEvent synchronous) was closed by the stale bot in January 2026 with no review comments on it. It was marked @nocommit, so it looks like it was held back deliberately rather than rejected — but nothing on the thread says why, and from the outside it reads like an abandoned attempt.
    • That change still applies cleanly to 0.86. ReactTextChangedEvent.kt has moved on since (deprecated constructors removed, selection added to the payload), but there's still no experimental_isSynchronous override on it, and the synchronous dispatch path in FabricEventDispatcher is intact.

    Is there a known blocker on that approach? I'd guess the cost of making topChange synchronous when it fires on every keystroke — VirtualViewModeChangeEvent is currently the only event in core that opts in. If that's the concern, is a narrower version worth trying, e.g. gated on multiline, or behind a feature flag?

    One caveat on severity: my only Android run was on an emulator with software rendering (-gpu swiftshader_indirect), which exaggerates frame-timing artefacts, so I can't speak to how bad this looks on real hardware. iOS is unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputIssue: Author Provided ReproPartnerPlatform: Androidp: Software Mansion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions