-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
118 lines (112 loc) · 3.05 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import { AppRegistry } from 'react-native'
import { TabNavigator } from 'react-navigation'
import React from 'react'
import {
Icon,
} from 'native-base';
// データベース操作クラス
import DB from "./DB.js"
// 各ページ読み込み
import Measure from "./Pages/measure.js"
import Analysis from "./Pages/analysis.js"
import ManageSubject from "./Pages/manage_subject.js"
import Settings from "./Pages/settings.js"
const style = {
noForcused: {
color: "silver",
},
Forcused: {
color: "black",
},
iconSize: 20,
}
// データベース操作オブジェクト
const db = new DB()
// タブ生成
const Home = TabNavigator(
{
// 勉強時間を計測する
Page1: {
screen: () => { return <Measure db={db} /> },
navigationOptions: {
title: '時間計測',
tabBarIcon: ({focused, tintColor }) => {
return (
focused ?
<Icon name="timer" style={style.Forcused} size={style.iconSize} /> :
<Icon name="timer" style={style.noForcused} size={style.iconSize} />
)
},
}
},
// 勉強時間を集計してグラフなどの統計結果を表示する
Page2: {
screen: Analysis,
navigationOptions: {
title: 'データ統計',
tabBarIcon: ({focused, tintColor }) => {
return (
focused ?
<Icon name="md-stats" style={style.Forcused} size={style.iconSize} /> :
<Icon name="md-stats" style={style.noForcused} size={style.iconSize} />
)
},
}
},
// 科目一覧の削除、追加、変更の操作を行う
Page3: {
screen: () => { return <ManageSubject db={db} /> },
navigationOptions: {
title: '科目一覧',
tabBarIcon: ({focused, tintColor }) => {
return (
focused ?
<Icon name="paper" style={style.Forcused} size={style.iconSize} /> :
<Icon name="paper" style={style.noForcused} size={style.iconSize} />
)
},
}
},
// 各種設定画面
Page4: {
screen: Settings,
navigationOptions: {
title: '設定',
tabBarIcon: ({focused, tintColor }) => {
return (
focused ?
<Icon name="settings" style={style.Forcused} size={style.iconSize} /> :
<Icon name="settings" style={style.noForcused} size={style.iconSize} />
)
},
}
}
},
// タブのオプションを設定する
{
tabBarPosition: 'bottom',
animationEnabled: false,
swipeEnable: true,
tabBarOptions: {
inactiveTintColor: style.noForcused.color,
activeTintColor: style.Forcused.color,
style: {
backgroundColor: 'whitesmoke'
},
// ラベルの設定
showLabel: true,
labelStyle: {
fontSize: 13
},
// アイコンの設定
showIcon: true,
iconStyle: {
width: 100,
height: 100,
padding: 0,
margin: 0,
},
}
}
);
AppRegistry.registerComponent('StudyRecorder', () => Home);