-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathWeekDaysLabels.js
45 lines (37 loc) · 993 Bytes
/
WeekDaysLabels.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
/**
* Persian Calendar Picker Component
*
* Copyright 2016 Reza (github.com/rghorbani)
* Licensed under the terms of the MIT license. See LICENSE file in the project root for terms.
*/
'use strict';
const React = require('react');
const PropTypes = require('prop-types');
const {
Text,
View,
} = require('react-native');
const styles = require('./style');
const {
WEEKDAYS,
} = require('./util');
class WeekDaysLabels extends React.Component {
static propTypes: {
screenWidth: PropTypes.number,
textStyle: Text.propTypes.style
};
constructor(props) {
super(props);
this.DAY_WIDTH = (this.props.screenWidth - 16) / 7;
}
render() {
let labels = (this.props.weekdays || WEEKDAYS).map((day, key) => { return <Text key={key} style={[styles.dayLabels, this.props.textStyle]}>{day}</Text>; });
labels.reverse();
return (
<View style={styles.dayLabelsWrapper}>
{labels}
</View>
);
}
}
module.exports = WeekDaysLabels;