Skip to content

Commit

Permalink
adding event dates and making sure selected date is set correctly
Browse files Browse the repository at this point in the history
also adding customStyles to test that if needed
  • Loading branch information
coderdave committed Oct 5, 2017
1 parent 787161f commit a878313
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions example/App.js
Expand Up @@ -30,21 +30,33 @@ const styles = StyleSheet.create({
},
});

// use to test customStyles
const customStyles = StyleSheet.create({
dayButton: {
padding: 10,
},
dayButtonFiller: {
padding: 10,
},
});

class App extends Component {
constructor(props) {
super(props);
this.state = {
selectedDate: moment().format(),
selectedDate: moment().format('YYYY-MM-DD'),
};
}

render() {
let eventDates = [moment().format('YYYY-MM-DD'), moment().add(1, "day").format('YYYY-MM-DD'),
moment().add(14, "day").format('YYYY-MM-DD'), moment().add(1, "month").format('YYYY-MM-DD')];

return (
<View style={styles.container}>
<Calendar
ref="calendar"
eventDates={['2016-07-03', '2016-07-05', '2016-07-28', '2016-07-30']}
events={[{ date: '2016-07-04', hasEventCircle: { backgroundColor: 'powderblue' } }]}
eventDates={eventDates}
scrollEnabled
showControls
dayHeadings={customDayHeadings}
Expand All @@ -58,6 +70,8 @@ class App extends Component {
onTouchNext={(e) => console.log('onTouchNext: ', e)}
onSwipePrev={(e) => console.log('onSwipePrev: ', e)}
onSwipeNext={(e) => console.log('onSwipeNext', e)}
selectedDate={this.state.selectedDate}
showEventIndicators={true}
/>
<Text>Selected Date: {moment(this.state.selectedDate).format('MMMM DD YYYY')}</Text>
</View>
Expand Down

0 comments on commit a878313

Please sign in to comment.