Skip to content

Latest commit

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

React Native Customize Selected Date

Install

npminstallreact-native-customize-selected-date--savenpminstallreact-native-vector-icons--savereact-nativelinkreact-native-vector-icons

Usage:

importReact,{Component}from'react';import{Platform,StyleSheet,Text,View,Image}from'react-native';importDateTimefrom'react-native-customize-selected-date'import_from'lodash'exportdefaultclassAppextendsComponent{constructor(props){super(props)this.state={time: ''}}onChangeDate(date){alert(date)}renderChildDay(day){if(_.includes(['2018-11-15','2018-12-10','2018-12-20'],day)){return<Imagesource={require('./src/Images/ic_lock_green.png')}style={styles.icLockRed}/>}if(_.includes(['2018-11-16','2018-12-12','2018-12-21','2018-12-18'],day)){return<Imagesource={require('./src/Images/ic_lock_red.png')}style={styles.icLockRed}/>}}render(){return(<Viewstyle={styles.container}><DateTimedate={this.state.time}changeDate={(date)=>this.onChangeDate(date)}format='YYYY-MM-DD'renderChildDay={(day)=>this.renderChildDay(day)}/></View>);}}conststyles=StyleSheet.create({container: {flex: 1,},icLockRed: {width: 13/2,height: 9,position: 'absolute',top: 2,left: 1}});

Props

PropertyTypeDescription
datePropTypes.stringDefault date
changeDatePropTypes.funcfunction call back after select date
formatPropTypes.arrayFormat date output
renderChildDayPropTypes.funcreturn child element injected to date
customWeekdaysPropTypes.funcArray Weekdays, default: ['Sun', 'Mon', 'Tus', 'Wes', 'Thu', 'Fri', 'Sat']
renderPrevYearButtonPropTypes.funcRender function for customize prev year button
renderPrevMonthButtonPropTypes.funcRender function for customize prev month button
renderNextYearButtonPropTypes.funcRender function for customize next year button
renderNextMonthButtonPropTypes.funcRender function for customize next year button

Styles

PropertyTypeDescription
containerStylePropTypes.objectContainer Style
warpRowControlMonthYearPropTypes.objectStyle for row control next or prev month, year.
warpRowWeekdaysPropTypes.objectWarp row weekdays style
weekdayStylePropTypes.objectWeekday text style
warpDayStylePropTypes.objectStyle for each day in month
dateSelectedWarpDayStylePropTypes.objectStyle for selected day in month
textDayStylePropTypes.objectStyle for text day in month
currentDayStylePropTypes.objectStyle for text current day in month
notCurrentDayOfMonthStylePropTypes.objectStyle for text when day is not current day in month

License

This project is licenced under the MIT License.

Any bundled fonts are copyright to their respective authors and mostly under MIT or SIL OFL.

Pull Request

Pull requests are welcome!

About

a component calendar date allow customize event date. (support android & ios). Pull requests are welcome!

Topics

Resources

Stars

17 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages