Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Calendar Period Marking with Full Round Corners

please refer to the below calendar image.

full round corners with period marking

i used react-native-calendars npm library and now i want to achieve it as above.

please ignore the dots marking only consider start and end date with period marking

however i achieved only half cornered start and end date with period marking. please refer to the below image.

half cornered start and end date image

now i need to fully round the start and end date with react-native-calendars. anyone please help me for achieve this. is it possible with this library? or is there any react native related library to achieve this?

like image 879
Vidurajith Darshana Avatar asked Dec 20 '25 04:12

Vidurajith Darshana


1 Answers

finally found a solution. but have to modify the node modules, so remember to add the changes to read me. then others can also use those.

go to the this file. node_modules/react-native-calendars/src/calendar/day/period/index.js

comment below lines.

filters = (
....
)

add below lines.

        const customStyles = {
        dayStyles: {backgroundColor: '#BEB1D7',width: 20,height: 
          26,position:'absolute'}
       }
       fillers = (
        <View style={[this.style.fillers, fillerStyle]}>
          {this.props.marking.endingDay ?<View style={customStyles.dayStyles}></View> 
          : null}

          <View style={[this.style.leftFiller, leftFillerStyle]}/>
          <View style={[this.style.rightFiller, rightFillerStyle]}/>

          {this.props.marking.startingDay ?<View style={[customStyles.dayStyles, 
           {marginLeft: 15}]}></View> : null}
        </View>
      );

note that customStyles you can edit.

the node_modules related phases now finish.

now move to your calendar component and override the styles of original calendar using their advanced styling guide. i did as mentioned below.

calendarTheme = { 
         'stylesheet.day.period': {
            wrapper: {
                alignItems: 'center',
                alignSelf: 'stretch',
                marginLeft: -2,
                borderRadius: 2,
                overflow: 'hidden'
            },
            leftFiller: {
                height: 26,
                flex: 1,
                marginLeft: 50
            }
        }
}
like image 92
Vidurajith Darshana Avatar answered Dec 21 '25 18:12

Vidurajith Darshana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!