[Fix] searchBar `focus:` true ignored on mergeOptions when searchController already exists

オープン 初心者向け
#8,318 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@IsaacIsrael がすでに取り組んでいます。

2026年6月1日 から。

  • #8319 @IsaacIsrael による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
ios, objective-c, react-native
領域
mobile

調査の方向性

UIViewController+RNNOptions.mm の setSearchBarWithOptions: から開始し、既存の controller のパスと初期作成のパスを比較します。既存の search controller がある画面で mergeOptions のフローを確認し、その後、関連する iOS テストを実行するか、タブ切り替えの手順を再現します。完了条件は、focus: true によって mergeOptions 後に search bar が再びフォーカスされ、初期作成時の動作が変わらないことです。

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

説明

Bug

When calling Navigation.mergeOptions() with topBar.searchBar.focus: true on a screen that already has a search controller, the focus is silently ignored. The search bar only auto-focuses on initial creation (first applyOptions), never on subsequent mergeOptions calls.

Current Behaviour

setSearchBarWithOptions: in UIViewController+RNNOptions.mm only handles focus inside the if (!self.navigationItem.searchController) branch (initial creation). The else branch (existing search controller) skips focus entirely.

Expected Behaviour

mergeOptions with focus: true should refocus the search bar even when the search controller already exists. This is needed for re-focusing the search bar when the screen reappears (e.g., switching back to a bottom tab).

Steps to Reproduce
  1. Register a screen with searchBar: { visible: true, focus: true } in static options
  2. Screen mounts — search bar is focused (correct)
  3. Navigate away from the screen (e.g., switch tabs)
  4. Navigate back and call Navigation.mergeOptions(componentId, { topBar: { searchBar: { visible: true, focus: true } } })
  5. Search bar is not focused
Proposed Fix

Add focus handling in the else branch of setSearchBarWithOptions::

} else {
    // ... existing iOS 26 placement code ...

    if (focus) {
        dispatch_async(dispatch_get_main_queue(), ^{
          self.navigationItem.searchController.active = true;
          [self.navigationItem.searchController.searchBar becomeFirstResponder];
        });
    }
}
Environment
  • react-native-navigation: 8.8.2
  • React Native: 0.85.3
  • iOS 18+
主要言語
MDX
スター
13.2k
フォーク
2.6k
平均マージ
2日 10時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

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

wix/react-native-navigation のほかの issue

wix/react-native-navigation の issue をすべて見る

似ている issue

Mobile Dev の issue をもっと見る

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

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