react / react/react-native

The TextInput's showSoftInputOnFocus prop is causing unnecessary events to be triggered.

オープン
#45,106 コメント 3 件 リアクション 5 件 担当者 0 名 GitHub で見る

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

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

説明

Description

I'm encountering an issue with the TextInput component in React Native when using the showSoftInputOnFocus prop. When the TextInput gains focus, the keyboard does not open, the keyboardWillShow and keyboardDidShow events are not triggered. However, upon losing focus, the keyboardWillHide and keyboardDidHide events are fired.

This behavior causes problems with Keyboard Aware components that listen for these events.

Steps to reproduce
  1. Create a new React Native project.
  2. Add a TextInput component with the showSoftInputOnFocus prop set to false.
  3. Add event listeners for keyboardWillShow, keyboardDidShow, keyboardWillHide, and keyboardDidHide events.
  4. Focus on the TextInput and observe that keyboardWillShow and keyboardDidShow events are not triggered.
  5. Blur the TextInput and observe that keyboardWillHide and keyboardDidHide events are triggered.
React Native Version

0.72.9

Affected Platforms

Runtime - iOS

Output of npx react-native info
System:
  OS: macOS 14.2.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 140.09 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 18.18.2
    path: ~/miniconda3/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 9.8.1
    path: ~/miniconda3/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.13.0
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "32"
      - "33"
      - "33"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.2
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9619390
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2.1
    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.72.9
    wanted: 0.72.9
  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
There is no crash.
Reproducer

https://snack.expo.dev/@kubatyi.dev/692c3c

Screenshots and Videos

No response

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

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

はじめの一歩

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

調査の方向性

リンクされている Snack の再現コードと、iOS で showSoftInputOnFocus を使用する React Native TextInput のエントリーポイントから始め、focus と blur における keyboardWillShow、keyboardDidShow、keyboardWillHide、keyboardDidHide の挙動を追跡します。キーボードが表示されていない場合に、報告された設定が hide イベントを引き起こさなくなり、そのシナリオがリグレッションチェックで検証されれば完了です。

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

評価

技術スタック
ios, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
38/100

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

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