Skip to content

feat(example): add buttons to sample app #1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion examples/default/src/screens/BugReportingScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import React from 'react';

import Instabug, { BugReporting, InvocationOption, ReportType } from 'instabug-reactnative';
import Instabug, {
BugReporting,
InvocationOption,
ReportType,
ExtendedBugReportMode,
WelcomeMessageMode,
} from 'instabug-reactnative';

import { ListTile } from '../components/ListTile';
import { Screen } from '../components/Screen';
import { useToast } from 'native-base';
import { Section } from '../components/Section';

export const BugReportingScreen: React.FC = () => {
const toast = useToast();
return (
<Screen>
<ListTile title="Show" onPress={() => Instabug.show()} />
Expand All @@ -15,6 +24,59 @@ export const BugReportingScreen: React.FC = () => {
onPress={() => BugReporting.show(ReportType.feedback, [InvocationOption.emailFieldHidden])}
/>
<ListTile title="Ask a Question" onPress={() => BugReporting.show(ReportType.question, [])} />
<ListTile
title="Enable extended bug report with required fields"
onPress={() =>
BugReporting.setExtendedBugReportMode(ExtendedBugReportMode.enabledWithRequiredFields)
}
/>
<ListTile
title="Enable extended bug report with optional fields"
onPress={() =>
BugReporting.setExtendedBugReportMode(ExtendedBugReportMode.enabledWithOptionalFields)
}
/>
<ListTile
title="Disable session profiler"
onPress={() => Instabug.setSessionProfilerEnabled(true)}
/>
<ListTile
title="Welcome message Beta"
onPress={() => Instabug.showWelcomeMessage(WelcomeMessageMode.beta)}
/>
<ListTile
title="Welcome message Live"
onPress={() => Instabug.showWelcomeMessage(WelcomeMessageMode.live)}
/>

<Section title="Handlers">
<ListTile
title="On invocation add tag"
onPress={() =>
BugReporting.onInvokeHandler(function () {
Instabug.appendTags(['Invocation Handler tag1']);
})
}
/>
<ListTile
title="On submission show toast message"
onPress={() =>
Instabug.onReportSubmitHandler(() => {
toast.show({
description: 'Submission succeeded',
});
})
}
/>
<ListTile
title="On dismissing turn floating to red"
onPress={() =>
BugReporting.onSDKDismissedHandler(function () {
Instabug.setPrimaryColor('#FF0000');
})
}
/>
</Section>
</Screen>
);
};