Skip to content

fireEvent not working for "responderMove" #576

Closed
@abmantis

Description

@abmantis

Describe the bug

After updating to v7, calling fireEvent for "responderMove" stopped working. This is due to the new checks to see if a component is "disabled". Since RNTL only checks for onStartShouldSetResponder(), a component that uses onMoveShouldSetResponder() but not onStartShouldSetResponder(), will always be considered to be "disabled" by RNTL.

For testing, I replaced onStartShouldSetResponder with onMoveShouldSetResponder on the following and it solves the issue:

return touchResponder?.props.onStartShouldSetResponder?.() !== false;

Expected behavior

The following would work:

  fireEvent(container, 'responderMove', {
    touchHistory: { mostRecentTimeStamp: '2', touchBank: [] },
  });

Steps to Reproduce

Screenshots

Versions

npmPackages:
@testing-library/react-native: ^7.0.2 => 7.0.2
react: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2
react-test-renderer: ^16.11.0 => 16.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions