[iOS] UIKit's scroll to a focused field can leave the pager between pages
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- ios, react-native, typescript
調査の方向性
Start with the example app screen “Issue #1154 Page Change Focus Repro” and set styles.events to height: 44 to reproduce the timing. Trace the iOS pager handling of interrupted setPage calls alongside the focus and keyboard events, then run the described release-build sequence. Done means the pager settles on page 2, reports matching selection and scroll state, and the focused input and keyboard behave consistently.
索引モデルが issue の本文から書いたものです。
説明
Environment
react-native-pager-view:main- React Native 0.88.0, new architecture
- iPhone 18 Pro simulator, iOS 27.0, release build
Description
When a text field on another page takes focus, UIKit scrolls the pager's collection view to reveal it: scrollRectToVisible, twice and animated, once while the field becomes first responder and once from the keyboard notification. That scroll replaces the slide TabView is running and stops at the smallest offset that shows the field, and UIKit leaves the pager there.
The selection and the screen then disagree. onPageSelected reports page 2 while the pager rests nearest page 1, the log reads selected 2 and then state idle at 1, and the screen shows a sliver of page 0 beside page 1. Because the pager is not on a page boundary nothing reports a rest, so the input on the page being left keeps focus with the keyboard open.
Measuring the collection view's offset at scrollViewDidEndScrollingAnimation, against a 402 pt page:
| run | end offset |
|---|---|
| interrupt, with the arriving page's input focused in the same handler | 377 |
| interrupt, no focus | 804 |
| interrupt, keyboard already open from the previous page | 804 |
focus on arrival, single setPage, no interrupt |
402 |
Both ingredients are needed, and 377 is not arbitrary: it is the least the pager can scroll to bring that field on screen.
A per-instance override is viable, since PagerGestureObserver.installGestureArbitration already gives the pager's collection view its own runtime subclass. It is a behaviour change: an app that focuses an input on a page it is not showing would see nothing move, where today the pager is dragged between pages instead. An enclosing scroll view is unaffected, since in a pager inside a ScrollView inside a KeyboardAvoidingView the pager receives no reveal at all in 6 of 6 runs, and every one goes to the outer scroll view and the field's own editor.
Reproducible Demo
The example app has the screen already: Issue #1154 Page Change Focus Repro. Its event log reflows as it grows, which shifts the timing, so give the events box a fixed height first (height: 44 on styles.events) to see this reliably.
- Open the screen in a release build
- Tap onPress, so the arriving page's input is focused in the same handler as the command
- Tap the input on page 0, so the keyboard opens
- Tap Go 1 then 2, which sends
setPage(1)and thensetPage(2)fromonPageSelected - The pager stops between pages and stays there. The status line reads
Selected: 2, the log endsstate idle at 1, and the input on page 1 is still focused with the keyboard open
With that fixed height, two runs in six end this way on main. Without it the screen's own timing hides it most of the time, though the same case failed CI on #1224 with Selected: 1 | Focused: input 1 | Keyboard: visible | Scrolls: 9.
A fix is open as #1234, which declines the reveal from iOS 16 rather than repairing the landing after it.
- 主要言語
- TypeScript
- スター
- 3.4k
- フォーク
- 491
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 51
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstack/react-native-pager-view のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
callstack/react-native-pager-view#1232 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[iOS] setPage does not animate when the pager resizes with the keyboard対応中かも @TaduJR が 4 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
callstack/react-native-pager-view#1223 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Resolution: Needs Repro
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
callstack/react-native-pager-view#1222 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
callstack/react-native-pager-view#1189 ·
メンテナーはふだん 1 日以内に返信
-
iOS: PagerScrollDelegate proxies to itself and overflows the stack when the weak originalDelegate dies対応中かも @lvlrSajjad が 56 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
callstack/react-native-pager-view#1146 ·
メンテナーはふだん 1 日以内に返信
callstack/react-native-pager-view の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
earendil-works/pi-claude-code#36 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
Resources: New work of jabodetabek対応中かも @rmt-svc が今日担当しました。 オープンresources
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
railmapgen/rmp-gallery#4167 ·
メンテナーはふだん 2 日以内に返信
-
documentation p1
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
microsoft/monaco-editor#5577 ·
メンテナーはふだん 1 日以内に返信