apaajabolehd / react-native-range-datepicker

react native range datepicker inspired by Airbnb
84 stars 53 forks source link

Not able to get startdate and untildate #2

Closed ggarg2 closed 7 years ago

ggarg2 commented 7 years ago

<DatepickerRange startDate= {this.props.startDate} untilDate= {this.props.endDate} dayHeadings= {['S', 'M', 'T', 'W', 'T', 'F', 'S']} maxMonth= {12} buttonColor= 'green' showReset= {true} showClose= {true} onClose= {this.props.toggleModal} onConfirm= {({startDate, untilDate}) => console.log("dates are ", startDate)} placeHolderStart= 'Check-in Date' placeHolderUntil= 'Check-out Date' selectedBackgroundColor= 'green' selectedTextColor= 'white' todayColor= 'green' />

this statement is logging when i am selecting date ==> 'dates are ', undefined.

Any Suggestions ?

ggarg2 commented 7 years ago

I got an answer. Remove curly braces because handleConfirmDate method is passing two parameters in onConfirm. handleConfirmDate(){ this.props.onConfirm && this.props.onConfirm(this.state.startDate,this.state.untilDate); }

Instead of using onConfirm= {({startDate, untilDate}) => console.log("dates are ", startDate)}

use onConfirm= {(startDate, untilDate) => console.log("dates are ", startDate)}

@apaajabolehd please update readme

apaajabolehd commented 7 years ago

Thank you for figuring that out @ggarg2. I'll fix it immediately.