react-native-calendars: CalenderList in Agenda component doesn't show / render current week until scroll or choosing another date
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
:
- iOS Simulator iPhone 6:
- iPhone’s 7, X:
Screenshot
Thanks.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (3 by maintainers)
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(() => {
}
Still reproduced
Hi Now it started giving me red screen with “Can’t find variable: calendarHeight”, maybe because of this hack? The app crashes. Thanks.
Hi I have the same problem, I thought is was based on an element above it with a dynamic height, that pushed down the “frame” of the day selection, but the content remained at its original position. Is there a way to trigger a redraw? Thanks.
EDIT: the temporary solution of the timeout worked for me. thanks.