Skip to content

Commit

Permalink
fixed wring side indicator for period
Browse files Browse the repository at this point in the history
  • Loading branch information
rghorbani committed Mar 10, 2018
1 parent f1bdeb9 commit 4a7f570
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/calendar/day/period/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Day extends React.Component {
constructor(props) {
super(props);
this.theme = {...defaultStyle, ...(props.theme || {})};
this.style = styleConstructor(props.theme);
this.style = styleConstructor(props.theme, props);
this.markingStyle = this.getDrawingStyle(props.marking || []);
this.onDayPress = this.onDayPress.bind(this);
}
Expand Down Expand Up @@ -208,7 +208,14 @@ const STYLESHEET_ID = 'stylesheet.day.period';

const FILLER_HEIGHT = 34;

function styleConstructor(theme = {}) {
function styleConstructor(theme = {}, {rtl, type}) {
if (rtl === undefined) {
if (type === 'jalaali') {
rtl = true;
} else {
rtl = false;
}
}
const appStyle = {...defaultStyle, ...theme};
return StyleSheet.create({
wrapper: {
Expand All @@ -226,7 +233,7 @@ function styleConstructor(theme = {}) {
fillers: {
position: 'absolute',
height: FILLER_HEIGHT,
flexDirection: 'row',
flexDirection: rtl ? 'row-reverse' : 'row',
left: 0,
right: 0
},
Expand Down
4 changes: 3 additions & 1 deletion src/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Calendar extends React.Component {
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
firstDay: PropTypes.number,

// Date marking style [simple/period]. Default = 'simple'
// Date marking style [simple/multi-dot/period]. Default = 'simple'
markingType: PropTypes.string,

// Hide month navigation arrows. Default = false
Expand Down Expand Up @@ -211,6 +211,7 @@ class Calendar extends React.Component {
state={state}
type={this.props.type}
theme={this.props.theme}
rtl={this.props.rtl}
onPress={this.pressDay}
date={xdateToData(this.props.type, day)}
marking={this.getDateMarking(day)}
Expand Down Expand Up @@ -290,6 +291,7 @@ class Calendar extends React.Component {
<CalendarHeader
type={this.props.type}
theme={this.props.theme}
rtl={this.props.rtl}
hideArrows={this.props.hideArrows}
month={this.state.currentMonth}
addMonth={this.addMonth}
Expand Down

0 comments on commit 4a7f570

Please sign in to comment.