From 3b5c1f8433e386535ec0badd117390ed3814f018 Mon Sep 17 00:00:00 2001 From: Guy Tepper Date: Tue, 5 May 2026 14:36:50 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20-=20Fix=20PostHog=20dropping?= =?UTF-8?q?=20events=20&=20bump=20to=202.6.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Share a single PostHog client between the standalone instance and PostHogProvider so they no longer race on persistence. Upgrade posthog-react-native to 4.44.1 and posthog-react-native-session-replay to 1.5.6 (both pinned). Bump app version to 2.6.2. --- android/app/build.gradle | 4 +-- app/navigators/root-navigator.tsx | 5 ++- app/services/analytics/index.ts | 12 +++---- bun.lock | 12 ++++--- ios/BetterRail.xcodeproj/project.pbxproj | 42 +++++++++++++----------- ios/Podfile.lock | 10 +++--- package.json | 4 +-- 7 files changed, 45 insertions(+), 44 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 75c05853..d033e9fb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -107,8 +107,8 @@ android { applicationId "com.betterrail" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 153 - versionName "2.6.1" + versionCode 154 + versionName "2.6.2" missingDimensionStrategy "store", "play" // API Configuration diff --git a/app/navigators/root-navigator.tsx b/app/navigators/root-navigator.tsx index 8eacf841..bec4f194 100644 --- a/app/navigators/root-navigator.tsx +++ b/app/navigators/root-navigator.tsx @@ -1,4 +1,3 @@ -import { POSTHOG_API_KEY } from "@env" import React from "react" import { useColorScheme } from "react-native" import { NavigationContainer, type NavigationContainerRef, DefaultTheme, DarkTheme } from "@react-navigation/native" @@ -11,7 +10,7 @@ import { PaywallNavigator } from "./paywall/paywall-navigator" import { LiveAnnouncementNavigator } from "./live-activity-announcement/live-activity-announcement-stack" import { AnnouncementsNavigator } from "./announcements/announcements-navigator" import { PostHogProvider, usePostHog } from "posthog-react-native" -import { posthogOptions } from "../services/analytics" +import { posthog } from "../services/analytics" import { useForceUpdate } from "../hooks/use-force-update" import { ForceUpdateScreen } from "../screens/force-update/force-update-screen" @@ -62,7 +61,7 @@ export const RootNavigator = React.forwardRef navigationRef.current!) return ( - + {...props} ref={navigationRef} diff --git a/app/services/analytics/index.ts b/app/services/analytics/index.ts index 1f7858b7..3c60c72a 100644 --- a/app/services/analytics/index.ts +++ b/app/services/analytics/index.ts @@ -1,17 +1,15 @@ import { POSTHOG_API_KEY } from "@env" import { getAnalytics } from "@react-native-firebase/analytics" -import PostHog, { PostHogOptions } from "posthog-react-native" +import PostHog from "posthog-react-native" import AsyncStorage from "@react-native-async-storage/async-storage" import { ensurePosthogPropertiesHydrated, getCachedPosthogProperties, setCachedPosthogProperties, setCachedPosthogProperty } from "./posthog-user-properties" -export const posthogOptions: PostHogOptions = { +export const posthog = new PostHog(POSTHOG_API_KEY, { host: "https://eu.i.posthog.com", - persistence: "file" as const, + persistence: "file", customStorage: AsyncStorage, - enableSessionReplay: true -} - -export const posthog = new PostHog(POSTHOG_API_KEY, posthogOptions) + enableSessionReplay: true, +}) type AnalyticsParams = Record diff --git a/bun.lock b/bun.lock index 0deae26a..72b0ef46 100644 --- a/bun.lock +++ b/bun.lock @@ -42,8 +42,8 @@ "fuse.js": "6.4.6", "i18n-js": "3.8.0", "lodash": "4.17.21", - "posthog-react-native": "4.39.4", - "posthog-react-native-session-replay": "1.5.2", + "posthog-react-native": "4.44.1", + "posthog-react-native-session-replay": "1.5.6", "ramda": "0.27.1", "react": "19.1.0", "react-native": "0.81.4", @@ -583,7 +583,9 @@ "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], - "@posthog/core": ["@posthog/core@1.24.6", "", {}, "sha512-9WkcRKqmXSWIJcca6m3VwA9YbFd4HiG2hKEtDq6FcwEHlvfDhQQUZ5/sJZ47Fw8OtyNMHQ6rW4+COttk4Bg5NQ=="], + "@posthog/core": ["@posthog/core@1.28.1", "", { "dependencies": { "@posthog/types": "1.372.7" } }, "sha512-eCzWduboLer105RHKnnM8sfRvBhhvzU0m/PXtedJzYjRs5aJSEgCT7zrmw63XCmOl33ffKU2n61EaWiFeuRKPA=="], + + "@posthog/types": ["@posthog/types@1.372.7", "", {}, "sha512-atYFeTnG+5WcZ4hXFI9cA2q269+a1CYoK9nG6TowJqWclv0vr1KZBb1Fhe4CpHOarfgJUfD/2PZe5WTq9Frz3w=="], "@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="], @@ -1815,9 +1817,9 @@ "postcss": ["postcss@8.4.49", "", { "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA=="], - "posthog-react-native": ["posthog-react-native@4.39.4", "", { "dependencies": { "@posthog/core": "1.24.6" }, "peerDependencies": { "@react-native-async-storage/async-storage": ">=1.0.0", "@react-navigation/native": ">= 5.0.0", "expo-application": ">= 4.0.0", "expo-device": ">= 4.0.0", "expo-file-system": ">= 13.0.0", "expo-localization": ">= 11.0.0", "posthog-react-native-session-replay": ">= 1.5.2", "react-native-device-info": ">= 10.0.0", "react-native-localize": ">= 3.0.0", "react-native-navigation": ">= 6.0.0", "react-native-safe-area-context": ">= 4.0.0", "react-native-svg": ">= 15.0.0" }, "optionalPeers": ["@react-native-async-storage/async-storage", "@react-navigation/native", "expo-application", "expo-device", "expo-file-system", "expo-localization", "posthog-react-native-session-replay", "react-native-device-info", "react-native-localize", "react-native-navigation", "react-native-safe-area-context"] }, "sha512-5R1HEOoSimuEKGOP+0sni939VyIniRyFkT+Lxl2btKLSy+FKzfIREYGkyADTpNOJmKxiFVHuOgDHj3iY6l+7Ww=="], + "posthog-react-native": ["posthog-react-native@4.44.1", "", { "dependencies": { "@posthog/core": "1.28.1", "@posthog/types": "1.372.7" }, "peerDependencies": { "@react-native-async-storage/async-storage": ">=1.0.0", "@react-navigation/native": ">= 5.0.0", "expo-application": ">= 4.0.0", "expo-device": ">= 4.0.0", "expo-file-system": ">= 13.0.0", "expo-localization": ">= 11.0.0", "posthog-react-native-session-replay": ">= 1.5.6", "react-native-device-info": ">= 10.0.0", "react-native-localize": ">= 3.0.0", "react-native-navigation": ">= 6.0.0", "react-native-safe-area-context": ">= 4.0.0", "react-native-svg": ">= 15.0.0" }, "optionalPeers": ["@react-native-async-storage/async-storage", "@react-navigation/native", "expo-application", "expo-device", "expo-file-system", "expo-localization", "posthog-react-native-session-replay", "react-native-device-info", "react-native-localize", "react-native-navigation", "react-native-safe-area-context", "react-native-svg"] }, "sha512-fY72Enf1WR41H5pSCqR4disIUyf47lhEAIZ+zyYtlJuAFaPwG/VKc63Wt5Bv8XuJ6kb43JbKwMYJ4d1h3GcAwg=="], - "posthog-react-native-session-replay": ["posthog-react-native-session-replay@1.5.2", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-NS/HbEOp9NQSkL99pNmkCSprLV42SHgEv7uUvCNeWByG1TG4MUMzk83U3n3V5odENphNQvkYPChRKneiKourPQ=="], + "posthog-react-native-session-replay": ["posthog-react-native-session-replay@1.5.6", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-tNnjxn/mLZ2UMHknES+9/XnUdEcQ+qzDvU8gsCW0CnW20GMSJbeKGGgNVI4qcnXK10iH1z/Bgmnkb+LtDlyMTA=="], "postinstall-prepare": ["postinstall-prepare@1.0.1", "", {}, "sha512-4zxO4DjrV0XfD+ABUFEP0MiQmhKOGBnov5LfLsra/XVOUcQ5gMLLMcV3b8K8wJUfNDv1ozleGblYb06gPbjVUQ=="], diff --git a/ios/BetterRail.xcodeproj/project.pbxproj b/ios/BetterRail.xcodeproj/project.pbxproj index 94095d47..f37513d9 100644 --- a/ios/BetterRail.xcodeproj/project.pbxproj +++ b/ios/BetterRail.xcodeproj/project.pbxproj @@ -948,6 +948,7 @@ "${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport/GoogleDataTransport_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities/GoogleUtilities_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/PostHog/PostHog.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/PostHog/PHPLCrashReporter.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC/FBLPromises_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", @@ -978,6 +979,7 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleDataTransport_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleUtilities_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/PostHog.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/PHPLCrashReporter.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FBLPromises_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", @@ -1304,7 +1306,7 @@ CODE_SIGN_ENTITLEMENTS = BetterRail/BetterRailDebug.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; ENABLE_BITCODE = NO; @@ -1314,7 +1316,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1348,7 +1350,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; INFOPLIST_FILE = BetterRail/Info.plist; @@ -1357,7 +1359,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1565,7 +1567,7 @@ CODE_SIGN_ENTITLEMENTS = BetterRailWidgetExtensionDebug.entitlements; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1577,7 +1579,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; @@ -1614,7 +1616,7 @@ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1626,7 +1628,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE"; PRODUCT_BUNDLE_IDENTIFIER = "il.co.better-rail.watchkitapp.BetterRailWidget"; @@ -1659,7 +1661,7 @@ CODE_SIGN_ENTITLEMENTS = BetterRailWatch.entitlements; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1678,7 +1680,7 @@ "@executable_path/Frameworks", ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; @@ -1716,7 +1718,7 @@ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1735,7 +1737,7 @@ "@executable_path/Frameworks", ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE"; PRODUCT_BUNDLE_IDENTIFIER = "il.co.better-rail.watchkitapp"; @@ -1766,7 +1768,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = BetterRailWidgetExtensionDebug.entitlements; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1778,7 +1780,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; @@ -1811,7 +1813,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1823,7 +1825,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE"; PRODUCT_BUNDLE_IDENTIFIER = "il.co.better-rail.BetterRailWidget"; @@ -1849,7 +1851,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = StationIntent/StationIntentDebug.entitlements; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1861,7 +1863,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; @@ -1892,7 +1894,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX; @@ -1904,7 +1906,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE"; PRODUCT_BUNDLE_IDENTIFIER = "il.co.better-rail.StationIntent"; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4dd0f2da..de642fdd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1571,15 +1571,15 @@ PODS: - SocketRocket - Yoga - openiap (1.2.26) - - PostHog (3.42.1) - - posthog-react-native-session-replay (1.5.2): + - PostHog (3.57.3) + - posthog-react-native-session-replay (1.5.6): - boost - DoubleConversion - fast_float - fmt - glog - hermes-engine - - PostHog (~> 3.42.0) + - PostHog (~> 3.57.1) - RCT-Folly - RCT-Folly/Fabric - RCTRequired @@ -5054,8 +5054,8 @@ SPEC CHECKSUMS: NitroIap: 4dc018bd561764a28408eac1a3795646fcf90726 NitroModules: 8f30b6fd4290c8b8ecc079ccef195085b7f83774 openiap: 6b09e05908b9536a0466a56ff763d21d71094077 - PostHog: 148d2d62bac68c6da50a2325030b3fb2d6bca95b - posthog-react-native-session-replay: 79efc1a399fb775790010abe704e4061c0e35b0c + PostHog: c33925273e18b9c6bf3b33401416b08fa3db578e + posthog-react-native-session-replay: 6e278629c40e8aa15fab8c34cd57b5614690fec9 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669 RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585 diff --git a/package.json b/package.json index 80a0db62..49b13ca5 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "fuse.js": "6.4.6", "i18n-js": "3.8.0", "lodash": "4.17.21", - "posthog-react-native": "^4.39.4", - "posthog-react-native-session-replay": "^1.5.2", + "posthog-react-native": "4.44.1", + "posthog-react-native-session-replay": "1.5.6", "ramda": "0.27.1", "react": "19.1.0", "react-native": "0.81.4", From 6049e603802aba6e2d785d2dbe07a06a72e3f0cb Mon Sep 17 00:00:00 2001 From: Guy Tepper Date: Tue, 5 May 2026 14:45:41 +0300 Subject: [PATCH 2/2] Use imported PostHog singleton for screen tracking usePostHog() was being called in RootNavigator itself, outside the PostHogProvider it renders. The hook returned no client, so the screen() calls in onReady/onStateChange were silent no-ops. Use the imported singleton directly. --- app/navigators/root-navigator.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/navigators/root-navigator.tsx b/app/navigators/root-navigator.tsx index bec4f194..19cdc935 100644 --- a/app/navigators/root-navigator.tsx +++ b/app/navigators/root-navigator.tsx @@ -9,7 +9,7 @@ import { WidgetOnboardingNavigator } from "./widget-onboarding/widget-onboarding import { PaywallNavigator } from "./paywall/paywall-navigator" import { LiveAnnouncementNavigator } from "./live-activity-announcement/live-activity-announcement-stack" import { AnnouncementsNavigator } from "./announcements/announcements-navigator" -import { PostHogProvider, usePostHog } from "posthog-react-native" +import { PostHogProvider } from "posthog-react-native" import { posthog } from "../services/analytics" import { useForceUpdate } from "../hooks/use-force-update" import { ForceUpdateScreen } from "../screens/force-update/force-update-screen" @@ -53,7 +53,6 @@ const RootStack = () => { export const RootNavigator = React.forwardRef, Partial>>( (props, ref) => { - const posthog = usePostHog() const colorScheme = useColorScheme() const navigationRef = React.useRef>(null) const routeNameRef = React.useRef() @@ -69,7 +68,7 @@ export const RootNavigator = React.forwardRef { routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name if (routeNameRef.current) { - posthog?.screen(routeNameRef.current) + posthog.screen(routeNameRef.current) } }} onStateChange={() => { @@ -77,7 +76,7 @@ export const RootNavigator = React.forwardRef