diff --git a/src/app/Scenes/Onboarding/Auth2/components/AuthModal.tsx b/src/app/Scenes/Onboarding/Auth2/components/AuthModal.tsx index 28d09c8615e..2258ddde950 100644 --- a/src/app/Scenes/Onboarding/Auth2/components/AuthModal.tsx +++ b/src/app/Scenes/Onboarding/Auth2/components/AuthModal.tsx @@ -1,12 +1,11 @@ -import { AuthImpression, ActionType } from "@artsy/cohesion" import { Box, Flex, useTheme } from "@artsy/palette-mobile" import { AuthContext } from "app/Scenes/Onboarding/Auth2/AuthContext" +import { useOnboardingAuth2Tracking } from "app/Scenes/Onboarding/Auth2/hooks/useOnboardingAuth2Tracking" import { MotiView } from "moti" import { useEffect, useMemo } from "react" import { Dimensions } from "react-native" import { Easing } from "react-native-reanimated" import { useSafeAreaInsets } from "react-native-safe-area-context" -import { useTracking } from "react-tracking" const HEIGHT = { LoginWelcomeStep: 320, @@ -26,10 +25,10 @@ export const AuthModal: React.FC = ({ children }) => { const { color, space } = useTheme() const insets = useSafeAreaInsets() - const tracking = useTracking() + const tracking = useOnboardingAuth2Tracking() useEffect(() => { - tracking.trackEvent(tracks.authImpression()) + tracking.authImpression() }, []) const screenHeight = Dimensions.get("window").height @@ -82,10 +81,3 @@ export const AuthModal: React.FC = ({ children }) => { // ) } - -const tracks = { - authImpression: (): Partial => ({ - action: ActionType.authImpression, - trigger: "tap", - }), -} diff --git a/src/app/Scenes/Onboarding/Auth2/hooks/useOnboardingAuth2Tracking.tsx b/src/app/Scenes/Onboarding/Auth2/hooks/useOnboardingAuth2Tracking.tsx new file mode 100644 index 00000000000..6eed4ea49bf --- /dev/null +++ b/src/app/Scenes/Onboarding/Auth2/hooks/useOnboardingAuth2Tracking.tsx @@ -0,0 +1,17 @@ +import { ActionType, AuthImpression } from "@artsy/cohesion" +import { useTracking } from "react-tracking" + +export const useOnboardingAuth2Tracking = () => { + const { trackEvent } = useTracking() + + return { + authImpression: () => { + const payload: Partial = { + action: ActionType.authImpression, + trigger: "tap", + } + + trackEvent(payload) + }, + } +}