react-native-calendar-strip icon indicating copy to clipboard operation
react-native-calendar-strip copied to clipboard

Cannot change the dayContainerStyle height

Open GabrielDvt opened this issue 2 years ago • 2 comments

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

GabrielDvt avatar Jul 16 '23 14:07 GabrielDvt

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

Fe-souza avatar Aug 07 '23 20:08 Fe-souza

@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

Abhaychovatiya avatar Nov 09 '23 11:11 Abhaychovatiya