Skip to content

Commit d6b42f3

Browse files
committed
Adding buttons to the sample app
1 parent 1468851 commit d6b42f3

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

examples/default/src/screens/BugReportingScreen.tsx

+63-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import React from 'react';
22

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';
410

511
import { ListTile } from '../components/ListTile';
612
import { Screen } from '../components/Screen';
13+
import { useToast } from 'native-base';
14+
import { Section } from '../components/Section';
715

816
export const BugReportingScreen: React.FC = () => {
17+
const toast = useToast();
918
return (
1019
<Screen>
1120
<ListTile title="Show" onPress={() => Instabug.show()} />
@@ -15,6 +24,59 @@ export const BugReportingScreen: React.FC = () => {
1524
onPress={() => BugReporting.show(ReportType.feedback, [InvocationOption.emailFieldHidden])}
1625
/>
1726
<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>
1880
</Screen>
1981
);
2082
};

0 commit comments

Comments
 (0)