christopherdro / christopherdro/react-native-calendar
Events are not shown when adding events to array dynamically
- Dominant language
- JavaScript
- Stars
- 536
- Forks
- 233
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am adding events dynamically to the calendar using string .
Here is the code for same ( this code is not working)
var eventstr = "{date: '"+ this.state.SelectedDate + "', hasEventCircle: {backgroundColor: '" + event1color +"'}}";
var event1 = [{eventstr}];
let updatedArray = this.state.eventItems.concat(event1);
this.setState({eventItems:updatedArray});
Whereas, if I declared event array like this then its showing properly.
var event1 = [{date: '2017-05-19', hasEventCircle: {backgroundColor: '#ccedcc'}}];
let updatedArray = this.state.eventItems.concat(event1);
this.setState({eventItems:updatedArray});
Can you please help me what is wrong with 1st approach ? How to construct the event string and add to the events array?
Thank you.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.