-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.js
53 lines (46 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import App from './app/App'
import Blank from './app/Blank'
import { ReactRegistry, Garden, Navigator } from 'hybrid-navigation'
import * as Sentry from '@sentry/react-native'
import { ENVIRONMENT, APPLICATION_ID, VERSION_NAME, VERSION_CODE, COMMIT_SHORT_SHA, CI } from './app/AppInfo'
import { Platform } from 'react-native'
// 配置 Sentry
if (CI) {
// 只有通过 CI 打的包,才集成 Sentry
Sentry.init({
dsn: 'https://[email protected]/1446147',
enableAutoSessionTracking: true,
environment: ENVIRONMENT,
release: `${APPLICATION_ID}@${VERSION_NAME}+${VERSION_CODE}`,
dist: `${VERSION_CODE}`,
beforeBreadcrumb: breadcrumb => {
if (breadcrumb.data?.logger) {
delete breadcrumb.data
}
return breadcrumb
},
beforeSend: event => {
if (event.breadcrumbs && Platform.OS === 'android') {
delete event.breadcrumbs
}
return event
},
})
Sentry.setTag('commit', COMMIT_SHORT_SHA)
}
// 配置全局样式
Garden.setStyle({
topBarStyle: 'dark-content',
})
// 重要必须
ReactRegistry.startRegisterComponent()
// 注意,你的每一个页面都需要注册
ReactRegistry.registerComponent('App', () => App)
ReactRegistry.registerComponent('Blank', () => Blank)
// 重要必须
ReactRegistry.endRegisterComponent()
Navigator.setRoot({
stack: {
children: [{ screen: { moduleName: 'App' } }],
},
})