Skip to content

React [email protected]使用TextInput输入中文时的bug #52552

Open
@manongqiyin

Description

@manongqiyin

Description

TextInput在输入中文时会有两个问题:
1、绑定value时,无法通过中文拼音输入中文
2、设置maxLength时,中文拼音没打完(没有输出中文)时,拼音也会算作字符。

Steps to reproduce

1、绑定value时,无法通过中文拼音输入中文
代码如下:
const [customTitle,onchangeCustomTitle,setCustomTitle] = useState('');

此时并不能通过苹果自带的输入法输入中文,详情请见视频:

2025-07-11.16.57.25.mov

2、取消绑定value,这时候时能输入中文的,设置maxLength时,中文拼音没打完(没有输出中文)时,拼音也会算作字符。
代码如下:
const [customTitle,onchangeCustomTitle,setCustomTitle] = useState('');

此时中文没达到maxlength数量的时候,就无法输入拼音了,详情请见视频:

2025-07-11.17.01.39.mov

在视频中,最后输入了一个中文拼音b,事实上还没有输出中文字符,但是已经无法输入了

React Native Version

0.80.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.5
  CPU: (8) arm64 Apple M1
  Memory: 127.05 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.8
    path: ~/.nvm/versions/node/v18.20.8/bin/node
  Yarn:
    version: 1.22.11
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v18.20.8/bin/npm
  Watchman:
    version: 2025.05.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK:
    API Levels:
      - "28"
      - "31"
      - "32"
      - "33"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 32.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-31 | Intel x86 Atom_64
      - android-32 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2020.3 AI-203.7717.56.2031.7935034
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 17
    path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.4.4
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.1.0
    wanted: ^19.1.0
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

none,并未有报错信息

MANDATORY Reproducer

https://github.com/manongqiyin/react-native0.80.0TextInput-Error/blob/main/index.tsx

Screenshots and Videos

2025-07-11.16.57.25.mov
2025-07-11.17.01.39.mov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions