Hi there,
I was using calendar version 0.11.1 until today which worked fine. After updating to 0.12.0 (because of #201) the calendar seems not support a custom component for components.event anymore.
This only happens in the month-view (week and day seem to work just fine)
Basically i'm doing this:
import Entry from '../Entry';
[..snip..]
<BigCalendar
[..snip..]
views={['month', 'week', 'day']}
components={{
event: Entry,
}}
/>
What still works is passing a custom component for the toolbar.
not intentional, sounds like a bug!
@HerrZatacke Would you mind sharing (at least generally) what your custom event component looks like? I cannot find documentation or an example anywhere.
Update: I ended up figuring it out via this StackOverflow question. (Might be worth putting something similar in the docs).
However, what remains unclear to me is how to pass custom props to our custom components. The BigCalendar component itself renders these child components.
You can pass custom props via a closure, since functions are acceptable Components
renderEvent = (eventProps) => {
return <MyEvent {...eventProps} custom={this.props.custom} />
}
render() {
return (
<BigCalendar components={{ event: this.renderEvent }} />
)
}
@jquense Absolutely brilliant, cheers. Took me way too long to figure that one out.
Most helpful comment
You can pass custom props via a closure, since functions are acceptable Components