By adding this library to your app, the user will have the ability to shake the phone and be prompted with a menu of options.
npm install react-native-shake-to-report
or
yarn add react-native-shake-to-report
On iOS, install cocoapods:
npx pod-install
Dependencies you will need to install:
npm install react-native-device-info react-native-shake react-native-vector-icons
Prop name | Type | Description |
---|---|---|
items | array | An array of objects, each one having the "icon", "title" and "action" keys. Each object represents a menu option. |
reportIssue | function | A callback function invoked when the "Report a problem" option was selected. |
string | The reported issue will be sent to this email address when the "Report a problem" option is used. | |
reportIcon | element | Replaces the default report icon. |
dismissIcon | element | Replaces the default dismiss icon. |
containerStyle | object | Replaces the default container styles. |
listItemStyle | object | Replaces the default style of each item in the list. |
import Shkr from 'react-native-shake-to-report';
const extraMenuOptions = [{
icon: extraItemIcon,
title: "Extra Item Title",
action: handleExtraItem,
}];
const reportIssue = (deviceInfo) => {
// your code here
};
return(
<Shkr
items={extraMenuOptions}
email="example@example.com"
reportIssue={(deviceInfo) => reportIssue(deviceInfo)}
/>
);