diff --git a/src/App.tsx b/src/App.tsx index c1cd7e1..ef3d066 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,8 +13,6 @@ import * as Sentry from '@sentry/react-native'; import HomeScreen from './screens/HomeScreen'; import ListApp from './screens/ListApp'; -import TrackerScreen from './screens/TrackerScreen'; -import ManualTrackerScreen from './screens/ManualTrackerScreen'; import PerformanceTimingScreen from './screens/PerformanceTimingScreen'; import EndToEndTestsScreen from './screens/EndToEndTestsScreen'; import ProductDetailScreen from './screens/ProductDetailScreen'; @@ -231,8 +229,6 @@ const DebugNavigator = () => { return ( - - { - { - props.navigation.navigate('Tracker'); - }}> - - Auto Tracing Example - - - - { - props.navigation.navigate('ManualTracker'); - }}> - - Manual Tracing Example - - - { // Navigate with a reset action just to test diff --git a/src/screens/ManualTrackerScreen.tsx b/src/screens/ManualTrackerScreen.tsx deleted file mode 100644 index 63b9472..0000000 --- a/src/screens/ManualTrackerScreen.tsx +++ /dev/null @@ -1,159 +0,0 @@ -import * as React from 'react'; -import {Button, View, StyleSheet, Text, ActivityIndicator} from 'react-native'; - -import * as Sentry from '@sentry/react-native'; -import {Span} from '@sentry/types'; - -/** - * An example of how to add a Sentry Transaction to a React component manually. - * So you can control all spans that belong to that one transaction. - * - * This screen calls an API to get the latest COVID-19 Data to display. We attach a span - * to the fetch call and track the time it takes for Promise to resolve. - */ -const TrackerScreen = () => { - const [cases, setCases] = React.useState<{ - TotalConfirmed: number; - TotalDeaths: number; - TotalRecovered: number; - } | null>(null); - - const rootSpan = React.useRef(undefined); - - React.useEffect(() => { - // Initialize the transaction for the screen. - rootSpan.current = Sentry.startSpanManual( - { - name: 'Tracker Screen (manual)', - op: 'navigation', - }, - (span: Span) => span, - ); - - return () => { - // Ending the span triggers sending the data to Sentry. - rootSpan.current?.end(); - rootSpan.current = undefined; - }; - }, []); - - const loadData = async () => { - setCases(null); - - // Create a child span for the API call. - await Sentry.startSpan( - { - op: 'http', - name: 'Fetch Covid19 data from API', - parentSpan: rootSpan.current, - }, - async (span: Span) => { - const response = await fetch('https://api.covid19api.com/summary', { - method: 'GET', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - }); - const json = await response.json(); - const newCases = json.Global; - setCases(newCases); - - span.setAttribute('received_cases', Object.keys(newCases)); - }, - ); - }; - - React.useEffect(() => { - loadData(); - }, []); - - return ( - - - Global COVID19 Cases - - - {cases ? ( - <> - - - - - ) : ( - - )} - -