Skip to content

Commit f41adf1

Browse files
committed
Calendar demo screen - move items load to componentDidMount
1 parent 08c9fc8 commit f41adf1

File tree

2 files changed

+5
-3
lines changed
  • demo/src/screens/incubatorScreens/IncubatorCalendarScreen
  • src/incubator/Calendar

2 files changed

+5
-3
lines changed

demo/src/screens/incubatorScreens/IncubatorCalendarScreen/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export default class CalendarScreen extends Component {
1212
showLoader: false
1313
};
1414

15-
constructor(props: any) {
16-
super(props);
15+
componentDidMount(): void {
1716
this.loadEvents(this.state.date);
1817
}
1918

src/incubator/Calendar/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
9595
setHeaderHeight,
9696
headerHeight
9797
};
98-
}, [processedData]);
98+
}, [processedData, staticHeader, showExtraDays, firstDayOfWeek]);
9999

100100
/** Pages reload */
101101

@@ -135,6 +135,7 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
135135
const index = getItemIndex(selected);
136136

137137
if (shouldAddPages(index)) {
138+
console.log('Add new pages');
138139
runOnJS(addPages)(index);
139140
} else if (lastUpdateSource.value !== UpdateSource.MONTH_SCROLL) {
140141
if (previous && !isSameMonth(selected, previous)) {
@@ -143,6 +144,8 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
143144
}
144145
}, [getItemIndex]);
145146

147+
/** Events */
148+
146149
const onViewableItemsChanged = useCallback(({viewableItems}: any) => {
147150
const item = viewableItems?.[0]?.item;
148151
if (item && scrolledByUser.value) {

0 commit comments

Comments
 (0)