Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[iOS 15] Header buttons stop responding after pushing and popping a screen over the pager

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

Start with ios/PagerViewProvider.swift and inspect how setupView() creates the hosting controller; the proposed workaround belongs in a separate PagerViewIOS15NavigationBarCompat.swift file. Reproduce push then pop on an iOS 15 simulator and check whether the navigation bar covers the header buttons. Done means the buttons respond after returning, while iOS 16 and later retain the existing behavior.

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

説明

Environment

  • react-native-pager-view 9.0.4 in the repro app; the relevant code (PagerViewProvider.setupView()) is unchanged in 9.0.9
  • iOS 15.2 simulator (the reporter also reproduced it on a 15.1 device; newer iOS versions are not affected)
  • React Native 0.84.1, New Architecture (Fabric)
  • @react-navigation/{native,stack,bottom-tabs,material-top-tabs} v7, react-native-screens 4.27

Description

On iOS 15, after pushing a screen on top of a screen that contains a PagerView and then going back, the React Navigation header buttons (headerLeft / headerRight) stop responding. They never fire again for that screen.

The cause is not React Navigation. On iOS 15 UIHostingController installs SwiftUI's UIKitNavigationBarBridge, which calls -[UINavigationController setNavigationBarHidden:NO] on the enclosing navigation controller whenever the hosting view appears. react-native-screens creates an RNSContainerNavigationController with a hidden bar for the bottom-tab hasTwoStates container; the bridge re-shows an empty UINavigationBar on top of the screen — exactly over the React Navigation header — and that bar swallows every touch there.

Measured with lldb on an iOS 15.2 simulator after push → pop:

UINavigationBar in the window what hitTest at the header button returns
before present at (0 47; 428 44), hidden = NO _UINavigationBarContentView (not the button)
after the proposed fix none visible the React Native button view

Breakpoint trace of the cause (on -[UINavigationController setNavigationBarHidden:animated:], hidden = NO):

#0  -[UINavigationController setNavigationBarHidden:animated:]
#1  SwiftUI.UIKitNavigationBarBridge.hostingControllerWillAppear(animated:)
#2  SwiftUI._UIHostingView.viewControllerWillAppear(...)
#3  SwiftUI.UIHostingController._viewWillAppear(_:)
...
#16 -[RNSScreenContainerView attachScreen:atIndex:]   ← react-native-screens re-attaches the screen on pop

Reproducible Demo

https://github.com/zewillze/react-native-pager-view-ios15-issue

  1. Run the repro on an iOS 15.x simulator/device.
  2. Tap a list row (pushes Detail inside a @react-navigation/stack).
  3. Go back.
  4. Tap the "Button" or "+" header button — nothing happens.

The screen structure matters: bottom tabs → stack (with a JS header) → material top tabs (the pager). The bottom-tab container provides the hidden UINavigationController, and the pager's UIHostingController is what triggers the bridge when it re-appears.

Optional check without touches, after step 3 — dump the window hierarchy:

po [[[UIApplication sharedApplication] keyWindow] performSelector:@selector(recursiveDescription)]

Before: a UINavigationBar at (0 47; 428 44) with hidden = NO. After the fix: none.

Proposed fix

Wrap the UIHostingController created in ios/PagerViewProvider.swift so it restores the enclosing navigation bar's hidden state around viewWillAppear.

To keep it easy to drop with iOS 15, the workaround lives in its own file (PagerViewIOS15NavigationBarCompat.swift) and every entry point returns early on iOS 16+ via if #available(iOS 16, *). Deleting that file and replacing the single call site with UIHostingController(...) is all that is needed once iOS 15 support is removed — the same isolation pattern used for the iOS 15 scrollEnabled fix (#1148).

The change is 2 files (+68/−1), preserves 9.0.9's ignoreSafeArea: true behaviour, and I have verified it on an iOS 15.2 simulator. I'll open a PR referencing this issue.

主要言語
TypeScript
スター
3.4k
フォーク
485
平均マージ
2日 11時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

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

callstack/react-native-pager-view のほかの issue

callstack/react-native-pager-view の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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