forked from MayeuldP/MovieProject-React-Native-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.android.js
140 lines (127 loc) · 3.12 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
Alert,
Navigator,
View
} from 'react-native';
//var REQUEST_URL = 'https://raw.githubusercontent.com/facebook/react-native/master/docs/MoviesExample.json';
var API_KEY = '7waqfqbprs7pajbz28mqf6vz';
var API_URL = 'http://api.rottentomatoes.com/api/public/v1.0/lists/movies/upcoming.json';
var PAGE_SIZE = 25;
var PARAMS = '?apikey=' + API_KEY + '&page_limit=' + PAGE_SIZE;
var REQUEST_URL = API_URL + PARAMS;
var SplashPage = require('./SplashPage');
var Movie = require('./Movie');
var MovieSelected = require('./MovieSelected');
var Credits = require('./Credits');
var Maps = require('./Maps');
var Upcomming = require('./Upcomming');
class MovieProject extends Component {
render() {
console.ignoredYellowBox = ['Warning: ReactNative.createElement'];
return (
<Navigator
initialRoute={{
id: 'SplashPage',
}}
//navigator={this.props.navigator}
renderScene={this.renderScene.bind(this)}
configureScene={(route) => {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FadeAndroid;
}}
/>
);
}
renderScene(route, navigator)
{
var routeId = route.id;
var routename = route.name;
if (routeId === 'SplashPage')
{
return ( <SplashPage
navigator={navigator} />
);
}
if (routeId === 'Movie')
{
return (<Movie
navigator={navigator}
film={route.film}/>
);
}
if (routeId === 'MovieSelected')
{
return (<MovieSelected
navigator={navigator}
film={route.film}/>
);
}
if (routeId === 'Credits')
{
return (<Credits
navigator={navigator}/>);
}
if (routeId === 'Maps')
{
return (<Maps
navigator={navigator}/>);
}
if (routeId === 'Upcomming')
{
return (<Upcomming
navigator={navigator}/>);
}
}
renderLoadingView() {
return (
<View style={styles.container}>
<Text>
Loading movies...
</Text>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
rightContainer: {
flex: 1,
},
thumbnail: {
width: 53,
height: 81,
},
title: {
fontSize: 20,
marginBottom: 8,
textAlign: 'center',
},
year: {
textAlign: 'center',
},
listView: {
paddingTop: 20,
backgroundColor: '#F5FCFF',
},
toolbar: {
height: 56,
backgroundColor: '#e9eaed',
},
});
AppRegistry.registerComponent('MovieProject', () => MovieProject);