Skip to content

fix(ios): block screen touches while header UIMenu is open#4193

Open
jasleenkaur-qed42 wants to merge 1 commit into
software-mansion:mainfrom
Jasleen-Kaur96:fix/ios-header-menu-touch-blocking
Open

fix(ios): block screen touches while header UIMenu is open#4193
jasleenkaur-qed42 wants to merge 1 commit into
software-mansion:mainfrom
Jasleen-Kaur96:fix/ios-header-menu-touch-blocking

Conversation

@jasleenkaur-qed42

Copy link
Copy Markdown

Summary

Problem

On iOS, when using unstable_headerRightItems with type: 'menu', taps on screen content (e.g. Pressable) still fired while the menu was open. Native apps block those touches.

Solution

  • RNSBarButtonItem: wrap menu children in UIDeferredMenuElement and invoke a menuPresented callback before the menu appears (dispatched on main queue)
  • RNSScreenStackHeaderConfig: wire callback to RNSScreenStackView
  • RNSScreenStack: while menu is open, disable top screen content interaction and install a one-shot gesture recognizer to intercept outside-dismiss taps before Fabric's touch handler

Test plan

  • Run repro: https://github.com/ferrannp/menu-header-screens (or local rn-screens-menu-repro)
  • Open header menu (⋯)
  • While menu is open, tap Increment counter → should not increment
  • Dismiss menu by tapping outside → tap Increment counter → should increment
  • Dismiss menu by selecting an item → screen touches work again
  • Verify left header button and back navigation still work

When a native stack header menu is presented, taps outside the menu were
reaching RN Pressables underneath. Hook menu presentation via a deferred
menu element, disable content interaction on the stack, and restore it on
dismiss or item selection.

Fixes software-mansion#4139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Header menu should block presses from reaching screen content

1 participant