@@ -24,6 +24,8 @@ import Instabug, {
2424 CrashReporting ,
2525 Replies ,
2626} from 'instabug-reactnative' ;
27+ import { NavigationContainer } from '@react-navigation/native' ;
28+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' ;
2729
2830const instructions = Platform . select ( {
2931 ios : 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu' ,
@@ -32,7 +34,7 @@ const instructions = Platform.select({
3234 'Shake or press menu button for dev menu' ,
3335} ) ;
3436
35- export default class App extends Component < { } > {
37+ class Home extends Component < { } > {
3638 constructor ( props ) {
3739 super ( props ) ;
3840 this . state = {
@@ -97,6 +99,78 @@ export default class App extends Component<{}> {
9799 onPress = { ( ) => this . showUnreadMessagesCount ( ) } >
98100 < Text style = { styles . text } > GET UNREAD MESSAGES COUNT </ Text >
99101 </ 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 >
100174 { this . invocationEvent ( ) }
101175 < Text style = { styles . textColor } > Set primary color </ Text >
102176 < View style = { styles . rowView } >
@@ -181,45 +255,6 @@ export default class App extends Component<{}> {
181255 Instabug . setPrimaryColor ( color ) ;
182256 }
183257
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-
223258 changeInvocationEvent ( invocationEvent ) {
224259 if ( invocationEvent === 'Shake' )
225260 BugReporting . setInvocationEvents ( [ BugReporting . invocationEvent . shake ] ) ;
@@ -238,16 +273,6 @@ export default class App extends Component<{}> {
238273 if ( invocationEvent === 'None' )
239274 BugReporting . setInvocationEvents ( [ BugReporting . invocationEvent . none ] ) ;
240275 }
241-
242- startNewConversation ( ) {
243- BugReporting . showWithOptions ( BugReporting . reportType . question ) ;
244- }
245-
246- showUnreadMessagesCount ( ) {
247- Replies . getUnreadRepliesCount ( count => {
248- alert ( 'Messages: ' + count ) ;
249- } ) ;
250- }
251276}
252277buttonColor = function ( myColor ) {
253278 return {
@@ -324,3 +349,14 @@ const styles = StyleSheet.create({
324349 padding : 10 ,
325350 } ,
326351} ) ;
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