react / react/react-native

TextInput onContentSizeChange triggers twice inside a Modal

未关闭
#47,186 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

0.76 Component: Modal Component: TextInput Issue: Author Provided Repro Newer Patch Available Type: New Architecture
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 reproducer 开始,使用 React Native 0.76.0 在 Android 和 iOS 上复现 Modal 内的 TextInput。从 Modal/TextInput 的入口跟踪 onContentSizeChange 事件;完成标准是 callback 在 Modal 内触发一次,与 Modal 外的行为一致,并为受影响的两个平台提供回归覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。