react / react/react-native

TextInput briefly displays restricted characters before validation removes them when using onChangeText

オープン
#47,252 コメント 13 件 リアクション 6 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Component: TextInput Issue: Author Provided Repro Needs: Attention
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

Hi there,
Just wanted to bring up an issue that many of us have come across. When using TextInput with validation in onChangeText, restricted text still flashes for a moment before it gets removed. This is a pretty common need in apps, where real-time validation is used to guide user input (like blocking specific characters or setting a format). But right now, seeing those restricted characters pop up briefly makes the input feel a bit off.
There are many Workarounds and hacks for this but don’t quite fix the experience entirely. Is there any chance this could be smoothed out natively in the future?

Steps to reproduce

Screenshot 2024-10-28 at 18 10 02

React Native Version

0.76.0

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info
Not needed
Stacktrace or Logs
Not needed
Reproducer

https://snack.expo.dev/fVO2DXQPPqQVlm9QBZ2ms

Screenshots and Videos

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた Snack 再現コードから始め、React Native 0.76.0 を使用して Android と iOS の両方でちらつきを確認します。次に、onChangeText に対する TextInput の処理を特定し、バリデーションの更新がネイティブのテキストフィールドにどのように反映されるかを追跡します。影響を受けるプラットフォームで、制限された文字がバリデーションによって削除される前に一瞬表示されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。