[Fix] searchBar `focus:` true ignored on mergeOptions when searchController already exists
評価
- 難易度
- 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
- Register a screen with
searchBar: { visible: true, focus: true }in static options - Screen mounts — search bar is focused (correct)
- Navigate away from the screen (e.g., switch tabs)
- Navigate back and call
Navigation.mergeOptions(componentId, { topBar: { searchBar: { visible: true, focus: true } } }) - 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wix/react-native-navigation のほかの issue
-
needs triage triage: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
wix/react-native-navigation#8343 · コメント 1 件 ·
-
needs triage type: accepted/bug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
wix/react-native-navigation#8365 · コメント 2 件 ·
-
`showOverlay` creates a scene-less `UIWindow`, so overlays never appear under UIScene lifecycle対応中かも @yedidyak が 3 日前に担当しました。 オープンplatform: iOS type: accepted/bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
wix/react-native-navigation#8345 · コメント 2 件 · リアクション 2 件 ·
-
platform: iOS type: accepted/bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
wix/react-native-navigation#8340 ·
-
platform: iOS type: accepted/bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
wix/react-native-navigation#8339 ·
wix/react-native-navigation の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MaikuB/flutter_local_notifications#2866 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
appandflow/stim#5258 ·
メンテナーはふだん 1 日以内に返信