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.

CalenderList in Agenda component doesn't show / render current week until scroll or choosing another date

See original GitHub issue

Description

On initial load of the Agenda component the CalendarList component on top doesn’t show until I scroll the items rendered below in the scrollview or after opening the CalendarList via the knob and manually selecting a date. Important to mention this happened only in iOS devices and it happened to the included Agenda example too (https://github.com/wix/react-native-calendars/blob/master/example/src/screens/agenda.js).

Expected Behavior

The CalendarList should show the week of the current selected date without user interaction on initial load

Observed Behavior

The CalendarList doesn’t show at all until user interacts. Observed only in iOS.

Environment

  • react-native-calendars@1.17.4:
  • react-native-cli: 2.0.1:
  • react-native: 0.49.3:
  1. iOS Simulator iPhone 6:
  2. iPhone’s 7, X:

Screenshot

simulator screen shot - iphone 6 - 2018-03-27 at 19 32 30

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
miladi7commented, Apr 13, 2018

in file /src/calender-list/index.js I wrapped the body of scrollToDay (line 70) function inside a settimeout, and it works ilke a charm in both ios and android:

scrollToDay(d, offset, animated) { setTimeout(() => {

  const day = parseDate(d);
  const diffMonths = Math.round(this.state.openDate.clone().setDate(1).diffMonths(day.clone().setDate(1)));
  let scrollAmount = (calendarHeight * this.pastScrollRange) + (diffMonths * calendarHeight) + (offset || 0);
  let week = 0;
  const days = dateutils.page(day, this.props.firstDay);
  for (let i = 0; i < days.length; i++) {
    week = Math.floor(i / 7);
    if (dateutils.sameDate(days[i], day)) {
      scrollAmount += 46 * week;
      break;
    }
  }
  this.listView.scrollToOffset({offset: scrollAmount, animated});
}, 10);

}

4reactions
whalemarecommented, Sep 30, 2019

Still reproduced

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Calendar Agenda week view not rendering ...
There two things that you can do: Update the version "react-native-calendars": "1.220.0" The weird scrolling behaviour of the header when ...
Read more >
Create customized and shareable calendars in React Native
CalendarList : A modern, stylish component that renders a semi-infinite, scrollable calendar list; Agenda : A complex calendar component helps ...
Read more >
react-native-calendars-infinite-scroll - npm package - Snyk
An advanced agenda component that can display interactive listings for calendar day items. <Agenda // the list of items that have to be ......
Read more >
Various Customizable React Native Calendar Components
import { Calendar, CalendarList, Agenda } from 'react-native-calendars'; ... Default = false hideDayNames={true} // Show week numbers to the left.
Read more >
Calendar-screen template in canvas apps - Power Apps
Users can select a date from a calendar and scroll through a list of ... You can also add other template-based screens that...
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