Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

fireEvent.press does not work on TouchableOpacity #113

Closed
@hsjoberg

Description

@hsjoberg
  • react-native or expo: react-native
  • native-testing-library version: 5.0.3
  • jest-preset: @testing-library/react-native
  • react-native: 0.62.0-rc.3
  • node version: v12.12.0

Relevant code or config:

import React from "react";
import { TouchableOpacity } from "react-native";
import { render, fireEvent } from "@testing-library/react-native";

it("test", async () => {
  const { findByTestId } = render(
    <TouchableOpacity testID="button" onPress={() => console.log("TEST")} />
  );
  const button = await findByTestId("button");
  fireEvent.press(button);
});

What you did:

In 0.62.0-rc.3, fireEvent.press does not seem to work at all on TouchableOpacity. Trying on for example a Button seems to work fine, just not TouchableOpacity (and presumably similar components).

Reproduction:

See example code above. Running it you should see a console logged "TEST" message, in 0.62.0-rc.3, it does not appear.

Can you help us fix this issue by submitting a pull request?

Yes, though I don't know what's wrong yet.

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