TrackedTouchableHighlight

Wraps TouchableHighlight in a PressableContext and automatically tracks PressEvent for it.

TrackedTouchableHighlight: (props: TouchableHighlightProps & {
id?: string,
}) => TouchableHighlight

Additional Props

typedefault value
optionalidstringinferred from children
info

In development mode, TrackedTouchableHighlight will log an error to the console when failing to infer an identifier from children.

Automatic Events

Usage examples

A regular TouchableHighlight

import { TrackedTouchableHighlight } from '@objectiv/tracker-react-native';

<TrackedTouchableHighlight
onPress={onPressFunction}
>
<Text>Press me!</Text>
</TrackedTouchableHighlight>

Non parseable children

import { TrackedTouchableHighlight } from '@objectiv/tracker-react-native';

<TrackedTouchableHighlight
onPress={onPressFunction}
id="thumb-down"
>
<Text>👎</Text>
</TrackedTouchableHighlight>

Custom identifier

import { TrackedTouchableHighlight } from '@objectiv/tracker-react-native';

<TrackedTouchableHighlight
onPress={onPressFunction}
id="custom-analytics-id"
>
Press me!
</TrackedTouchableHighlight>

Did you know ?

TrackedTouchableHighlight internally uses PressableContextWrapper.