1
1
import React from 'react' ;
2
2
3
- import Instabug , { BugReporting , InvocationOption , ReportType } from 'instabug-reactnative' ;
3
+ import Instabug , {
4
+ BugReporting ,
5
+ InvocationOption ,
6
+ ReportType ,
7
+ ExtendedBugReportMode ,
8
+ WelcomeMessageMode ,
9
+ } from 'instabug-reactnative' ;
4
10
5
11
import { ListTile } from '../components/ListTile' ;
6
12
import { Screen } from '../components/Screen' ;
13
+ import { useToast } from 'native-base' ;
14
+ import { Section } from '../components/Section' ;
7
15
8
16
export const BugReportingScreen : React . FC = ( ) => {
17
+ const toast = useToast ( ) ;
9
18
return (
10
19
< Screen >
11
20
< ListTile title = "Show" onPress = { ( ) => Instabug . show ( ) } />
@@ -15,6 +24,59 @@ export const BugReportingScreen: React.FC = () => {
15
24
onPress = { ( ) => BugReporting . show ( ReportType . feedback , [ InvocationOption . emailFieldHidden ] ) }
16
25
/>
17
26
< ListTile title = "Ask a Question" onPress = { ( ) => BugReporting . show ( ReportType . question , [ ] ) } />
27
+ < ListTile
28
+ title = "Enable extended bug report with required fields"
29
+ onPress = { ( ) =>
30
+ BugReporting . setExtendedBugReportMode ( ExtendedBugReportMode . enabledWithRequiredFields )
31
+ }
32
+ />
33
+ < ListTile
34
+ title = "Enable extended bug report with optional fields"
35
+ onPress = { ( ) =>
36
+ BugReporting . setExtendedBugReportMode ( ExtendedBugReportMode . enabledWithOptionalFields )
37
+ }
38
+ />
39
+ < ListTile
40
+ title = "Disable session profiler"
41
+ onPress = { ( ) => Instabug . setSessionProfilerEnabled ( true ) }
42
+ />
43
+ < ListTile
44
+ title = "Welcome message Beta"
45
+ onPress = { ( ) => Instabug . showWelcomeMessage ( WelcomeMessageMode . beta ) }
46
+ />
47
+ < ListTile
48
+ title = "Welcome message Live"
49
+ onPress = { ( ) => Instabug . showWelcomeMessage ( WelcomeMessageMode . live ) }
50
+ />
51
+
52
+ < Section title = "Handlers" >
53
+ < ListTile
54
+ title = "On invocation add tag"
55
+ onPress = { ( ) =>
56
+ BugReporting . onInvokeHandler ( function ( ) {
57
+ Instabug . appendTags ( [ 'Invocation Handler tag1' ] ) ;
58
+ } )
59
+ }
60
+ />
61
+ < ListTile
62
+ title = "On submission show toast message"
63
+ onPress = { ( ) =>
64
+ Instabug . onReportSubmitHandler ( ( ) => {
65
+ toast . show ( {
66
+ description : 'Submission succeeded' ,
67
+ } ) ;
68
+ } )
69
+ }
70
+ />
71
+ < ListTile
72
+ title = "On dismissing turn floating to red"
73
+ onPress = { ( ) =>
74
+ BugReporting . onSDKDismissedHandler ( function ( ) {
75
+ Instabug . setPrimaryColor ( '#FF0000' ) ;
76
+ } )
77
+ }
78
+ />
79
+ </ Section >
18
80
</ Screen >
19
81
) ;
20
82
} ;
0 commit comments