From ef1d6ee490f7c74f9154d929d72efb0830f8da7d Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 31 Oct 2023 02:07:14 +0000 Subject: [PATCH] Log time to first paint (#1775) * Log time to first paint * Fix TS --- src/Navigation.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 52235ad7..a7565198 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -467,6 +467,12 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) { theme={theme} onReady={() => { SplashScreen.hideAsync() + const initMs = Math.round( + // @ts-ignore Emitted by Metro in the bundle prelude + performance.now() - global.__BUNDLE_START_TIME__, + ) + console.log(`Time to first paint: ${initMs} ms`) + // Register the navigation container with the Sentry instrumentation (only works on native) if (isNative) { const routingInstrumentation = getRoutingInstrumentation()