-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: undefined is not an object (evaluating 'datesList[_this.state.numVisibleDays - 1].date') #303
Comments
Are you passing in another other props? Does your code work with the sample app? |
This is a dup of #262. This error occurs when |
More details: if the |
Here is a possible fix: stop componentDidUpdate from being called until layout is done. I places these lines at beginning of componentDidUpdate and the problem went away:
I am not sure if this will cause other problems or not, which is why I will not submit a PR with this fix yet. |
Fix suggested here: BugiDev#303 (comment)
Thanks @mtimofiiv and @phatmann for identifying the issue. That change will likely cause undesirable side effects, and is a band-aid for the root problem. Please revert that change in the PR and instead add this to the state initializer:
|
@peacechen you're right. I've updated the PR by reverting the old change and adding the initial state as you suggested. |
Thanks again @mtimofiiv for updating the PR. The fix has been published in 2.2.4 |
Hmm, the fix has not seemed to work, still getting the same error on |
This fix caused other issues for me. I decided not to use it. I can look into it if needed. |
In 2.2.5 I have not this problem anymore |
HI, i've added a calendar strip instance like this:
<CalendarStrip style={{ height: 100, paddingTop: 10, paddingBottom: 10 }} minDate={moment()} maxDate={moment().add(10, "days")} datesBlacklist={(date) => { return (date.isoWeekday() === 6 || date.isoWeekday() === 7); }} />
But i'm getting an error:
TypeError: undefined is not an object (evaluating 'datesList[_this.state.numVisibleDays - 1].date')
If i remove the "datesBlacklist" property, it works but i need to disable saturdays and sundays.
I'm using version => "react-native-calendar-strip": "^2.2.3"
Thanks in advance.
The text was updated successfully, but these errors were encountered: