|
| 1 | +/** |
| 2 | + * Sample React Native App |
| 3 | + * https://github.com/facebook/react-native |
| 4 | + * @flow |
| 5 | + */ |
| 6 | + |
| 7 | +import React, { Component } from 'react'; |
| 8 | +import { |
| 9 | + Platform, |
| 10 | + StyleSheet, |
| 11 | + Text, |
| 12 | + View, |
| 13 | + TouchableOpacity |
| 14 | +} from 'react-native'; |
| 15 | + |
| 16 | +import Instabug from'instabug-reactnative'; |
| 17 | + |
| 18 | + |
| 19 | +const instructions = Platform.select({ |
| 20 | + ios: 'Press Cmd+R to reload,\n' + |
| 21 | + 'Cmd+D or shake for dev menu', |
| 22 | + android: 'Double tap R on your keyboard to reload,\n' + |
| 23 | + 'Shake or press menu button for dev menu', |
| 24 | +}); |
| 25 | + |
| 26 | +export default class App extends Component<{}> { |
| 27 | + |
| 28 | + constructor(props) { |
| 29 | + super(props); |
| 30 | + Instabug.setReportCategories("Performance","UI","Flow","Other"); |
| 31 | + Instabug.setPromptOptionsEnabled(true, true, true); |
| 32 | + } |
| 33 | + |
| 34 | + render() { |
| 35 | + return ( |
| 36 | + <View style={styles.container}> |
| 37 | + <Text style={styles.details}> |
| 38 | + Hello Instabug awesome user! The purpose of this application is to show you the different |
| 39 | + options for customizing the SDK and how easy it is to integrate it to your existing app |
| 40 | + </Text> |
| 41 | + <TouchableOpacity style={styles.button} onPress={()=>this.showIntroMessage()}> |
| 42 | + <Text style={styles.text}> SHOW INTRO MESSAGE </Text> |
| 43 | + </TouchableOpacity> |
| 44 | + <TouchableOpacity style={styles.button} onPress={()=>this.invoke()}> |
| 45 | + <Text style={styles.text}> INVOKE </Text> |
| 46 | + </TouchableOpacity> |
| 47 | + <TouchableOpacity style={styles.button} onPress={()=>this.sendBugReport()}> |
| 48 | + <Text style={styles.text}> SEND BUG REPORT </Text> |
| 49 | + </TouchableOpacity> |
| 50 | + <TouchableOpacity style={styles.button} onPress={()=>this.sendFeedback()}> |
| 51 | + <Text style={styles.text}> SEND FEEDBACK </Text> |
| 52 | + </TouchableOpacity> |
| 53 | + <TouchableOpacity style={styles.button} onPress={()=>this.startNewConversation()}> |
| 54 | + <Text style={styles.text}> START A NEW CONVERSATION </Text> |
| 55 | + </TouchableOpacity> |
| 56 | + <TouchableOpacity style={styles.button} onPress={()=>this.showUnreadMessagesCount()}> |
| 57 | + <Text style={styles.text}> GET UNREAD MESSAGES COUNT </Text> |
| 58 | + </TouchableOpacity> |
| 59 | + </View> |
| 60 | + ); |
| 61 | + } |
| 62 | + |
| 63 | + showIntroMessage() { |
| 64 | + Instabug.showIntroMessage(); |
| 65 | + } |
| 66 | + |
| 67 | + invoke() { |
| 68 | + Instabug.invoke(); |
| 69 | + } |
| 70 | + |
| 71 | + sendBugReport() { |
| 72 | + Instabug.invokeWithInvocationMode(Instabug.invocationMode.newBug); |
| 73 | + } |
| 74 | + |
| 75 | + sendFeedback() { |
| 76 | + Instabug.invokeWithInvocationMode(Instabug.invocationMode.newFeedback); |
| 77 | + } |
| 78 | + |
| 79 | + startNewConversation() { |
| 80 | + Instabug.invokeWithInvocationMode(Instabug.invocationMode.newChat); |
| 81 | + } |
| 82 | + |
| 83 | + showUnreadMessagesCount() { |
| 84 | + Instabug.getUnreadMessagesCount((count) => { |
| 85 | + alert("Messages: " + count); |
| 86 | + }); |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +const styles = StyleSheet.create({ |
| 91 | + container: { |
| 92 | + flex: 1, |
| 93 | + alignItems: 'center', |
| 94 | + backgroundColor: '#F5FCFF', |
| 95 | + }, |
| 96 | + details: { |
| 97 | + textAlign: 'center', |
| 98 | + color: '#333333', |
| 99 | + margin: 20 |
| 100 | + }, |
| 101 | + text: { |
| 102 | + color: '#FFFFFF' |
| 103 | + }, |
| 104 | + button: { |
| 105 | + marginTop: 10, |
| 106 | + backgroundColor: "#1D82DC", |
| 107 | + padding: 10, |
| 108 | + alignItems: 'center', |
| 109 | + borderRadius: 5 |
| 110 | + } |
| 111 | +}); |
0 commit comments