stephy / CalendarPicker

CalendarPicker Component for React Native
787 stars 369 forks source link

Custom bottom margin to Calendar picker #210

Open adammartiska opened 4 years ago

adammartiska commented 4 years ago

Hello, I am using this library and really like it. Only one small thing that (maybe only I) am missing - is there any prop to set container style to this calendar picker? Because by default there is some unnecessary margin added to bottom that I do not need (shown in picture). I was listing all the available props but havent find any usable prop. Thank you :) image

peacechen commented 4 years ago

The container has a top margin but doesn't set a bottom margin: https://github.com/stephy/CalendarPicker/blob/master/CalendarPicker/makeStyles.js#L35

The extra spacing is to accommodate a 6th row which can happen if the first day of the month starts on Saturday and the month has at least 30 days. Navigate to other months and you'll see the ones that have 6 rows. If that were removed, the height of the calendar would change between months. The jump could be quite drastic since the least number of rows is 4, and greatest number 6.

PRs are welcome if you'd like to add a prop to eliminate the spacer row.