我想集成哨兵工具来响应本机项目崩溃报告,下面是我的代码
import { AppRegistry } from 'react-native';
import App from './App';
import { Sentry,SentryLog } from 'react-native-sentry';
import Raven from 'raven-js';
Raven
.config('https://****@sentry.io/1196569', {
logLevel: SentryLog.Debug,
})
.install();
try {
//doSomething(a[0])
} catch(e) {
Raven.captureException(e)
}
AppRegistry.registerComponent('RNCrashReport', () => App);App.js
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
View
} from 'react-native';
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text>{Hello}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});在我的App.js中,我并不是在react本机包中定义文本组件,所以这是一个错误,但是在我的哨兵仪表板错误中并没有删除,所以我不知道我缺少什么配置吗?
发布于 2018-04-27 07:12:43
我目前正在使用Sentry,但我不需要安装Raven。
我看到您一直在阅读JavaScript剖面,这就是您安装Raven的原因。但是,您应该查看反应自然剖面。
我使用react-native-sentry包并安装它,只需使用:
import { Sentry } from 'react-native-sentry'
Sentry.config('key').install();发布于 2019-01-28 09:57:06
配置所需的全部内容是
import { Sentry } from 'react-native-sentry';
Sentry.config(SENTRY_URL).install();然后,您可以使用https://docs.sentry.io/clients/react-native/config/中列出的方法
若要设置您自己的键值对,请执行以下操作:
Sentry.setExtraContext({
key: value, key: value,....
});https://stackoverflow.com/questions/50056544
复制相似问题