Skip to content

Expandable calendar invisible #2722

@OscarBlackbullion

Description

@OscarBlackbullion

Hi. I'm having an issue with the ExpandableCalendar component. I am using the latest version (1.1313.0).

For some reason, on initial render of my screen the calendar is invisible. On inspect, I can see that the entire ExpandableCalendar component's opacity is set to 0. If I navigate away from the screen and then back, the calendar appears, so it seems to be an issue on the initial render/layout of the screen.

Here is a reproducible example:

import { format } from 'date-fns/esm';
import { Text, View } from 'react-native';
import { CalendarProvider, ExpandableCalendar } from 'react-native-calendars';
import { DayProps } from 'react-native-calendars/src/calendar/day';
import { FlatList } from 'react-native-gesture-handler';

const DummyScreen = () => {
  const date = format(new Date(), 'yyyy-MM-dd');
  return (
    <CalendarProvider date={date}>
      <ExpandableCalendar
        style={{ opacity: 1 }}
        contentContainerStyle={{ opacity: 1 }}
        dayComponent={renderDayComponent}
        firstDay={1}
      />
      <FlatList
        renderItem={(i) => (
          <View>
            <Text style={{ color: '#ffffff' }}>{i.item}</Text>
          </View>
        )}
        data={[1, 2, 3]}
      />
    </CalendarProvider>
  );
};

function renderDayComponent({ children }: DayProps) {
  return <Text style={{ color: '#ffffff' }}>{children}</Text>;
}

export default DummyScreen;

I have also included some screenshots to demonstrate the issue:
Image

Image

Any ideas why this might be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions