-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.android.js
109 lines (101 loc) · 3.46 KB
/
index.android.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
Navigator,
BackAndroid
} from 'react-native';
import BackgroundImage from './app/containers/BackgroundImage';
import Home from './app/views/Home';
import Memorize from './app/views/Memorize';
import Game from './app/views/Game';
import Timed from './app/views/Timed';
import Quiz from './app/views/Quiz';
import Learn from './app/views/Learn';
import Settings from './app/views/Settings';
import Donate from './app/views/Donate';
import About from './app/views/About';
import Records from './app/views/Records';
import LearnPage from './app/views/LearnPage';
export default class piday extends Component {
componentWillUnmount(){
BackAndroid.removeEventListener('hardwareBackPress');
}
renderScene(route, navigator) {
BackAndroid.addEventListener('hardwareBackPress', () => {
if (navigator && navigator.getCurrentRoutes().length > 1) {
navigator.pop();
return true;
}
return false;
});
if(route.name == 'Home') {
return <Home navigator={navigator} />;
}
if(route.name == 'Memorize') {
return <Memorize navigator={navigator} />;
}
if(route.name == 'Game') {
return <Game navigator={navigator} />;
}
if(route.name == 'Timed') {
return <Timed navigator={navigator} />;
}
if(route.name == 'Quiz') {
return <Quiz navigator={navigator} />;
}
if(route.name == 'Learn') {
return <Learn navigator={navigator} />;
}
// Learn Page Sections
if(route.name == 'Whatispi') {
return <LearnPage navigator={navigator} title={'What is Pi?'} />;
}
if(route.name == 'Whatispiday') {
return <LearnPage navigator={navigator} title={'What is Pi day?'} />;
}
if(route.name == 'Propertiesofpi') {
return <LearnPage navigator={navigator} title={'The Properties of Pi'} />;
}
if(route.name == 'Historyofpi') {
return <LearnPage navigator={navigator} title={'The History of Pi'} />;
}
if(route.name == 'Computingdigits') {
return <LearnPage navigator={navigator} title={'Computing Digits of Pi'} />;
}
if(route.name == 'Pimathsci') {
return <LearnPage navigator={navigator} title={'Pi in Math & Science'} />;
}
if(route.name == 'Pipop') {
return <LearnPage navigator={navigator} title={'Pi in Popular Culture'} />;
}
if(route.name == 'Glossary') {
return <LearnPage navigator={navigator} title={'Glossary'} />;
}
if(route.name == 'Settings') {
return <Settings navigator={navigator} />;
}
if(route.name == 'Records') {
return <Records navigator={navigator} />;
}
if(route.name == 'Donate') {
return <Donate navigator={navigator} />;
}
if(route.name == 'About') {
return <About navigator={navigator} />;
}
}
render() {
return (
<Navigator
initialRoute={{title: 'Home', name: 'Home', component: Home}}
renderScene={this.renderScene}
/>
);
}
}
AppRegistry.registerComponent('piday', () => piday);