react-native-calendar-timetable
react-native-calendar-timetable copied to clipboard
Update usage example
Hello,
The usage example is outdated and I am having some trouble getting the cards to render.
Here is what I noticed needs to be updated:
const [till] = React.useState(moment().add(3, 'days').toDate()); // instead of toISOString();
renderItem={renderMyItemCard} // instead of cardComponent={myItemCard}
export default function MyItemCard({title, startDate, endDate}) // I'm not sure how to properly set up this component
Thank you
Hi, @jgoldm.
const [till] = React.useState(moment().add(3, 'days').toDate()); // instead of toISOString();
This is still up-to-date, we support all values supported by Date()
constructor, meaning ISO string, UNIX timestamp (number) or Date object are all valid values.
renderItem={renderMyItemCard} // instead of cardComponent={myItemCard}
Thanks for catching this, I will update it ASAP.
export default function MyItemCard({title, startDate, endDate})
This would be your component, responsible for rendering your cards. It receives a bunch of props, so that you could customize your cards appropriately. But, because cardComponent
prop is no longer in play, its usage is slightly different, which will also be reflected in the docs.
For now, you can use it like this:
<Timetable
{/* other props */}
renderItem={props => <MyItemCard {...props}/>}
/>