BugiDev / react-native-calendar-strip

Easy to use and visually stunning calendar component for React Native.
MIT License
934 stars 325 forks source link

Cannot change the dayContainerStyle height #371

Open GabrielDvt opened 11 months ago

GabrielDvt commented 11 months ago

Hi!

I'm using this component in my project but the designer prototyped with a height, as the following:

image

But whenever I try to change the height of the dayContainerStyle, seems like there is a parent element that does not allow me to do that.

Here is a result:

WhatsApp Image 2023-07-16 at 11 12 23

This is how i'm using the component:

<View>
            <ReactNativeCalendarStrip
                locale={{
                    name: "pt-br",
                    config: {
                        months:
                            "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split(
                                "_"
                            ),
                        monthsShort:
                            "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
                        weekdays:
                            "domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split(
                                "_"
                            ),
                        weekdaysShort: "dom_seg_ter_qua_qui_sex_sáb".split("_"),
                        weekdaysMin: "Do_Se_Te_Qu_Qu_Se_Sa".split("_"),
                    },
                }}
                scrollable
                style={{
                    height: 120,
                    paddingTop: 20,
                    paddingBottom: 10,
                }}
                markedDates={props.markedDates}
                daySelectionAnimation={{
                    type: "background",
                    highlightColor: colors.primary,
                    duration: 100,
                }}
                dayContainerStyle={{
                    height: 70,
                    width: 40,
                    paddingLeft: 10,
                }}
                highlightDateNumberStyle={{ color: colors.white }}
                highlightDateNameStyle={{ color: colors.white }}
                calendarColor={colors.white}
                calendarHeaderStyle={{ color: "black" }}
                dateNumberStyle={{ color: "black" }}
                dateNameStyle={{ color: "black" }}
                iconContainer={{ flex: 0.1 }}
                onDateSelected={(data) => {
                    let auxDate = moment(data).toDate();
                    setDate(auxDate);
                }}
                selectedDate={date}
            />
        </View>

Is there a way I can reach this result with this component? thank you

Fe-souza commented 11 months ago

You try to use dayComponentHeight={80} but his limit is 80, I don't know if it will help.

I'm facing some issues with this too

Abhaychovatiya commented 7 months ago

@GabrielDvt @Fe-souza i have faced same issue and got this solution, if you want to increase the size of day Component then you should pass same height to this both prop like this.

CalendarStripe Props dayContainerStyle={{ height: 60 }} dayComponentHeight={60}.

Note : you can give maximum dayComponentHeight={80}

If you want to give more height to dayComponentHeight then you have make patch in nodemodule location ==> node_modules > react-native-calendar-strip > src >CalendarStrip.js in this screen you will find static defaultProps = { maxDayComponentSize: 80 }. you can change this defaultValue.

Note: if you are make changes in node_modules then make sure to get this library code out of node_modules otherwise when you will delete node_modules and re-install it that time you will loose this changes