-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ios.js
More file actions
42 lines (38 loc) · 992 Bytes
/
index.ios.js
File metadata and controls
42 lines (38 loc) · 992 Bytes
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
// Import some code we need
var Moment = require('moment');
var React = require('react-native');
var AppRegistry = React.AppRegistry;
var Text = React.Text;
var View = React.View;
var StyleSheet = React.StyleSheet;
var DayItem = require('./src/day-item');
// Create a react component
var Weekdays = React.createClass({
render: function() {
return <View style={styles.container}>
{this.days()}
</View>
},
days: function() {
var daysItems = [];
for(var i = 0; i < 7; i++){
var day = Moment().add(i, 'days').format('dddd');
daysItems.push(
<DayItem day={day} daysUntil={i} />
)
}
return daysItems
}
});
// Style the React component
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center', // Moves stuff height wise
alignItems: 'center' // Moves stuff width wise
}
});
// Show the react component on the screen
AppRegistry.registerComponent('weekdays', function() {
return Weekdays
});