Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/pages/inbox/sidebar/SidebarLinksData.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useIsFocused} from '@react-navigation/native';
import {useFocusEffect, useIsFocused} from '@react-navigation/native';
import * as Sentry from '@sentry/react-native';
import React, {useCallback, useRef} from 'react';
import {View} from 'react-native';
Expand Down Expand Up @@ -30,17 +30,21 @@ function SidebarLinksData({insets}: SidebarLinksDataProps) {
currentReportIDRef.current = currentReportID;
const isActiveReport = useCallback((reportID: string): boolean => currentReportIDRef.current === reportID, []);

const onLayout = useCallback(() => {
endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_INBOX_TAB);
}, []);
// IMPORTANT: Always end the telemetry navigation span for the Inbox tab when the screen gains focus.
// This must handle both the initial mount and all subsequent Inbox tab visits,
// as onLayout does not fire when navigating back to an already-mounted screen.
useFocusEffect(
useCallback(() => {
endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_INBOX_TAB);
Comment thread
BartekObudzinski marked this conversation as resolved.
Resolved
Comment thread
BartekObudzinski marked this conversation as resolved.
Resolved
}, []),
);

return (
<View
accessibilityElementsHidden={!isFocused}
collapsable={false}
accessibilityLabel={translate('sidebarScreen.listOfChats')}
style={[styles.flex1, styles.h100]}
onLayout={onLayout}
>
<SidebarLinks
// Forwarded props:
Expand Down
Loading