Skip to content

Conversation

@kmichalikk
Copy link
Collaborator

Description

(Duplicated in code comment)

iOS 26 introduces new gesture recognizer which replaces our RNSPanGestureRecognizer. The problem is that we are not able to handle it here for various reasons:

  • the new recognizer comes with its own delegate and our current approach is to wire all recognizers to RNSScreenStackView; to be 100% sure we don't break the logic, we would have to decorate its delegate and call it after our code, which would break other recognizers that the stack view is the delegate for
  • when RNSScreenStackView.setupGestureHandler method is called, the recognizer hasn't been loaded yet and there is no other place to configure in a not "hacky" way
  • the official docs warn us to not use it for anything other than "setting up failure requirements with it"
  • we expose fullScreenGestureEnabled prop to enable/disable the feature, so we need control over the delegate

This doesn't prevent from swiping when dismissing with back button is in progress and when fullScreenSwipe is enabled, things still can break. This will be fixed in another PR.

Testing

Use Test3093. Observe no full screen swiping or any unexpected behavior on iOS 26 when the prop is not enabled.

Copy link
Contributor

@t0maboro t0maboro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with that at the moment, but I'd propose to create and link a followup task for further investigation if there's a chance to completely replace our gesture recognizer now.

Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us not forget about doing it right

@kmichalikk kmichalikk merged commit ccf143b into main Aug 19, 2025
6 checks passed
@kmichalikk kmichalikk deleted the @kmichalikk/interactive-content-pop-gesture-disable branch August 19, 2025 05:18
kmichalikk added a commit that referenced this pull request Aug 19, 2025
…in progress (#3142)

## Description

This is a followup to #3093 and #3141. We now handle repeatedly clicking
back button on iOS 26, and disable
interactiveContentPopGestureRecognizer which triggers without
fullScreenGesture prop enabled, but it still is possible to click back
button and swipe when fullScreenGesture is enabled. One possible
solution is to check if transitionCoordinator is set and abort handling
the gesture if it is.

## Changes

Added check for transitionCoordinator == nil before allowing for gesture
to be received.

## Test code and steps to reproduce

Use Test3093.
kmichalikk added a commit that referenced this pull request Sep 23, 2025
## Description

Resolves
software-mansion/react-native-screens-labs#369,
might resolve
#3161,
reverts
#3141,
#3142

This PR attempts to enable interactiveContentPopGestureRecognizer for
iOS 26 to achieve native screen popping behavior. Until 26, the default
was to swipe from the edge of the screen. We had the option to do
fullscreen switch, which was controlled by a `fullScreenSwipeEnabled`
prop. Since the default behavior has changed, this prop, along with
`gestureResponseDistance`, is being ignored from now on.

New iOS allows for popping multiple screens almost at once, which we
still cannot support due to asynchronous nature of stack updates coming
from host to JS that would create a "feedback loop" in situation like
the following: host pops 1. screen + sends update, pops 2. screen +
sends update -> JS acknowledges 1. update + sends updated state -> host
gets 2. screen from JS and pushes it again. This PR attempts to block
more than 1 pop at once by removing interactions from the whole screen.
As a (desired) side effect, this also disables interactions on the
screen below the one that is popped until the transition finishes.

## Changes

- removed `RNSPanGestureRecognizer` from iOS 26 build and replace it
with native `interactiveContentPopGestureRecognizer`
- disabled all interactions when screens are in transition
- updated docs

## Test code and steps to reproduce

Use Test3173 to test swipe and interactions on bare screens API &
compare with any other test that uses react-navigation stack, i.e
Test3093. Use Test3093 with additional screenOptions:
```ts
{
        animation: 'slide_from_bottom',
        animationMatchesGesture: true,
}
```
to test custom animations on swipe back.

---------

Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>
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.

4 participants