Skip to content

Commit 9a1c0d0

Browse files
committed
Merge branch 'master' of github.com:wix/react-native-calendars into infra/ExpandableCalendar_to_function
# Conflicts: # example/src/screens/index.ts # tsconfig.json
2 parents 27d805a + d172af1 commit 9a1c0d0

File tree

9 files changed

+25
-18
lines changed

9 files changed

+25
-18
lines changed
File renamed without changes.

example/src/screens/calendars.tsx renamed to example/src/screens/calendarScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import testIDs from '../testIDs';
55

66
const INITIAL_DATE = '2020-02-02';
77

8-
const CalendarsScreen = () => {
8+
const CalendarScreen = () => {
99
const [selected, setSelected] = useState(INITIAL_DATE);
1010

1111
const onDayPress: CalendarProps['onDayPress'] = useCallback(day => {
@@ -484,7 +484,7 @@ const CalendarsScreen = () => {
484484
);
485485
};
486486

487-
export default CalendarsScreen;
487+
export default CalendarScreen;
488488

489489
const styles = StyleSheet.create({
490490
calendar: {

example/src/screens/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {Navigation} from 'react-native-navigation';
22

3-
import MenuScreen from './menu';
4-
import CalendarsScreen from './calendars';
5-
import AgendaScreen from './agenda';
3+
import MenuScreen from './menuScreen';
4+
import CalendarsScreen from './calendarScreen';
5+
import AgendaScreen from './agendaScreen';
66
import CalendarsList from './calendarsList';
77
import HorizontalCalendarList from './horizontalCalendarList';
8-
import ExpandableCalendarScreen from './ExpandableCalendarScreen';
9-
import TimelineCalendar from './timelineCalendar';
8+
import ExpandableCalendar from './expandableCalendar';
9+
import TimelineCalendar from './timelineCalendarScreen';
1010

1111
export function registerScreens() {
1212
Navigation.registerComponent('Menu', () => MenuScreen);
File renamed without changes.

src/agenda/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ export default class Agenda extends Component<AgendaProps, State> {
114114
calendarIsReady: false,
115115
calendarScrollable: false,
116116
firstReservationLoad: false,
117-
selectedDay: this.getSelectedDate(),
118-
topDay: this.getSelectedDate()
117+
selectedDay: this.getSelectedDate(props.selected),
118+
topDay: this.getSelectedDate(props.selected)
119119
};
120120

121121
this.currentMonth = this.state.selectedDay.clone();
@@ -135,9 +135,13 @@ export default class Agenda extends Component<AgendaProps, State> {
135135
}
136136

137137
componentDidUpdate(prevProps: AgendaProps, prevState: State) {
138-
const newSelectedDate = this.getSelectedDate();
138+
const newSelectedDate = this.getSelectedDate(this.props.selected);
139+
139140
if (!sameDate(newSelectedDate, prevState.selectedDay)) {
140-
this.setState({selectedDay: newSelectedDate});
141+
const prevSelectedDate = this.getSelectedDate(prevProps.selected);
142+
if (!sameDate(newSelectedDate, prevSelectedDate)) {
143+
this.setState({selectedDay: newSelectedDate});
144+
}
141145
} else if (!prevProps.items) {
142146
this.loadReservations(this.props);
143147
}
@@ -150,8 +154,7 @@ export default class Agenda extends Component<AgendaProps, State> {
150154
return null;
151155
}
152156

153-
getSelectedDate() {
154-
const {selected} = this.props;
157+
getSelectedDate(selected?: string) {
155158
return selected ? parseDate(selected) : new XDate(true);
156159
}
157160

src/calendar/header/style.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {StyleSheet, Platform} from 'react-native';
22
import * as defaultStyle from '../../style';
33
import {Theme} from '../../types';
4+
import constants from '../../commons/constants';
45

56
export default function (theme: Theme = {}) {
67
const appStyle = {...defaultStyle, ...theme};
8+
const flipStyle = constants.isRTL ? {transform: [{scaleX: -1}]} : undefined;
79
return StyleSheet.create({
810
header: {
911
flexDirection: 'row',
@@ -28,6 +30,7 @@ export default function (theme: Theme = {}) {
2830
...appStyle.arrowStyle
2931
},
3032
arrowImage: {
33+
...flipStyle,
3134
tintColor: appStyle.arrowColor,
3235
...Platform.select({
3336
web: {
@@ -37,6 +40,7 @@ export default function (theme: Theme = {}) {
3740
})
3841
},
3942
disabledArrowImage: {
43+
...flipStyle,
4044
tintColor: appStyle.disabledArrowColor
4145
},
4246
// @ts-expect-error

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export {default as asCalendarConsumer} from './expandableCalendar/asCalendarCons
1717
export {default as Timeline} from './timeline/Timeline';
1818
export type {TimelineProps, TimelineEventProps, TimelinePackedEventProps} from './timeline/Timeline';
1919
export {default as TimelineList} from './timeline-list';
20-
export {TimelineListProps, TimelineListRenderItemInfo} from './timeline-list';
20+
export type {TimelineListProps, TimelineListRenderItemInfo} from './timeline-list';
2121
export {default as CalendarUtils} from './services';
2222
export type {DateData, AgendaEntry, AgendaSchedule} from './types';
2323
export {default as LocaleConfig} from 'xdate';

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
// "include": ["src/calendar/day/basic", "src/global.d.ts"],
2626
"include": [
2727
"src/**/*",
28-
"example/src/screens/calendars.tsx",
29-
"example/src/screens/ExpandableCalendarScreen.tsx",
30-
"example/src/screens/agenda.tsx",
31-
"example/src/screens/timelineCalendar.tsx"
28+
"example/src/screens/calendarScreen.tsx",
29+
"example/src/screens/expandableCalendarScreen.tsx",
30+
"example/src/screens/agendaScreen.tsx",
31+
"example/src/screens/timelineCalendarScreen.tsx"
3232
],
3333
"exclude": ["node_modules", "testUtils"]
3434
}

0 commit comments

Comments
 (0)