Closed tyrauber closed 2 weeks ago
@tyrauber thanks for raising this issue.
I think it might be because of https://github.com/PostHog/posthog-js-lite/blob/b853833c126ba713eb25696c96a3f0a6193ea2f0/posthog-react-native/src/autocapture.tsx#L48
Since you set a custom customLabelProp
, this label prop isn't added to propsToCapture
, if you do:
customLabelProp = 'phLabel',
propsToCapture = ['style', 'testID', 'accessibilityLabel', 'phLabel', 'children'],
Maybe that should work, can you give it a try? if that's the case, I can either fix the SDK or the docs.
I think this should help.
Thanks @marandaneto, I didn't realize propsToCapture
needed to be used in combination with customLabelProp
. Based on the documentation, it looked like propsToCapture
was something I didn't want to mess with.
propsToCapture: ["testID"], // Limit which props are captured. By default, identifiers and text content are captured.
I didn't want to disable any default functionality, I just wanted to change the label used. More details on how propsToCapture works in the documentation might suffice as a solution.
@tyrauber I fixed the SDK instead, you should not need to mess with propsToCapture
anymore.
https://github.com/PostHog/posthog-js-lite/releases/tag/posthog-react-native-v3.3.10
Bug description
Perhaps I am missing something, but my expectation is that
customLabelProp
would allow me to change the PostHog ph-label prop to anything of my choosing. For example, I'd like to change it to be camelcasephLabel
to make it easier to pass as a prop to components.Unfortunately, doing so makes the label values no longer be applied to touch events, even after app rebuild.
I get the default label names instead like
pressed Text with text "Show more"
Code looks fine at first glance, so I am not entirely sure what's going on there.
How to reproduce
customLabelProp
to "phLabel"Related sub-libraries
Additional context
Thank you for your bug report – we love squashing them!