Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't render empty dates #2481

Open
vagnereix opened this issue Jun 14, 2024 · 2 comments
Open

Don't render empty dates #2481

vagnereix opened this issue Jun 14, 2024 · 2 comments

Comments

@vagnereix
Copy link

Description

I'm trying to render empty views for my empty dates and I can't scroll to other days normally, just want to "skip" all empty dates showing only the filled days.

Expected Behavior

  • Skip "24" day because has no data to render:

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Device/emulator/simulator & OS version: Android Emulator - Pixel 8 API 34

Reproducible Demo

  • When I try to render a empty view like <View style={{ height: 0 }} /> for renderEmptyDate and renderDay props:
react-native-calendars.empty.dates.webm
@NguyenVuAnh1996
Copy link

I am not from the team who made this component,
but I am having trouble with renderDay, which is a prop of
Since I see that no-one replied to your issue and it seems that you can make a custom Day section so you could do all the styling,
can you tell me how you make that custom component?

The problem I have with renderDay={(day, item) => {}} is that it only gives me one item instead of a list of item.

Thank you very much in advance.

@bravesoul349
Copy link
Contributor

bravesoul349 commented Aug 3, 2024

Inspecting the code, I found out that the custom renderSectionHeader is called with the section's title only instead of passing the complete section object. If we have access to the full section, we can check if the data is empty and skip the date or section header for empty objects.

return renderSectionHeader(title);

For a workaround, you can create a patch to replace line 216 with return renderSectionHeader(info?.section)
#2502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants