Uncontrolled input value clears when color is changed
オープン
まだ誰も着手していません。
Issue: Author Provided Repro
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
Description
Setting color in style prop for an uncontrolled input based on focus clears the TextInput's value.
example:
...
<TextInput
onBlur={onBlur}
onFocus={onFocus}
placeholder={placeholder}
style={[
{
color: isFocused ? "#f00" : "#000",
},
]}
/>
...
isFocused is set based on onBlur and onFocus.
This same issue is not noticed for a controlled input. I have also linked a repro link with both cases side by side.
Affected platform: Android
Steps to reproduce
- Run the application with
npx react-native run-android - Interact with controlled input (notice normal behaviour)
- Interact with uncontrolled input, notice value of input disappearing when you blur the focus
React Native Version
0.73.5
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 179.17 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.19.1
path: ~/.nvm/versions/node/v18.19.1/bin/node
Yarn:
version: 1.22.21
path: ~/.bun/bin/yarn
npm:
version: 10.2.4
path: ~/.nvm/versions/node/v18.19.1/bin/npm
Watchman:
version: 2023.12.04.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 15.1/15C65
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.5
wanted: 0.73.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
N/A
Reproducer
https://github.com/BalogunofAfrica/react-native-textinput-bug
Screenshots and Videos
https://github.com/facebook/react-native/assets/45393944/91a05b3e-06c1-4ca5-ac39-74d0da2522d7
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた再現コードから始め、React Native 0.73.5 上で npx react-native run-android を実行してください。フォーカスに基づく色を変更しながら、制御された TextInput と非制御の TextInput のケースを比較します。完了条件は、非制御の入力が blur 後もその値を保持し、制御されたケースに影響がないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- react-native
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100