Skip to content

Commit 909865d

Browse files
added react navigation tabs to demo repro-steps
1 parent f1e8d39 commit 909865d

File tree

4 files changed

+215
-54
lines changed

4 files changed

+215
-54
lines changed

InstabugSample/App.js

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -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

2830
const 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
}
252277
buttonColor = 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+
}

InstabugSample/android/app/src/main/java/com/instabugsample/MainActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.instabugsample;
22

33
import com.facebook.react.ReactActivity;
4+
import android.os.Bundle;
45

56
public class MainActivity extends ReactActivity {
67

@@ -12,4 +13,8 @@ public class MainActivity extends ReactActivity {
1213
protected String getMainComponentName() {
1314
return "InstabugSample";
1415
}
16+
@Override
17+
protected void onCreate(Bundle savedInstanceState) {
18+
super.onCreate(null);
19+
}
1520
}

InstabugSample/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
"lint": "eslint ."
1111
},
1212
"dependencies": {
13+
"@react-navigation/bottom-tabs": "^6.0.9",
14+
"@react-navigation/native": "^6.0.6",
1315
"instabug-reactnative": "../",
1416
"react": "17.0.2",
15-
"react-native": "0.66.0"
17+
"react-native": "0.66.0",
18+
"react-native-safe-area-context": "^3.3.2",
19+
"react-native-screens": "^3.8.0"
1620
},
1721
"devDependencies": {
1822
"@babel/core": "^7.15.8",

0 commit comments

Comments
 (0)