react-day-picker
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -28,4 +28,7 @@ "use strict"; | ||
onDayMouseEnter: React.PropTypes.func, | ||
onDayMouseLeave: React.PropTypes.func | ||
onDayMouseLeave: React.PropTypes.func, | ||
onNextMonthTouchTap: React.PropTypes.func, | ||
onPrevMonthTouchTap: React.PropTypes.func | ||
}, | ||
@@ -62,7 +65,13 @@ | ||
handleNextTouchTap: function (e) { | ||
this.setState({ month: this.state.month.add(1, "month") }); | ||
var _this = this; | ||
this.setState({ month: this.state.month.add(1, "month") }, function () { | ||
_this.props.onNextMonthTouchTap && _this.props.onNextMonthTouchTap(_this.state.month); | ||
}); | ||
}, | ||
handlePrevTouchTap: function (e) { | ||
this.setState({ month: this.state.month.subtract(1, "month") }); | ||
var _this2 = this; | ||
this.setState({ month: this.state.month.subtract(1, "month") }, function () { | ||
_this2.props.onPrevMonthTouchTap && _this2.props.onPrevMonthTouchTap(_this2.state.month); | ||
}); | ||
}, | ||
@@ -103,3 +112,3 @@ | ||
renderWeeks: function () { | ||
var _this = this; | ||
var _this3 = this; | ||
return weeks(this.state.month).map(function (week, i) { | ||
@@ -109,3 +118,3 @@ return React.createElement("tr", { | ||
className: "daypicker__week" | ||
}, _this.renderDays(week)); | ||
}, _this3.renderDays(week)); | ||
}); | ||
@@ -126,3 +135,3 @@ }, | ||
renderDays: function (week) { | ||
var _this2 = this; | ||
var _this4 = this; | ||
var firstDay = week[0]; | ||
@@ -132,3 +141,3 @@ var lastDay = week[week.length - 1]; | ||
var days = week.map(function (day) { | ||
return _this2.renderDay(day); | ||
return _this4.renderDay(day); | ||
}); | ||
@@ -135,0 +144,0 @@ |
@@ -37,2 +37,6 @@ import React from 'react'; | ||
handleMonthChange(month) { | ||
console.log('Switched to ' + month.format('MMMM YYYY')); | ||
}, | ||
render() { | ||
@@ -74,2 +78,4 @@ | ||
modifiers={modifiers} | ||
onNextMonthTouchTap={this.handleMonthChange} | ||
onPrevMonthTouchTap={this.handleMonthChange} | ||
onDayTouchTap={this.handleDayTouchTap} /> | ||
@@ -76,0 +82,0 @@ |
{ | ||
"name": "react-day-picker", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Minimalistic date picker component for React and momentjs.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/DayPicker.js", |
@@ -120,1 +120,6 @@ # react-day-picker | ||
Use this attribute to add an handler when the mouse leaves a day element. | ||
#### onPrevMonthTouchTap `function(month)` | ||
#### onNextMonthTouchTap `function(month)` | ||
Use this attribute to add an handler when the user switch to the previous/next month. |
@@ -17,3 +17,6 @@ import React from 'react'; | ||
onDayMouseEnter: React.PropTypes.func, | ||
onDayMouseLeave: React.PropTypes.func | ||
onDayMouseLeave: React.PropTypes.func, | ||
onNextMonthTouchTap: React.PropTypes.func, | ||
onPrevMonthTouchTap: React.PropTypes.func | ||
@@ -51,7 +54,13 @@ }, | ||
handleNextTouchTap(e) { | ||
this.setState({ month: this.state.month.add(1, 'month') }); | ||
this.setState({ month: this.state.month.add(1, 'month') }, () => { | ||
this.props.onNextMonthTouchTap | ||
&& this.props.onNextMonthTouchTap(this.state.month); | ||
}); | ||
}, | ||
handlePrevTouchTap(e) { | ||
this.setState({ month: this.state.month.subtract(1, 'month') }); | ||
this.setState({ month: this.state.month.subtract(1, 'month') }, () => { | ||
this.props.onPrevMonthTouchTap | ||
&& this.props.onPrevMonthTouchTap(this.state.month); | ||
}); | ||
}, | ||
@@ -58,0 +67,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2283496
27547
124