Skip to content

Interaction tracking does not work with custom onPress #455

@derekstavis

Description

@derekstavis

Describe what happened

When enabling interaction tracking I'm getting this warning:

An action event was dropped because either the onPress method arguments [true] were undefined or they were missing the target information.

This seems to be happening because of the SDK hijacking the onPress prop to track interactions. As part of that heuristic, it is matching the custom Toggle component, as opposed to the TouchableOpacity component.

Steps to reproduce the issue:

Implement a custom Toggle component like this:

type ToggeProps = {
  onPress: (value: boolean) => void;
  value: boolean;
}

const Toggle = ({ onPress, value }) => {
  const handlePress = () => {
    onPress(!value);
  }
  return <TouchableOpacity onPress={handlePress} />
}

When enabling interaction tracking, this component is failing with the warning above.

Describe what you expected:

The warning should not happen, and interactions should be captured transparently.

Additional context

  • Version of the SDK: 1.3.0
  • Version of React Native: 0.71 (Expo SDK 48, managed workflow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions