Closed ganesh-papola closed 3 years ago
This project doesn't have a file named DatePicker.js
. Is that in your code? As with the other issue that you posted, please include a reproducible demo or code snippet. Use the example project in this repo as a base if that's convenient.
<CalendarStrip
scrollable
minDate={new Date()
style={{ height: hp(100), paddingTop: hp(20), paddingBottom: hp(20) }}
calendarHeaderStyle={{ color: 'white', paddingBottom: hp(7) }}
calendarColor={COLORS.PRIMARY}
dateNumberStyle={{ color: 'white', }}
dateNameStyle={{ color: 'white', }}
iconContainer={{ flex: 0.1 }}
selectedDate={this.state.selectedDate}
onDateSelected={this.onDateSelected}
onWeekChanged={this.props.onWeekChanged?this.props.onWeekChanged:null}
useIsoWeekday={false}
iconLeft={require('../images/left-arrow.png')}
iconRight={require('../images/right-arrow.png')}
highlightDateNameStyle={'black'}
highlightDateNumberStyle={'black'}
calendarAnimation={{ type: 'sequence', duration: 30 }}
daySelectionAnimation={{ type: 'border', duration: 200, borderWidth: 1, borderHighlightColor: 'white', highlightColor: 'black' }}
/>
this is the code in DatePicker.js
I can help debug if you provide a Snack that recreates the bug. Otherwise StackOverflow is a better forum for general React Native questions
I encountered the same issue. I use the version 2.1.4
This is fixed when the startingDate is given a value. Maybe this should be made mandatory in the TS? Also, I found it tricky dealing with momentjs object since this object is mutable. I understand now why there are a lot of clones in the code. Anyway, awesome library!
Thanks @hans-permana for the additional info. The startingDate
prop is checked for null and set to today's date. Which line is the clone exception happening?
I agree that Moment can be unintuitive. There's a project called date-io that abstracts numerous date libraries. Please consider contributing to this project.
I debugged this in the example project by supplying a selectedDate
prop set to this.state.selectedDate initially undefined. When a date is selected, the onDateChange
callback updates state and trickles back into CalendarStrip. However the prop update tried to clone startingDate
but that prop is undefined. I've added a guard which will be published in 2.1.5.
Android/ios release error in date clone