@@ -24,6 +24,8 @@ import Instabug, {
24
24
CrashReporting ,
25
25
Replies ,
26
26
} from 'instabug-reactnative' ;
27
+ import { NavigationContainer } from '@react-navigation/native' ;
28
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' ;
27
29
28
30
const instructions = Platform . select ( {
29
31
ios : 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu' ,
@@ -32,7 +34,7 @@ const instructions = Platform.select({
32
34
'Shake or press menu button for dev menu' ,
33
35
} ) ;
34
36
35
- export default class App extends Component < { } > {
37
+ class Home extends Component < { } > {
36
38
constructor ( props ) {
37
39
super ( props ) ;
38
40
this . state = {
@@ -97,6 +99,78 @@ export default class App extends Component<{}> {
97
99
onPress = { ( ) => this . showUnreadMessagesCount ( ) } >
98
100
< Text style = { styles . text } > GET UNREAD MESSAGES COUNT </ Text >
99
101
</ TouchableOpacity >
102
+ </ ScrollView >
103
+ </ View >
104
+ ) ;
105
+ }
106
+
107
+ showIntroMessage ( ) {
108
+ Instabug . showIntroMessage ( ) ;
109
+ }
110
+
111
+ invoke ( ) {
112
+ Instabug . show ( ) ;
113
+ }
114
+
115
+ showMultipleQuestionSurvey ( ) {
116
+ Surveys . showSurvey ( 'ZAKSlVz98QdPyOx1wIt8BA' ) ;
117
+ }
118
+
119
+ showNpsSurvey ( ) {
120
+ Surveys . showSurvey ( 'pcV_mE2ttqHxT1iqvBxL0w' ) ;
121
+ }
122
+
123
+ showFeatureRequests ( ) {
124
+ FeatureRequests . show ( ) ;
125
+ }
126
+
127
+ sendBugReport ( ) {
128
+ BugReporting . showWithOptions ( BugReporting . reportType . bug ) ;
129
+ }
130
+
131
+ sendCrashReport ( ) {
132
+ try {
133
+ throw new Error ( 'Text Handled Exception From Instabug Test App' ) ;
134
+ } catch ( Exception ) {
135
+ CrashReporting . reportJSException ( Exception ) ;
136
+ alert ( 'Crash report Sent!' ) ;
137
+ }
138
+ }
139
+
140
+ sendFeedback ( ) {
141
+ BugReporting . showWithOptions ( BugReporting . reportType . feedback , [
142
+ BugReporting . option . emailFieldHidden ,
143
+ ] ) ;
144
+ }
145
+
146
+ startNewConversation ( ) {
147
+ BugReporting . showWithOptions ( BugReporting . reportType . question ) ;
148
+ }
149
+
150
+ showUnreadMessagesCount ( ) {
151
+ Replies . getUnreadRepliesCount ( count => {
152
+ alert ( 'Messages: ' + count ) ;
153
+ } ) ;
154
+ }
155
+ }
156
+ class Settings extends Component < { } > {
157
+ constructor ( props ) {
158
+ super ( props ) ;
159
+ this . state = {
160
+ switchValue : true ,
161
+ colorTheme : 'Light' ,
162
+ } ;
163
+ }
164
+
165
+ render ( ) {
166
+ return (
167
+ < View testID = "welcome" style = { styles . container } >
168
+ < ScrollView contentContainerStyle = { styles . contentContainer } >
169
+ < Text style = { styles . details } >
170
+ Hello { "Instabug's" } awesome user! The purpose of this application
171
+ is to show you the different options for customizing the SDK and how
172
+ easy it is to integrate it to your existing app
173
+ </ Text >
100
174
{ this . invocationEvent ( ) }
101
175
< Text style = { styles . textColor } > Set primary color </ Text >
102
176
< View style = { styles . rowView } >
@@ -181,45 +255,6 @@ export default class App extends Component<{}> {
181
255
Instabug . setPrimaryColor ( color ) ;
182
256
}
183
257
184
- showIntroMessage ( ) {
185
- Instabug . showIntroMessage ( ) ;
186
- }
187
-
188
- invoke ( ) {
189
- Instabug . show ( ) ;
190
- }
191
-
192
- showMultipleQuestionSurvey ( ) {
193
- Surveys . showSurvey ( 'ZAKSlVz98QdPyOx1wIt8BA' ) ;
194
- }
195
-
196
- showNpsSurvey ( ) {
197
- Surveys . showSurvey ( 'pcV_mE2ttqHxT1iqvBxL0w' ) ;
198
- }
199
-
200
- showFeatureRequests ( ) {
201
- FeatureRequests . show ( ) ;
202
- }
203
-
204
- sendBugReport ( ) {
205
- BugReporting . showWithOptions ( BugReporting . reportType . bug ) ;
206
- }
207
-
208
- sendCrashReport ( ) {
209
- try {
210
- throw new Error ( 'Text Handled Exception From Instabug Test App' ) ;
211
- } catch ( Exception ) {
212
- CrashReporting . reportJSException ( Exception ) ;
213
- alert ( 'Crash report Sent!' ) ;
214
- }
215
- }
216
-
217
- sendFeedback ( ) {
218
- BugReporting . showWithOptions ( BugReporting . reportType . feedback , [
219
- BugReporting . option . emailFieldHidden ,
220
- ] ) ;
221
- }
222
-
223
258
changeInvocationEvent ( invocationEvent ) {
224
259
if ( invocationEvent === 'Shake' )
225
260
BugReporting . setInvocationEvents ( [ BugReporting . invocationEvent . shake ] ) ;
@@ -238,16 +273,6 @@ export default class App extends Component<{}> {
238
273
if ( invocationEvent === 'None' )
239
274
BugReporting . setInvocationEvents ( [ BugReporting . invocationEvent . none ] ) ;
240
275
}
241
-
242
- startNewConversation ( ) {
243
- BugReporting . showWithOptions ( BugReporting . reportType . question ) ;
244
- }
245
-
246
- showUnreadMessagesCount ( ) {
247
- Replies . getUnreadRepliesCount ( count => {
248
- alert ( 'Messages: ' + count ) ;
249
- } ) ;
250
- }
251
276
}
252
277
buttonColor = function ( myColor ) {
253
278
return {
@@ -324,3 +349,14 @@ const styles = StyleSheet.create({
324
349
padding : 10 ,
325
350
} ,
326
351
} ) ;
352
+ export default function App ( ) {
353
+ const Tab = createBottomTabNavigator ( ) ;
354
+ return (
355
+ < NavigationContainer onStateChange = { Instabug . onStateChange } >
356
+ < Tab . Navigator >
357
+ < Tab . Screen name = "Home" component = { Home } />
358
+ < Tab . Screen name = "Settings" component = { Settings } />
359
+ </ Tab . Navigator >
360
+ </ NavigationContainer >
361
+ ) ;
362
+ }
0 commit comments