Skip to content

Commit 17e9bb8

Browse files
committed
refactor
1 parent ec1f171 commit 17e9bb8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

example/src/screens/expandableCalendar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export default class ExpandableCalendarScreen extends Component {
157157
theme={{todayButtonTextColor: '#0059ff'}}
158158
showTodayButton
159159
disabledOpacity={0.6}
160+
// buttonTopPosition={16}
160161
>
161162
<ExpandableCalendar
162163
// horizontal={false}

src/expandableCalendar/calendarProvider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const commons = require('./commons');
1414
const UPDATE_SOURCES = commons.UPDATE_SOURCES;
1515
const iconDown = require('../img/down.png');
1616
const iconUp = require('../img/up.png');
17-
const TOP_POSITION = -65;
17+
const TOP_POSITION = 65;
1818

1919
/**
2020
* @description: Calendar context provider component
@@ -45,7 +45,7 @@ class CalendarProvider extends Component {
4545
this.state = {
4646
date: this.props.date || XDate().toString('yyyy-MM-dd'),
4747
updateSource: UPDATE_SOURCES.CALENDAR_INIT,
48-
buttonY: new Animated.Value(-props.buttonTopPosition || TOP_POSITION),
48+
buttonY: new Animated.Value(-props.buttonTopPosition || -TOP_POSITION),
4949
buttonIcon: this.getButtonIcon(props.date),
5050
disabled: false,
5151
opacity: new Animated.Value(1)
@@ -122,7 +122,7 @@ class CalendarProvider extends Component {
122122
const isToday = today === date;
123123

124124
Animated.spring(this.state.buttonY, {
125-
toValue: isToday ? 65 : -this.props.buttonTopPosition || TOP_POSITION,
125+
toValue: isToday ? TOP_POSITION : -this.props.buttonTopPosition || -TOP_POSITION,
126126
tension: 30,
127127
friction: 8,
128128
useNativeDriver: true

0 commit comments

Comments
 (0)