react / react/react-native

TextInput value cannot be manipulated via setNativeProps after user input on iOS

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

还没有人认领这个 Issue。

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

描述

Description

When an uncontrolled TextInput has had its value manipulated via setNativeProps, receives user input and is then manipulated again via setNativeProps, the displayed value does not change.

This looks to be a New Arch issue and the issue is not reproducible in 0.76.0 on the old architecture.

Steps to reproduce
  1. Install the application with yarn ios
  2. Press "Press me!"
  3. Note that the TextInput contains the text "bananas"
  4. Clear the input field
  5. Press "Press me!"
  6. Note that the input field remains empty
React Native Version

0.76.0

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx react-native info
System:
  OS: macOS 14.7
  CPU: (16) arm64 Apple M3 Max
  Memory: 2.53 GB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.4
    path: /opt/homebrew/Cellar/node@18/18.20.4_1/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.7.0
    path: /opt/homebrew/Cellar/node@18/18.20.4_1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/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: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/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
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
None
Reproducer

https://github.com/mhoran/new-arch-set-text-repro/

Screenshots and Videos

No response

贡献指南

打开贡献指南

从这里开始

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

调研方向

使用链接的 new-arch-set-text-repro 仓库,并在报告的 React Native 0.76.0 New Architecture 配置下运行 yarn ios。复现设置“bananas”、输入用户输入、清除它,然后再次按下按钮这一序列;当第二次 native update 改变显示的 TextInput 值时,即表示完成。

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

评估

技术栈
ios, javascript, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

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