1- import { Button , StyleSheet } from 'react-native' ;
1+ import { Button , ScrollView , StyleSheet } from 'react-native' ;
22import * as Sentry from '@sentry/react-native' ;
33import { reloadAppAsync , isRunningInExpoGo } from 'expo' ;
44import * as DevClient from 'expo-dev-client' ;
@@ -19,101 +19,181 @@ export default function TabOneScreen() {
1919 < Text > Update ID: { currentlyRunning . updateId } </ Text >
2020 < Text > Channel: { currentlyRunning . channel } </ Text >
2121 < Text > Runtime Version: { currentlyRunning . runtimeVersion } </ Text >
22- < Button
23- title = "Open DevMenu"
24- onPress = { ( ) => {
25- DevClient . openMenu ( ) ;
26- } }
27- disabled = { isWeb ( ) }
28- />
29- < Button
30- title = "Capture message"
31- onPress = { ( ) => {
32- Sentry . captureMessage ( 'Captured message' ) ;
33- } }
34- />
35- < Button
36- title = "Capture exception"
37- onPress = { ( ) => {
38- Sentry . captureException ( new Error ( 'Captured exception' ) ) ;
39- } }
40- />
41- < Button
42- title = "Capture exception with cause"
43- onPress = { ( ) => {
44- const error = new Error ( 'Captured exception' ) ;
45- error . cause = new Error ( 'Cause of captured exception' ) ;
46- Sentry . captureException ( error ) ;
47- } }
48- />
49- < Button
50- title = "Uncaught Thrown Error"
51- onPress = { ( ) => {
52- throw new Error ( 'Uncaught Thrown Error' ) ;
53- } }
54- />
55- < Button
56- title = "Unhandled Promise Rejection"
57- onPress = { ( ) => {
58- // TODO: No working in Expo Go App
59- Promise . reject ( new Error ( 'Unhandled Promise Rejection' ) ) ;
60- } }
61- />
62- < Button
63- title = "Native Crash"
64- onPress = { ( ) => {
65- if ( isRunningInExpoGo ( ) ) {
66- console . warn ( 'Not supported in Expo Go. Build the application to test this feature.' ) ;
67- return ;
68- }
69- Sentry . nativeCrash ( ) ;
70- } }
71- />
72- < Button
73- title = "Show feedback form"
74- onPress = { ( ) => {
75- Sentry . showFeedbackWidget ( ) ;
76- } }
77- />
78- < Button
79- title = "Show feedback button"
80- onPress = { ( ) => {
81- Sentry . showFeedbackButton ( ) ;
82- } }
83- />
84- < Button
85- title = "Set Scope Properties"
86- onPress = { ( ) => {
87- setScopeProperties ( ) ;
88- } }
89- />
90- < Button
91- title = "console.warn()"
92- onPress = { ( ) => {
93- console . warn ( 'This is a warning.' ) ;
94- } }
95- />
96- < Button
97- title = "Flush"
98- onPress = { async ( ) => {
99- await Sentry . flush ( ) ;
100- console . log ( 'Sentry.flush() completed.' ) ;
101- } }
102- />
103- < Button
104- title = "Close"
105- onPress = { async ( ) => {
106- await Sentry . close ( ) ;
107- console . log ( 'Sentry.close() completed.' ) ;
108- } }
109- />
110- < Button title = "Reload" onPress = { ( ) => reloadAppAsync ( ) } />
111- < Button
112- title = "Open WebBrowser"
113- onPress = { ( ) => {
114- WebBrowser . openBrowserAsync ( 'https://sentry.io' ) ;
115- } }
116- />
22+ < View style = { styles . container } >
23+ < ScrollView
24+ > s
25+ < View style = { styles . buttonWrapper } >
26+ < Button
27+ title = "Open DevMenu"
28+ onPress = { ( ) => {
29+ DevClient . openMenu ( ) ;
30+ } }
31+ disabled = { isWeb ( ) }
32+ />
33+ </ View >
34+ < View style = { styles . buttonWrapper } >
35+ < Button
36+ title = "Capture message"
37+ onPress = { ( ) => {
38+ Sentry . captureMessage ( 'Captured message' ) ;
39+ } }
40+ />
41+ </ View >
42+ < View style = { styles . buttonWrapper } >
43+ < Button
44+ title = "Capture exception"
45+ onPress = { ( ) => {
46+ Sentry . captureException ( new Error ( 'Captured exception' ) ) ;
47+ } }
48+ />
49+ </ View >
50+ < View style = { styles . buttonWrapper } >
51+ < Button
52+ title = "Capture exception with cause"
53+ onPress = { ( ) => {
54+ const error = new Error ( 'Captured exception' ) ;
55+ error . cause = new Error ( 'Cause of captured exception' ) ;
56+ Sentry . captureException ( error ) ;
57+ } }
58+ />
59+ </ View >
60+ < View style = { styles . buttonWrapper } >
61+ < Button
62+ title = "Uncaught Thrown Error"
63+ onPress = { ( ) => {
64+ throw new Error ( 'Uncaught Thrown Error' ) ;
65+ } }
66+ />
67+ </ View >
68+ < View style = { styles . buttonWrapper } >
69+ < Button
70+ title = "Unhandled Promise Rejection"
71+ onPress = { ( ) => {
72+ // TODO: No working in Expo Go App
73+ Promise . reject ( new Error ( 'Unhandled Promise Rejection' ) ) ;
74+ } }
75+ />
76+ </ View >
77+ < View style = { styles . buttonWrapper } >
78+ < Button
79+ title = "Native Crash"
80+ onPress = { ( ) => {
81+ if ( isRunningInExpoGo ( ) ) {
82+ console . warn ( 'Not supported in Expo Go. Build the application to test this feature.' ) ;
83+ return ;
84+ }
85+ Sentry . nativeCrash ( ) ;
86+ } }
87+ />
88+ </ View >
89+ < View style = { styles . buttonWrapper } >
90+ < Button
91+ title = "Show feedback form"
92+ onPress = { ( ) => {
93+ Sentry . showFeedbackWidget ( ) ;
94+ } }
95+ />
96+ </ View >
97+ < View style = { styles . buttonWrapper } >
98+ < Button
99+ title = "Show feedback button"
100+ onPress = { ( ) => {
101+ Sentry . showFeedbackButton ( ) ;
102+ } }
103+ />
104+ </ View >
105+ < View style = { styles . buttonWrapper } >
106+ < Button
107+ title = "Set Scope Properties"
108+ onPress = { ( ) => {
109+ setScopeProperties ( ) ;
110+ } }
111+ />
112+ </ View >
113+ < View style = { styles . buttonWrapper } >
114+ < Button
115+ title = "console.warn()"
116+ onPress = { ( ) => {
117+ console . warn ( 'This is a warning.' ) ;
118+ } }
119+ />
120+ </ View >
121+ < View style = { styles . buttonWrapper } >
122+ < Button
123+ title = "Flush"
124+ onPress = { async ( ) => {
125+ await Sentry . flush ( ) ;
126+ console . log ( 'Sentry.flush() completed.' ) ;
127+ } }
128+ />
129+ </ View >
130+ < View style = { styles . buttonWrapper } >
131+ < Button
132+ title = "Close"
133+ onPress = { async ( ) => {
134+ await Sentry . close ( ) ;
135+ console . log ( 'Sentry.close() completed.' ) ;
136+ } }
137+ />
138+ </ View >
139+ < View style = { styles . buttonWrapper } >
140+ < Button title = "Reload" onPress = { ( ) => reloadAppAsync ( ) } />
141+ </ View >
142+ < View style = { styles . buttonWrapper } >
143+ < Button
144+ title = "Open WebBrowser"
145+ onPress = { ( ) => {
146+ WebBrowser . openBrowserAsync ( 'https://sentry.io' ) ;
147+ } }
148+ />
149+ </ View >
150+ < View style = { styles . buttonWrapper } >
151+ < Button
152+ title = "Set different types of tags globally"
153+ onPress = { async ( ) => {
154+ Sentry . setTags ( {
155+ number : 123 ,
156+ boolean : true ,
157+ null : null ,
158+ undefined : undefined ,
159+ symbol : Symbol ( 'symbol' ) ,
160+ string : 'string' ,
161+ bigint : BigInt ( 123 ) ,
162+ } ) ;
163+ Sentry . captureMessage ( 'Message with different types of tags globally' ) ;
164+ Sentry . setTags ( {
165+ number : undefined ,
166+ boolean : undefined ,
167+ null : undefined ,
168+ symbol : undefined ,
169+ string : undefined ,
170+ bigint : undefined ,
171+ } ) ;
172+ } }
173+ />
174+ </ View >
175+ < View style = { styles . buttonWrapper } >
176+ < Button
177+ title = "Set different types of tags in scope"
178+ onPress = { async ( ) => {
179+ const evt = {
180+ message : 'Message with different types of tags isolated' ,
181+ tags : {
182+ number : 123 ,
183+ boolean : true ,
184+ null : null ,
185+ undefined : undefined ,
186+ symbol : Symbol ( 'symbol' ) ,
187+ string : 'abc' ,
188+ bigint : BigInt ( 123 ) ,
189+ } ,
190+ } ;
191+ Sentry . captureEvent ( evt ) ;
192+ } }
193+ />
194+ </ View >
195+ </ ScrollView >
196+ </ View >
117197 </ View >
118198 ) ;
119199}
@@ -133,4 +213,8 @@ const styles = StyleSheet.create({
133213 height : 1 ,
134214 width : '80%' ,
135215 } ,
216+ buttonWrapper : {
217+ marginVertical : 6 ,
218+ marginHorizontal : 12 ,
219+ } ,
136220} ) ;
0 commit comments