React-native-calendars: Agenda's CalendarList Header is invisible on initial render, visible only after scrolling or opening CalendarList

Created on 8 Jun 2018  ·  7Comments  ·  Source: wix/react-native-calendars

Description

Agenda component's CalendarList header is not displaying dates at the top, on initial render. The header dates only become visible when opening the CalendarList and manually selecting a date, or scrolling down the Agenda components days until I scroll to a day on the next row of weeks (when the srcollAmount is adjusted in CalendarList's scrollToDay.

This occurs in our app on iOS and android devices, but does not occur in the Agenda example listed.

Expected Behavior

The Agenda component should render the CalendarList's header on initial load, without any user interaction.

Observed Behavior

CalendarList is not rendering until specific user interaction- whether the current day has an event or is an empty array.

Likely similar to #405 or #485 , but while issue was marked as solved in v1.19.2, it persists and the temporary solution does not work.

Environment

  1. Phone/emulator/simulator & version:
    Simulator iOS 11.2 - iPhone 6s

Screenshot

On inital load:

screen shot 2018-06-07 at 3 27 38 pm

After scrolling to new week:

screen shot 2018-06-07 at 3 27 55 pm

Reproducible Demo

Below is an example of the data we are feeding the items prop, for both empty and non-empty dates. Function loadScheduleItems makes a request to our database to fetch events for the current month, the previous month, and the next month-- the results are served in an object or arrays, like below:

const schedules.events = { 2018-05-01: [], 2018-05-02: [], 2018-05-02: [ {company: 'string', endDate : {Moment object}, id: 'string', imageURL: 'string', startDate: {Moment object}, ] };

<Agenda
      items={schedules.events}
      loadItemsForMonth={this.loadScheduleItems}
      selected={startingDate.toDate()}
      renderItem={this.renderEvent}
      renderEmptyDate={this.renderEmptyDate}
      rowHasChanged={this.rowHasChanged}
  />
stale

Most helpful comment

The header is not visible if pastScrollRange = {1} and futureScrollRange = {1} for previous and next months only in case of android.
screen shot 2018-08-29 at 5 11 05 pm

All 7 comments

The header is not visible if pastScrollRange = {1} and futureScrollRange = {1} for previous and next months only in case of android.
screen shot 2018-08-29 at 5 11 05 pm

I found that scroll view cannot scroll to negative offset like ios. I fixed it by margin top in android when having negative offset and set it to 0 when offset > 0. i have forked and fixed it: https://github.com/vuthanhtrung0504/react-native-calendars

@vuthanhtrung0504 can you please share with me the changes to fix this or share me the commit name/id.

@asaxena1237 same issue with IOS

@vuthanhtrung0504 existing code is changed. can you please take a look again

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srichallamalla935 picture srichallamalla935  ·  4Comments

Yandamuri picture Yandamuri  ·  4Comments

filippoitaliano picture filippoitaliano  ·  3Comments

idlework picture idlework  ·  4Comments

ercpereda picture ercpereda  ·  4Comments