Skip to content

Commit 9e52380

Browse files
authored
Merge branch 'main' into antonis/ci-sample-maestro-timeout
2 parents d8fcf99 + 682f0f5 commit 9e52380

File tree

18 files changed

+803
-66
lines changed

18 files changed

+803
-66
lines changed

samples/expo/.eslintrc.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['expo', '@react-native'],
4+
parser: '@typescript-eslint/parser',
5+
plugins: ['@typescript-eslint'],
6+
settings: {
7+
'import/resolver': {
8+
typescript: {
9+
project: ['tsconfig.json'],
10+
},
11+
node: {
12+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
13+
},
14+
},
15+
},
16+
overrides: [
17+
{
18+
files: ['*.ts', '*.tsx'],
19+
rules: {
20+
'@typescript-eslint/no-shadow': ['error'],
21+
'no-shadow': 'off',
22+
'no-undef': 'off',
23+
quotes: [2, 'single', { avoidEscape: true }],
24+
// Disable deprecated rules removed in @typescript-eslint v8
25+
'@typescript-eslint/func-call-spacing': 'off',
26+
'@typescript-eslint/ban-types': 'off',
27+
// Disable import/no-unresolved for workspace packages that may not be built yet
28+
'import/no-unresolved': ['error', { ignore: ['^@sentry/'] }],
29+
},
30+
},
31+
],
32+
ignorePatterns: ['/node_modules', '/ios', '/android', '/.expo'],
33+
};

samples/expo/.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
ios/
3+
android/
4+
.expo/
5+
*.md
6+

samples/expo/.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: true,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

samples/expo/app.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
"resizeMode": "contain",
1515
"backgroundColor": "#ffffff"
1616
},
17-
"assetBundlePatterns": [
18-
"**/*"
19-
],
17+
"assetBundlePatterns": ["**/*"],
2018
"ios": {
2119
"supportsTablet": true,
2220
"bundleIdentifier": "io.sentry.expo.sample",
@@ -90,4 +88,4 @@
9088
"url": "https://u.expo.dev/00000000-0000-0000-0000-000000000000"
9189
}
9290
}
93-
}
91+
}

samples/expo/app/(tabs)/_layout.tsx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,40 @@ function TabBarIcon(props: {
1212
name: React.ComponentProps<typeof FontAwesome>['name'];
1313
color: string;
1414
}) {
15+
// eslint-disable-next-line react-native/no-inline-styles
1516
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
1617
}
1718

19+
function CodeIcon({ color }: { color: string }) {
20+
return <TabBarIcon name="code" color={color} />;
21+
}
22+
23+
function InfoButton({ colorScheme }: { colorScheme: 'light' | 'dark' | null }) {
24+
return (
25+
<Link href="/modal" asChild>
26+
<Pressable>
27+
{({ pressed }) => (
28+
<FontAwesome
29+
name="info-circle"
30+
size={25}
31+
color={Colors[colorScheme ?? 'light'].text}
32+
// eslint-disable-next-line react-native/no-inline-styles
33+
style={{ marginRight: 15, opacity: pressed ? 0.5 : 1 }}
34+
/>
35+
)}
36+
</Pressable>
37+
</Link>
38+
);
39+
}
40+
1841
export default function TabLayout() {
1942
const colorScheme = useColorScheme();
2043

44+
const renderInfoButton = React.useCallback(
45+
() => <InfoButton colorScheme={colorScheme} />,
46+
[colorScheme],
47+
);
48+
2149
return (
2250
<Tabs
2351
screenOptions={{
@@ -30,28 +58,15 @@ export default function TabLayout() {
3058
name="index"
3159
options={{
3260
title: 'Tab One',
33-
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
34-
headerRight: () => (
35-
<Link href="/modal" asChild>
36-
<Pressable>
37-
{({ pressed }) => (
38-
<FontAwesome
39-
name="info-circle"
40-
size={25}
41-
color={Colors[colorScheme ?? 'light'].text}
42-
style={{ marginRight: 15, opacity: pressed ? 0.5 : 1 }}
43-
/>
44-
)}
45-
</Pressable>
46-
</Link>
47-
),
61+
tabBarIcon: CodeIcon,
62+
headerRight: renderInfoButton,
4863
}}
4964
/>
5065
<Tabs.Screen
5166
name="two"
5267
options={{
5368
title: 'Tab Two',
54-
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
69+
tabBarIcon: CodeIcon,
5570
}}
5671
/>
5772
</Tabs>

samples/expo/app/(tabs)/index.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ export default function TabOneScreen() {
7979
title="Native Crash"
8080
onPress={() => {
8181
if (isRunningInExpoGo()) {
82-
console.warn('Not supported in Expo Go. Build the application to test this feature.');
82+
console.warn(
83+
'Not supported in Expo Go. Build the application to test this feature.',
84+
);
8385
return;
8486
}
8587
Sentry.nativeCrash();
@@ -138,7 +140,9 @@ export default function TabOneScreen() {
138140
<Button
139141
title="Send count metric with attributes"
140142
onPress={() => {
141-
Sentry.metrics.count('count_metric', 1, { attributes: { from_test_app: true } });
143+
Sentry.metrics.count('count_metric', 1, {
144+
attributes: { from_test_app: true },
145+
});
142146
}}
143147
/>
144148
</View>
@@ -184,7 +188,9 @@ export default function TabOneScreen() {
184188
string: 'string',
185189
bigint: BigInt(123),
186190
});
187-
Sentry.captureMessage('Message with different types of tags globally');
191+
Sentry.captureMessage(
192+
'Message with different types of tags globally',
193+
);
188194
Sentry.setTags({
189195
number: undefined,
190196
boolean: undefined,
@@ -226,7 +232,11 @@ export default function TabOneScreen() {
226232
Sentry.logger.warn('expo warn log');
227233
Sentry.logger.error('expo error log');
228234

229-
Sentry.logger.info('expo info log with data', { database: 'admin', number: 123, obj: { password: 'admin' } });
235+
Sentry.logger.info('expo info log with data', {
236+
database: 'admin',
237+
number: 123,
238+
obj: { password: 'admin' },
239+
});
230240
}}
231241
/>
232242
</View>

samples/expo/app/(tabs)/two.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@ export default function TabTwoScreen() {
88
return (
99
<View style={styles.container}>
1010
<Text style={styles.title}>Tab Two</Text>
11-
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
11+
<View
12+
style={styles.separator}
13+
lightColor="#eee"
14+
darkColor="rgba(255,255,255,0.1)"
15+
/>
1216
<Sentry.Unmask>
13-
<Text>This is unmasked because it's direct child of Sentry.Unmask (can be masked if Sentry.Masked is used higher in the hierarchy)</Text>
17+
<Text>
18+
This is unmasked because it's direct child of Sentry.Unmask (can be
19+
masked if Sentry.Masked is used higher in the hierarchy)
20+
</Text>
1421
<Sentry.Mask>
15-
<Text>This is masked always because it's a child of a Sentry.Mask</Text>
22+
<Text>
23+
This is masked always because it's a child of a Sentry.Mask
24+
</Text>
1625
<Sentry.Unmask>
1726
{/* Sentry.Unmask does not override the Sentry.Mask from above in the hierarchy */}
18-
<Text>This is masked always because it's a child of Sentry.Mask</Text>
27+
<Text>
28+
This is masked always because it's a child of Sentry.Mask
29+
</Text>
1930
</Sentry.Unmask>
2031
</Sentry.Mask>
2132
</Sentry.Unmask>

samples/expo/app/+html.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ export default function Root({ children }: { children: React.ReactNode }) {
1010
<head>
1111
<meta charSet="utf-8" />
1212
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
13-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
13+
<meta
14+
name="viewport"
15+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
16+
/>
1417

15-
{/*
16-
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
18+
{/*
19+
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
1720
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
1821
*/}
1922
<ScrollViewStyleReset />

samples/expo/app/_layout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import FontAwesome from '@expo/vector-icons/FontAwesome';
2-
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
2+
import {
3+
DarkTheme,
4+
DefaultTheme,
5+
ThemeProvider,
6+
} from '@react-navigation/native';
37
import { isRunningInExpoGo } from 'expo';
48
import { useFonts } from 'expo-font';
59
import { SplashScreen, Stack, useNavigationContainerRef } from 'expo-router';
@@ -10,7 +14,6 @@ import { SENTRY_INTERNAL_DSN } from '../utils/dsn';
1014
import * as Sentry from '@sentry/react-native';
1115
import { LogBox } from 'react-native';
1216
import * as ImagePicker from 'expo-image-picker';
13-
import { withSentryPlayground } from '@sentry/react-native/playground';
1417

1518
export {
1619
// Catch any errors thrown by the Layout component.
@@ -125,7 +128,9 @@ function RootLayout() {
125128

126129
// Expo Router uses Error Boundaries to catch errors in the navigation tree.
127130
useEffect(() => {
128-
if (error) throw error;
131+
if (error) {
132+
throw error;
133+
}
129134
}, [error]);
130135

131136
useEffect(() => {

samples/expo/app/modal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export default function ModalScreen() {
88
return (
99
<View style={styles.container}>
1010
<Text style={styles.title}>Modal</Text>
11-
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
11+
<View
12+
style={styles.separator}
13+
lightColor="#eee"
14+
darkColor="rgba(255,255,255,0.1)"
15+
/>
1216
<EditScreenInfo path="app/modal.tsx" />
1317

1418
{/* Use a light status bar on iOS to account for the black space above the modal */}

0 commit comments

Comments
 (0)