Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 7 additions & 12 deletions samples/expo/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import React from 'react';
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { Link, Tabs } from 'expo-router';
import React from 'react';
import { Pressable } from 'react-native';

import Colors from '@/constants/Colors';
import { useColorScheme } from '@/components/useColorScheme';
import { useClientOnlyValue } from '@/components/useClientOnlyValue';
import { useColorScheme } from '@/components/useColorScheme';
import Colors from '@/constants/Colors';

// You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>['name'];
color: string;
}) {
function TabBarIcon(props: { name: React.ComponentProps<typeof FontAwesome>['name']; color: string }) {
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
}

Expand Down Expand Up @@ -39,10 +36,7 @@ function InfoButton({ colorScheme }: { colorScheme: 'light' | 'dark' | null }) {
export default function TabLayout() {
const colorScheme = useColorScheme();

const renderInfoButton = React.useCallback(
() => <InfoButton colorScheme={colorScheme} />,
[colorScheme],
);
const renderInfoButton = React.useCallback(() => <InfoButton colorScheme={colorScheme} />, [colorScheme]);

return (
<Tabs
Expand All @@ -51,7 +45,8 @@ export default function TabLayout() {
// Disable the static render of the header on web
// to prevent a hydration error in React Navigation v6.
headerShown: useClientOnlyValue(false, true),
}}>
}}
>
<Tabs.Screen
name="index"
options={{
Expand Down
17 changes: 7 additions & 10 deletions samples/expo/app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Button, ScrollView, StyleSheet } from 'react-native';
import * as Sentry from '@sentry/react-native';
import { reloadAppAsync, isRunningInExpoGo } from 'expo';
import * as DevClient from 'expo-dev-client';
import { useRouter } from 'expo-router';
import { useUpdates } from 'expo-updates';
import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import { Button, ScrollView, StyleSheet } from 'react-native';

import { Text, View } from '@/components/Themed';
import { setScopeProperties } from '@/utils/setScopeProperties';
import React from 'react';
import * as WebBrowser from 'expo-web-browser';
import { useUpdates } from 'expo-updates';

import { isWeb } from '../../utils/isWeb';

export default function TabOneScreen() {
Expand Down Expand Up @@ -93,9 +94,7 @@ export default function TabOneScreen() {
title="Native Crash"
onPress={() => {
if (isRunningInExpoGo()) {
console.warn(
'Not supported in Expo Go. Build the application to test this feature.',
);
console.warn('Not supported in Expo Go. Build the application to test this feature.');
return;
}
Sentry.nativeCrash();
Expand Down Expand Up @@ -202,9 +201,7 @@ export default function TabOneScreen() {
string: 'string',
bigint: BigInt(123),
});
Sentry.captureMessage(
'Message with different types of tags globally',
);
Sentry.captureMessage('Message with different types of tags globally');
Sentry.setTags({
number: undefined,
boolean: undefined,
Expand Down
20 changes: 6 additions & 14 deletions samples/expo/app/(tabs)/two.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StyleSheet } from 'react-native';
import * as Sentry from '@sentry/react-native';
import { StyleSheet } from 'react-native';

import EditScreenInfo from '@/components/EditScreenInfo';
import { Text, View } from '@/components/Themed';
Expand All @@ -8,25 +8,17 @@ export default function TabTwoScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab Two</Text>
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<Sentry.Unmask>
<Text>
This is unmasked because it's direct child of Sentry.Unmask (can be
masked if Sentry.Masked is used higher in the hierarchy)
This is unmasked because it's direct child of Sentry.Unmask (can be masked if Sentry.Masked is used higher in
the hierarchy)
</Text>
<Sentry.Mask>
<Text>
This is masked always because it's a child of a Sentry.Mask
</Text>
<Text>This is masked always because it's a child of a Sentry.Mask</Text>
<Sentry.Unmask>
{/* Sentry.Unmask does not override the Sentry.Mask from above in the hierarchy */}
<Text>
This is masked always because it's a child of Sentry.Mask
</Text>
<Text>This is masked always because it's a child of Sentry.Mask</Text>
</Sentry.Unmask>
</Sentry.Mask>
</Sentry.Unmask>
Expand Down
5 changes: 1 addition & 4 deletions samples/expo/app/+html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ export default function Root({ children }: { children: React.ReactNode }) {
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

{/*
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
Expand Down
13 changes: 5 additions & 8 deletions samples/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import FontAwesome from '@expo/vector-icons/FontAwesome';
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from '@react-navigation/native';
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
import * as Sentry from '@sentry/react-native';
import { isRunningInExpoGo } from 'expo';
import { useFonts } from 'expo-font';
import * as ImagePicker from 'expo-image-picker';
import { SplashScreen, Stack, useNavigationContainerRef } from 'expo-router';
import { useEffect } from 'react';
import { LogBox } from 'react-native';

import { useColorScheme } from '@/components/useColorScheme';

import { SENTRY_INTERNAL_DSN } from '../utils/dsn';
import * as Sentry from '@sentry/react-native';
import { LogBox } from 'react-native';
import * as ImagePicker from 'expo-image-picker';

export {
// Catch any errors thrown by the Layout component.
Expand Down
6 changes: 1 addition & 5 deletions samples/expo/app/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ export default function ModalScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Modal</Text>
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<EditScreenInfo path="app/modal.tsx" />

{/* Use a light status bar on iOS to account for the black space above the modal */}
Expand Down
26 changes: 10 additions & 16 deletions samples/expo/components/EditScreenInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
import React from 'react';
import { StyleSheet } from 'react-native';

import Colors from '@/constants/Colors';

import { ExternalLink } from './ExternalLink';
import { MonoText } from './StyledText';
import { Text, View } from './Themed';

import Colors from '@/constants/Colors';

export default function EditScreenInfo({ path }: { path: string }) {
return (
<View>
<View style={styles.getStartedContainer}>
<Text
style={styles.getStartedText}
lightColor="rgba(0,0,0,0.8)"
darkColor="rgba(255,255,255,0.8)">
<Text style={styles.getStartedText} lightColor="rgba(0,0,0,0.8)" darkColor="rgba(255,255,255,0.8)">
Open up the code for this screen:
</Text>

<View
style={[styles.codeHighlightContainer, styles.homeScreenFilename]}
darkColor="rgba(255,255,255,0.05)"
lightColor="rgba(0,0,0,0.05)">
lightColor="rgba(0,0,0,0.05)"
>
<MonoText>{path}</MonoText>
</View>

<Text
style={styles.getStartedText}
lightColor="rgba(0,0,0,0.8)"
darkColor="rgba(255,255,255,0.8)">
Change any of the text, save the file, and your app will automatically
update.
<Text style={styles.getStartedText} lightColor="rgba(0,0,0,0.8)" darkColor="rgba(255,255,255,0.8)">
Change any of the text, save the file, and your app will automatically update.
</Text>
</View>

<View style={styles.helpContainer}>
<ExternalLink
style={styles.helpLink}
href="https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet">
href="https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet"
>
<Text style={styles.helpLinkText} lightColor={Colors.light.tint}>
Tap here if your app doesn't automatically update after making
changes
Tap here if your app doesn't automatically update after making changes
</Text>
</ExternalLink>
</View>
Expand Down
4 changes: 1 addition & 3 deletions samples/expo/components/ExternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import { Platform } from 'react-native';

export function ExternalLink(
props: Omit<React.ComponentProps<typeof Link>, 'href'> & { href: string },
) {
export function ExternalLink(props: Omit<React.ComponentProps<typeof Link>, 'href'> & { href: string }) {
return (
<Link
target="_blank"
Expand Down
1 change: 1 addition & 0 deletions samples/expo/components/StyledText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StyleSheet } from 'react-native';

import { Text, TextProps } from './Themed';

export function MonoText(props: TextProps) {
Expand Down
6 changes: 2 additions & 4 deletions samples/expo/components/Themed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Text as DefaultText, View as DefaultView } from 'react-native';

import Colors from '@/constants/Colors';

import { useColorScheme } from './useColorScheme';

type ThemeProps = {
Expand Down Expand Up @@ -39,10 +40,7 @@ export function Text(props: TextProps) {

export function View(props: ViewProps) {
const { style, lightColor, darkColor, ...otherProps } = props;
const backgroundColor = useThemeColor(
{ light: lightColor, dark: darkColor },
'background',
);
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');

return <DefaultView style={[{ backgroundColor }, style]} {...otherProps} />;
}
3 changes: 1 addition & 2 deletions samples/expo/utils/dsn.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export const SENTRY_INTERNAL_DSN =
'https://1df17bd4e543fdb31351dee1768bb679@o447951.ingest.sentry.io/5428561';
export const SENTRY_INTERNAL_DSN = 'https://1df17bd4e543fdb31351dee1768bb679@o447951.ingest.sentry.io/5428561';
2 changes: 1 addition & 1 deletion samples/expo/utils/setScopeProperties.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/react-native';
import { SeverityLevel } from '@sentry/core';
import * as Sentry from '@sentry/react-native';

export const setScopeProperties = () => {
const dateString = new Date().toString();
Expand Down
Loading