TrackedTouchableNativeFeedback
Wraps TouchableNativeFeedback in a PressableContext and automatically tracks PressEvent for it.
TrackedTouchableNativeFeedback: (props: TouchableNativeFeedbackProps & {
id?: string,
}) => TouchableNativeFeedback
Additional Props
type | default value | ||
---|---|---|---|
optional | id | string | inferred from children |
info
In development mode, TrackedTouchableNativeFeedback will log an error to the console when failing to infer an identifier from children
.
Automatic Events
- PressEvent when
onPress
triggers.
Usage examples
A regular TouchableNativeFeedback
import { TrackedTouchableNativeFeedback } from '@objectiv/tracker-react-native';
<TrackedTouchableNativeFeedback
onPress={onPressFunction}
>
<View>
<Text>Press me!</Text>
</View>
</TrackedTouchableNativeFeedback>
Non parseable children
import { TrackedTouchableNativeFeedback } from '@objectiv/tracker-react-native';
<TrackedTouchableNativeFeedback
onPress={onPressFunction}
id="thumb-down"
>
<View>
<Text>👎</Text>
</View>
</TrackedTouchableNativeFeedback>
Custom identifier
import { TrackedTouchableNativeFeedback } from '@objectiv/tracker-react-native';
<TrackedTouchableNativeFeedback
onPress={onPressFunction}
id="custom-analytics-id"
>
<View>
<Text>Press me!</Text>
</View>
</TrackedTouchableNativeFeedback>
Did you know ?
TrackedTouchableNativeFeedback
internally uses PressableContextWrapper.