Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[iOS] Stack overflow in _UIHostingView._hitTest with keyboard open on a page (8.0.2 and 9.0.4, New Architecture)

Aperta
#1,144 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
ios, react-native, swift
Ambito
mobile

Direzione di ricerca

Inizia riproducendo la sequenza fornita di PagerView e tastiera su un dispositivo iOS fisico interessato, quindi esamina il trace di hit-test di Sentry. Confronta il percorso di hosting di SwiftUI con il pager basato su ScrollView e rivedi RNGestureHandlerButton.mm alle righe 75, 121 e 270. Il lavoro è completato quando è stato stabilito se il livello di hosting v8/v9 causa la ricorsione e viene documentato un fix o una mitigazione testata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

On iOS the app crashes with EXC_BAD_ACCESS / stack overflow inside _UIHostingView._hitTest while a page of PagerView has the software keyboard open (or has just dismissed it). The main thread shows ~70 consecutive _UIHostingView._hitTest frames (the trace is trimmed to 100 frames, so the real depth is larger) before it reaches the React Native hit-test path and runs out of stack.

It happens with 8.0.2 and with 9.0.4 (same stack), so none of the 8.0.3–9.0.4 changes (page wrapper as UIViewControllerRepresentable, ignoresSafeArea, hosting-controller reparenting in 9.0.2, setPage fix in 9.0.4) address it. 6.x (UIKit UIPageViewController) never crashed here.

Over the last 30 days: 27 crashes from 17 distinct users, roughly every fourth user who reached that page. Users relaunch and crash again on the same page (up to 3 times in 3 minutes). Not reproducible in the simulator so far, only on devices.

Environment

  • react-native-pager-view 9.0.4 (also 8.0.2), Expo SDK 57, React Native 0.86.2, React 19.2.3, New Architecture (Fabric) enabled, Hermes
  • react-native-gesture-handler 2.32.x (buttons come from pressto's PressableScale), react-native-keyboard-controller 1.21.9, react-native-screens 4.26, react-native-reanimated 4.5.1, react-native-safe-area-context 5.7
  • iOS deployment target 16.4; crashes seen on iOS 26.1 – 26.6.1 (24 events) and iOS 18.7.7 / 18.7.8 (3 events)
  • Devices: iPhone 14 Pro … iPhone 18 (iPhone14,2, 15,2, 15,3, 16,1, 16,2, 17,2, 17,3, 18,1, 18,2), iPad15,3 and iPad15,7 running the iPhone build
  • App Store builds, production, breadcrumbs show RNSScreen → UIHostingController<PagerView> → IntrospectionAnchorPlatformViewController / IntrospectionPlatformViewController

Setup that crashes

  • PagerView with scrollEnabled={false} (pages are switched only via ref.setPage), 14 pages, all mounted (onboarding flow inside a react-native-screens native stack).
  • One page contains a TextInput with autoFocus inside KeyboardAwareScrollView from react-native-keyboard-controller, plus a few RNGH-backed buttons (pressto → RNGestureHandlerButton).
  • Sequence from breadcrumbs: page appears → keyboard shows (UIKeyboardDidShowNotification) → user types → taps a button → keyboard hides → taps the primary button → crash ~2 s later. Other events crash while the keyboard is still up.

Crash (thread 0, from Sentry, oldest frame first)

_UIHostingView._hitTest            ← repeated ~70 times (trimmed)
…
_UIHostingView._hitTest
ViewResponder.hitTest
ViewResponder.hitTest
MultiViewResponder.containsGlobalPoints
UIViewResponder.containsGlobalPoints
PlatformViewResponderBase.containsGlobalPoints
UIViewResponder.platformViewHitTest
-[UIView(Geometry) hitTest:withEvent:]
-[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:]
__38-[UIView hitTest:withEvent:]_block_invoke
-[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:]
-[UIView(Geometry) hitTest:withEvent:]
-[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:]
__38-[UIView hitTest:withEvent:]_block_invoke
-[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:]
-[RCTViewComponentView hitTest:withEvent:]
-[RCTViewComponentView betterHitTest:withEvent:]
-[RCTViewComponentView hitTest:withEvent:]
-[RCTViewComponentView betterHitTest:withEvent:]
-[RNGestureHandlerButtonComponentView hitTest:withEvent:] (RNGestureHandlerButtonComponentView.mm:270)
-[RNGestureHandlerButton hitTest:withEvent:] (RNGestureHandlerButton.mm:121)
-[RNGestureHandlerButton shouldHandleTouch:] (RNGestureHandlerButton.mm:75)
+[NSPredicate predicateWithFormat:]
+[NSPredicate predicateWithFormat:arguments:]
_qfqp2_performParsing
_qfqp2lex
strdup                              ← EXC_BAD_ACCESS, "Stack overflow in (null)"

Sentry title: EXC_BAD_ACCESS: isEnabled > Stack overflow in (null), mechanism mach, handled: no. Older 8.0.2 events (same stack) were symbolicated to facebook::react::concreteComponentDescriptorConstructor<T> as culprit, which is just where the stack ran out.

What we tried

  • 8.0.2 → 9.0.4: no change.
  • Replacing PagerView with a plain ScrollView-based pager (pagingEnabled, scrollEnabled={false}, scrollTo) removes the crash entirely, which points at the SwiftUI hosting layer rather than at our page content.

Question

Is the SwiftUI TabView/hosting-view hit-test recursion with the keyboard open a known issue for v8/v9? Happy to provide full Sentry events (all threads) or test a build with extra logging on the affected devices.

Lingua principale
TypeScript
Stelle
3.4k
Fork
485
Merge medio
2g 12h
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstack/react-native-pager-view

Tutte le issue di callstack/react-native-pager-view

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.