Skip to content

Mocks: fix button content missing#4048

Merged
m-bert merged 5 commits intosoftware-mansion:v2-stablefrom
alpha0010:patch-2
Apr 2, 2026
Merged

Mocks: fix button content missing#4048
m-bert merged 5 commits intosoftware-mansion:v2-stablefrom
alpha0010:patch-2

Conversation

@alpha0010
Copy link
Copy Markdown
Contributor

Description

Lacking button content in the provided mocks makes it impossible to write tests such as "is the button with 'foo' rendered" or "press the button with 'bar'".

Test plan

import {fireEvent, render} from '@testing-library/react-native';
import {Text} from 'react-native';
import {RectButton} from 'react-native-gesture-handler';

test('Trigger press by text', () => {
  const onPress = jest.fn();
  const {getByText} = render(
    <RectButton onPress={onPress}>
      <Text>Press Me</Text>
    </RectButton>,
  );

  fireEvent.press(getByText('Press Me'));

  expect(onPress).toHaveBeenCalled();
});

actions-user and others added 4 commits December 19, 2025 16:47
…#4039)

## Description

Current logic dedicated to handling `RNRootViewGestureRecognizer` on iOS
looks only for RN's native roots. When gestures are used inside Screens'
`FullWindowOverlay`, the logic doesn't do anything, but the overlay has
its own
[`RCTSurfaceTouchHandler`](https://github.com/software-mansion/react-native-screens/blob/be64b6d9a17c3a4647806f252e075b96b9f690cc/ios/RNSFullWindowOverlay.mm#L158).

This PR updates the traversal logic so it handles
`RNSFullWindowOverlayContainer` the same way as `RCTSurfaceView`.

## Test plan

I wasn't able to reproduce the problem, but in theory, it's possible
that without this change, recognizers from RNGH and
RCTSurfaceTouchHandler could run simultaneously, since this path never
ran:
https://github.com/software-mansion/react-native-gesture-handler/blob/5587435679eabe3f8690f077ba7c2ecc3e354a14/packages/react-native-gesture-handler/apple/RNRootViewGestureRecognizer.m#L55-L63
This makes it impossible for tests to target a button based on displayed elements.
Copy link
Copy Markdown
Contributor

@m-bert m-bert left a comment

Choose a reason for hiding this comment

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

Thank you for this PR ❤️

Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
@m-bert m-bert changed the base branch from 2.30-stable to v2-stable April 2, 2026 07:21
Copy link
Copy Markdown
Contributor

@m-bert m-bert left a comment

Choose a reason for hiding this comment

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

Thank you!

@m-bert m-bert merged commit 686e015 into software-mansion:v2-stable Apr 2, 2026
1 check passed
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