Reputation: 25
async componentWillMount() {
this.setState({
mMonthStartDate: moment(new Date()).startof('month').format("YYYY-MM-DD"),
userAcadDetails: this.props.user.userAcadInfo,
item: JSON.parse(await AsyncStorage.getAsyncValue("""""""""""))
})
render Method
<Calendar
style={{ width: Dimensions.get("window").width }}
current={this.state.mMonthStartDate}
minDate={this.state.mMonthStartDate}
maxDate={this.state.mMonthEndDate}
onMonthChange={month => {
// this.getStartdate(month.dateString);
console.log("month changed", month);
}}
/>
I am not able to crack this whenever debug JS remotely is on Application perfect. when i turn it off this error will display
Upvotes: 1
Views: 1292
Reputation: 2051
This issue happened for me when I passed wrong date format in the selected
property of <Agenda />
component. I fixed the issue by providing the date in correct format i.e. YYYY-MM-DD
.
Upvotes: 0
Reputation: 41
In my case I was using markedDates={{}} prop and the reason was that I wasn't passing valid date format which was (YYYY-MM-DD) rather than I was passing (YYYY-M-D). eg :- Valid - 2021-06-06 Invalid - 2021-6-6
Upvotes: 4
Reputation: 242
Note: These methods are considered legacy and you should avoid them in new code: UNSAFE_componentWillMount()
I would recommend doing your fetching and async stuff inside of componentDidMount()
. The problem is probably that you are trying to set or use some values that are not available atm.
Upvotes: 0