@@ -14,6 +14,7 @@ const commons = require('./commons');
14
14
const UPDATE_SOURCES = commons . UPDATE_SOURCES ;
15
15
const iconDown = require ( '../img/down.png' ) ;
16
16
const iconUp = require ( '../img/up.png' ) ;
17
+ const TOP_POSITION = - 65 ;
17
18
18
19
/**
19
20
* @description : Calendar context provider component
@@ -31,6 +32,8 @@ class CalendarProvider extends Component {
31
32
onMonthChange : PropTypes . func ,
32
33
/** whether to show the today button */
33
34
showTodayButton : PropTypes . bool ,
35
+ /** The button top position */
36
+ buttonTopPosition : PropTypes . number ,
34
37
/** The opacity for the disabled today button (0-1) */
35
38
disabledOpacity : PropTypes . number
36
39
}
@@ -42,7 +45,7 @@ class CalendarProvider extends Component {
42
45
this . state = {
43
46
date : this . props . date || XDate ( ) . toString ( 'yyyy-MM-dd' ) ,
44
47
updateSource : UPDATE_SOURCES . CALENDAR_INIT ,
45
- buttonY : new Animated . Value ( - 65 ) ,
48
+ buttonY : new Animated . Value ( - props . buttonTopPosition || TOP_POSITION ) ,
46
49
buttonIcon : this . getButtonIcon ( props . date ) ,
47
50
disabled : false ,
48
51
opacity : new Animated . Value ( 1 )
@@ -119,7 +122,7 @@ class CalendarProvider extends Component {
119
122
const isToday = today === date ;
120
123
121
124
Animated . spring ( this . state . buttonY , {
122
- toValue : isToday ? 65 : - 65 ,
125
+ toValue : isToday ? 65 : - this . props . buttonTopPosition || TOP_POSITION ,
123
126
tension : 30 ,
124
127
friction : 8 ,
125
128
useNativeDriver : true
0 commit comments