react / react/react-native

Brownfield App `TextInput` not working properly on Samsung devices

未关闭
#46,989 7 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

In the midst of developing a chat app using brownfield react native app, an user reported with a video that it was not able to send a message. Upon further investigation I could scope down and reproduce the issue with the following criteria:

  • Brownfield React Native App inside an Android Fragment;
  • Samsung Devices:
    • Note 10;
    • S21 Ultra (Android 14 | OneUI 6.1).

I also tested on my Google Pixel 3a and it worked without any issues, so it must be Samsung related. Also, if the Android app opens an Activity that starts a react root view, the input also does work.

The cases where I could make it work were when I tapped in the corner of the TextInput. Adding console logs to the TextInput, the onPressIn triggers anywhere on the TextInput but onFocus only triggers on the cases that I could make it work.

My fix is not an ideal one, but I am calling ref.current.focus() for every onPressIn in order to make the whole TextInput clickable

Steps to reproduce
  1. Create a new Android Repository;
  2. Create a Fragment;
  3. Embed React Native into this React Fragment;
  4. Add a TextInput field;
  5. Tap and add a text [ NOT WORKING]
React Native Version

Tested on 0.74.5 and 0.75.3

Affected Platforms

Runtime - Android

Output of npx react-native info
not able to run the command
Stacktrace or Logs
no visible crash
Reproducer

https://github.com/gmantuanrosa/brownfield-rn-fragment/tree/main

Screenshots and Videos

This was not tested on the new architecture

https://github.com/user-attachments/assets/f2dfd3ba-5fec-4bfb-b187-7f4e0bdd3090

贡献指南

打开贡献指南

从这里开始

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

调研方向

从链接的 brownfield-rn-fragment reproducer 开始,在列出的 Samsung 设备上的 Android Fragment 内复现 TextInput 的行为。对比会触发 onPressIn 但不会触发 onFocus 的点击操作与 React Native 0.74.5 和 0.75.3 中正常工作的 Activity/root-view 场景。完成的标准是:整个 TextInput 都能获得焦点并接受文本,而无需从每个 onPressIn 中调用 ref.current.focus()。

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

评估

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

把新 issue 发到你的邮箱

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