react / react/react-native

TextInput onContentSizeChange triggers twice inside a Modal

Open
#47,186 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0.76 Component: Modal Component: TextInput Issue: Author Provided Repro Newer Patch Available Type: New Architecture
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

When using a TextInput inside a Modal, the onContentSizeChange callback is triggered twice instead of once. Outside the Modal the event triggers correctly (only once).

Steps to reproduce
  1. Install and launch the application
  2. Observe that onContentSizeChange triggers once (as expected)
  3. Click on the "Show modal" button
  4. Notice that onContentSizeChange for the TextInput inside the Modal triggers twice (unexpected behavior)
React Native Version

0.76.0

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info
System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
  Memory: 9.86 GB / 31.84 GB
Binaries:
  Node:
    version: 20.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.8.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    Android NDK: 22.1.7171670
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-231.9392.1.2311.11330709
  Visual Studio: Not Found
Languages:
  Java: 17.0.8
  Ruby: Not Found
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
    wanted: 0.76.0
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
(NOBRIDGE) LOG  39.607845306396484
(NOBRIDGE) LOG  20.39215660095215
(NOBRIDGE) LOG  39.607845306396484
Reproducer

https://github.com/ilaloov/textinput-issue

Screenshots and Videos

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproducer and reproduce the TextInput inside a Modal on Android and iOS using React Native 0.76.0. Trace the onContentSizeChange event from the Modal/TextInput entry points; done means the callback fires once inside the Modal, matching behavior outside it, with regression coverage for both affected platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.