@@ -8,7 +8,6 @@ import Columns from './columns/Columns'
88import GroupRows from './row/GroupRows'
99import ScrollElement from './scroll/ScrollElement'
1010import MarkerCanvas from './markers/MarkerCanvas'
11-
1211import windowResizeDetector from '../resize-detector/window'
1312
1413import {
@@ -876,7 +875,15 @@ export default class ReactCalendarTimeline extends Component {
876875 )
877876 }
878877
879- groups
878+ /**
879+ * check if child of type TimelineHeader
880+ * refer to for explanation https://github.com/gaearon/react-hot-loader#checking-element-types
881+ */
882+ isTimelineHeader = ( child ) => {
883+ if ( child . type === undefined ) return false
884+ return child . type . secretKey === TimelineHeaders . secretKey
885+ }
886+
880887 childrenWithProps (
881888 canvasTimeStart ,
882889 canvasTimeEnd ,
@@ -918,7 +925,7 @@ export default class ReactCalendarTimeline extends Component {
918925 }
919926
920927 return React . Children . map ( childArray , child => {
921- if ( child . type !== TimelineHeaders ) {
928+ if ( ! this . isTimelineHeader ( child ) ) {
922929 return React . cloneElement ( child , childProps )
923930 } else {
924931 return null
@@ -930,7 +937,7 @@ export default class ReactCalendarTimeline extends Component {
930937 if ( this . props . children ) {
931938 let headerRenderer
932939 React . Children . map ( this . props . children , child => {
933- if ( child . type === TimelineHeaders ) {
940+ if ( this . isTimelineHeader ( child ) ) {
934941 headerRenderer = child
935942 }
936943 } )
0 commit comments