question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CalendarList is not rendering the past months and the ones after January 2019

See original GitHub issue

Description

I have an <Agenda /> and when I open CalendarList it is not rendering the past months and the ones after January 2019. I can scroll but all it shows is a blank screen.
I also tried to define the <CalendarList /> without the agenda but the behaviour is the same.

Expected Behavior

To render every past month and the future ones

Agenda definition

             <Agenda
                    items={this.items}
                    // current={this.state.selectedDay}
                    loadItemsForMonth={this.loadItems.bind(this)}
                    //selected={'2017-05-16'}
                    ref={(agenda) => { this.agenda = agenda; }}
                    renderItem={this.renderItem.bind(this)}
                    renderEmptyDate={this.renderEmptyDate.bind(this)}
                    rowHasChanged={this.rowHasChanged.bind(this)}
                    onCalendarToggled={this.onCalendarToggled.bind(this)}
                    onDayChange={this.onDayChange.bind(this)}
                    onDayPress={this.onDayPress.bind(this)}
                    theme={{
                        height: 300,
                        selectedDayBackgroundColor: '#42B5A0',
                        textDayFontSize: 20,
                        arrowColor: 'black',
                        monthTextColor: 'black',
                        textMonthFontSize: 25,
                        textDayHeaderFontSize: 14,
                        textSectionTitleColor: '#42B5A0',
                        agendaKnobColor: '#42B5A0',
                        agendaKnobSize: 12,
                        'stylesheet.agenda.main': {
                            knobContainer: {
                                flex: 1,
                                position: 'absolute',
                                left: 0,
                                right: 0,
                                height: 19,
                                bottom: 0,
                                alignItems: 'center',
                            }
                        }
                    }}
                />

Environment

Android/iOS

simulator-screen-shot---iphone

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tigo0commented, Apr 18, 2018

It seems like the issue is with initialScrollIndex and initialNumToRender that is 10 by default (I think). I managed to fix it by setting the initialNumToRender to the amount of months past + present and manually scrolling to the correct index after the component has been mounted.

  componentDidMount() {
      requestAnimationFrame(() => {
        this.listView.scrollToIndex({animated: false, index: this.getMonthIndex(this.state.openDate)});
      });
  }

  render() {
    return (
      <FlatList
        ref={c => this.listView = c}
        initialNumToRender={this.futureScrollRange + this.pastScrollRange + 1}
        ...CalendarListProps
      />
    );
  }

0reactions
nathsimpsoncommented, Jan 6, 2020

I had a similar issue happen to me recently in an expo project. I solved it by updating the Expo SDK to the latest versions 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Calendar Agenda week view not rendering ...
The problem is whenever i select any date from the first month in calendar, it's showing me the last week of next month....
Read more >
CHANGELOG - Calendarize it!
Compatibility Fix: When using Enfold layout builder and setting a page as Venue template the venue is only showing the tag, and not...
Read more >
Using Client Side Rendering for Calendar Views
There is no file clienttemplates.js on calendar view page, so Calendar List View in SharePoint 2013 not support CSR.
Read more >
Outlook for Mac - Release notes for Beta Channel builds
Note: The support for Apple's focus filters has not been rolled out yet. ... January 10 and 12, 2022 release ... December 30,...
Read more >
BusyCal Beta Release Notes
"Day of Year" support as an alternative calendar (from Preferences > ... Accessibility option to allow showing the month abbreviation on every date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found