Skip to content

Inconsistency between local and UIKit touch registries #53303

Description

@mvrty

Description

When using a ScrollView inside a formSheet modal on iOS (react-navigation, react-native-screens), when dragging to dismiss the modal, (sometimes) the app crashes with *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Inconsistency between local and UIKit touch registries'.

(Might be issue in react-navigation/rn-screens but posting here since it's react-native/React/Fabric/RCTSurfaceTouchHandler.mm:206 that crashes it.)

Note: I can only re-produce this with latest xcode beta and iOS 26 - can't reproduce on iOS 18.

Steps to reproduce

Run the reproducer, open the modal, scroll to close (when scrollview has been scrolled) - in some situations it will crash.

React Native Version

0.81.0

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.5
  CPU: (16) arm64 Apple M4 Max
  Memory: 100.09 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.12.0
    path: ~/.nvm/versions/node/v22.12.0/bin/node
  Yarn:
    version: 4.9.2
    path: ~/.nvm/versions/node/v22.12.0/bin/yarn
  npm:
    version: 10.9.0
    path: ~/.nvm/versions/node/v22.12.0/bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/mn/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-35 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
      - android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2024.3 AI-243.26053.27.2432.13536105
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.4.1
    path: /Users/mn/.sdkman/candidates/java/current/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/mn/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.0
    wanted: 0.81.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

*** Assertion failure in -[RCTSurfaceTouchHandler _updateTouches:](), /Users/mn/Code/Play/rctSurfaceTh/node_modules/react-native/React/Fabric/RCTSurfaceTouchHandler.mm:206
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Inconsistency between local and UIKit touch registries'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804f39e8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018009c084 objc_exception_throw + 72
	2   Foundation                          0x000000018100dd38 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
	3   rctSurfaceTh.debug.dylib            0x000000010452ff48 -[RCTSurfaceTouchHandler _updateTouches:] + 528
	4   rctSurfaceTh.debug.dylib            0x00000001045327b0 -[RCTSurfaceTouchHandler touchesCancelled:withEvent:] + 124
	5   UIKitCore                           0x0000000185d08a6c -[UIGestureRecognizer _componentsCancelled:withEvent:] + 348
	6   UIKitCore                           0x00000001862c8ad4 -[UIEvent _removeGestureRecognizersSendingCancelledEvent:] + 624
	7   UIKitCore                           0x0000000185d0f888 -[UIGestureRecognizer gestureNode:didUpdatePhase:] + 240
	8   Gestures                            0x000000022ece15f8 GFGestureNodeDefaultValue + 4468
	9   Gestures                            0x000000022ecfe7a4 _swift_stdlib_malloc_size + 26208
	10  Gestures                            0x000000022ed28ff8 __swift_memcpy24_8 + 20672
	11  Gestures                            0x000000022ed50858 GFGestureNodeCoordinatorCreate + 2148
	12  UIKitCore                           0x0000000185cfc828 -[UIGestureEnvironment _updateForEvent:window:] + 468
	13  UIKitCore                           0x000000018625ce44 -[UIWindow sendEvent:] + 2796
	14  UIKitCore                           0x000000018623b280 -[UIApplication sendEvent:] + 376
	15  UIKitCore                           0x00000001862cf540 __dispatchPreprocessedEventFromEventQueue + 1184
	16  UIKitCore                           0x00000001862d21f4 __processEventQueue + 4800
	17  UIKitCore                           0x00000001862ca7a0 updateCycleEntry + 168
	18  UIKitCore                           0x000000018573a6b4 _UIUpdateSequenceRunNext + 120
	19  UIKitCore                           0x000000018614131c schedulerStepScheduledMainSectionContinue + 56
	20  UpdateCycle                         0x00000002513e92b4 _ZN2UC10DriverCore18continueProcessingEv + 80
	21  CoreFoundation                      0x00000001804114ac __CFMachPortPerform + 164
	22  CoreFoundation                      0x000000018044dbe0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
	23  CoreFoundation                      0x000000018044d1f8 __CFRunLoopDoSource1 + 480
	24  CoreFoundation                      0x000000018044c2c0 __CFRunLoopRun + 2100
	25  CoreFoundation                      0x0000000180446e24 _CFRunLoopRunSpecificWithOptions + 496
	26  GraphicsServices                    0x00000001924c19bc GSEventRunModal + 116
	27  UIKitCore                           0x00000001862217a8 -[UIApplication _run] + 772
	28  UIKitCore                           0x00000001862259d0 UIApplicationMain + 124
	29  UIKitCore                           0x00000001854ab528 block_destroy_helper.15 + 5120
	30  rctSurfaceTh.debug.dylib            0x0000000103e3f1a4 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 128
	31  rctSurfaceTh.debug.dylib            0x0000000103e3f114 $s12rctSurfaceTh11AppDelegateC5$mainyyFZ + 44
	32  rctSurfaceTh.debug.dylib            0x0000000103e3fa40 __debug_main_executable_dylib_entry_point + 28
	33  dyld                                0x00000001008653d0 start_sim + 20
	34  ???                                 0x0000000100a56b98 0x0 + 4305808280
)
libc++abi: terminating due to uncaught exception of type NSException
terminating due to uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Inconsistency between local and UIKit touch registries'
CoreSimulator 1047 - Device: iPhone 16 Pro (E2B61D7F-69C6-42CC-B992-67B71E6443FB) - Runtime: iOS 26.0 (23A5308g) - DeviceType: iPhone 16 Pro

MANDATORY Reproducer

https://github.com/mvrty/rct-surface-touch-handler-issue

Screenshots and Videos

rctoutput.mov

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: Version InfoType: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions