react / react/react-native

Autocomplete Failure in React Native TextInput with multiline={true} Prop (TextInput)

未关闭
#44,036 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

In React Native's TextInput component, when the multiline={true} prop is set,
it interferes with the autocomplete functionality,
preventing the keyboard from detecting text from incoming messages.
This issue becomes particularly noticeable when implementing OTP (One-Time Password) functionalities.

The expected behavior is for the keyboard to automatically recognize text from incoming messages, and when tapping on the top row of suggested text, it should paste that text into the corresponding TextInput field.
However, due to the multiline={true} setting,
this functionality is disrupted, leading to an inconsistent user experience.

Steps to reproduce

Set multiline={true} in a TextInput component.
Trigger a scenario where autocomplete text is expected to be suggested by the keyboard (e.g., OTP input).
Observe that the keyboard fails to detect and suggest incoming message text.
Attempt to tap on the top row of suggested text, noting that it does not paste into the TextInput field as expected.

React Native Version

0.70.12

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info
System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M2 Pro
    Memory: 70.38 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33, 34
      Build Tools: 30.0.2, 30.0.3, 31.0.0, 33.0.2, 34.0.0
      System Images: android-30 | Intel x86_64 Atom, android-34 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2023.2 AI-232.10227.8.2321.11479570
    Xcode: 15.2/15C500b - /usr/bin/xcodebuild
  Languages:
    Java: 21.0.2 - /opt/homebrew/opt/openjdk/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.12 => 0.70.12 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
Stacktrace or Logs
No stack trace as this is not crash failure issue
Reproducer

https://snack.expo.dev/@buddhanag/multiline-autocomplete-keyboard?platform=web

Screenshots and Videos

This screen-recording is being done separately the iOS video is from a real device connected to react native metro server for debugging the issue.

this video explains when we use multiline the keyboard autocomplete text disappears.

https://github.com/facebook/react-native/assets/31861172/8c91b5c3-fe2c-423a-b8d8-ee8df6a3f113

https://github.com/facebook/react-native/assets/31861172/efff5b3c-967b-4264-bb24-bf5d5da5ccea

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先在 Android 和 iOS 上使用 React Native 0.70.12 运行链接的 Snack 复现程序,然后跟踪相关平台实现中的 TextInput 多行输入和自动完成行为。当 multiline={true} 时,传入的 OTP 文本会被建议并且可以插入,即表示完成;该 issue 未指定源文件或测试。

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

评估

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

把新 issue 发到你的邮箱

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