microsoft / clarity-apps

Repo for distributing Clarity Apps packages
MIT License
37 stars 2 forks source link

React Native - Resetting current screen name #21

Closed StijnCoolen closed 6 months ago

StijnCoolen commented 7 months ago

The setCurrentScreenName docs state "You can it set to null to remove the latest set value." The type however expects a String.

maryamshal commented 7 months ago

Hello @StijnCoolen, Thank you for bringing this to our attention. A fix for this will be rolled out with the next release, for the time being you can set the screen name to "" to remove the latest value and get the same effect.

StijnCoolen commented 7 months ago

Hi @maryamshal that's great! Another thing I found while implementing this was that the Clarity docs suggest using the cleanup function of useCallback to reset the screen. React Navigation however advices against this and instead use the 'blur' event: https://reactnavigation.org/docs/7.x/use-focus-effect/#when-to-use-focus-and-blur-events-instead

Does this make any difference for Clarity?

SaadeldinBadr commented 7 months ago

Hello @StijnCoolen, No, this won't make any difference for Clarity, you can reset it in the cleanup function or in the blur event.

it's worth noting that you can use the way mentioned here https://github.com/microsoft/clarity-apps/issues/23#issuecomment-1837501594 to set the current screen name and not bother to reset it.