wix / react-native-calendars

React Native Calendar Components 🗓️ 📆
MIT License
9.5k stars 2.94k forks source link

Use custom child component rather Agenda/Timeline while using CalendarProvider #2445

Open gfhfhoo opened 6 months ago

gfhfhoo commented 6 months ago

Description

I'm trying to replace AgendaList/Timeline compoent into my custom component while using CalendarProvider and ExpandableCalendar.

Expected Behavior

Display my custom compoent after clicking different dates.

Observed Behavior

Nothing happened. The result of debugging looks like CalendarProvider is absolute even if it has been wrapped by View. (therefore the height of View is 0)

The code likes this:

MyCalendar.js

<CalendarProvider
    <ExpandableCalendar theme={calendarStyle} />
    {props.children}
</CalendarProvider>

and HomeScreen.js

<MyCalendar onChanged={(date)=>processDate(date)}>
    <MyList item={data} renderItem={renderItem} />
</MyCalendar>
gfhfhoo commented 6 months ago

Addition: a possible "bypass solution" is to add a empty View(setting its height), but I think it is not final solution.