Skip to content

Commit

Permalink
0.26.4 (#649)
Browse files Browse the repository at this point in the history
0.26.4
  • Loading branch information
Ilaiwi committed Sep 11, 2019
2 parents ec8d7af + 98677fb commit 490ca5c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres (more or less) to [Semantic Versioning](http://semver.o

## Unreleased

# 0.26.4

* fix `react-calendar-timeline` not working with `react-hot-loader` #607 @ilaiwi + @westn

## 0.26.3

* add documentation for `onItemDeselect` #350 @ilaiwi
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-calendar-timeline",
"version": "0.26.3",
"version": "0.26.4",
"description": "react calendar timeline",
"main": "lib/index.js",
"scripts": {
Expand Down
15 changes: 11 additions & 4 deletions src/lib/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Columns from './columns/Columns'
import GroupRows from './row/GroupRows'
import ScrollElement from './scroll/ScrollElement'
import MarkerCanvas from './markers/MarkerCanvas'

import windowResizeDetector from '../resize-detector/window'

import {
Expand Down Expand Up @@ -876,7 +875,15 @@ export default class ReactCalendarTimeline extends Component {
)
}

groups
/**
* check if child of type TimelineHeader
* refer to for explanation https://github.com/gaearon/react-hot-loader#checking-element-types
*/
isTimelineHeader = (child) => {
if(child.type === undefined) return false
return child.type.secretKey ===TimelineHeaders.secretKey
}

childrenWithProps(
canvasTimeStart,
canvasTimeEnd,
Expand Down Expand Up @@ -918,7 +925,7 @@ export default class ReactCalendarTimeline extends Component {
}

return React.Children.map(childArray, child => {
if (child.type !== TimelineHeaders) {
if (!this.isTimelineHeader(child)) {
return React.cloneElement(child, childProps)
} else {
return null
Expand All @@ -930,7 +937,7 @@ export default class ReactCalendarTimeline extends Component {
if (this.props.children) {
let headerRenderer
React.Children.map(this.props.children, child => {
if (child.type === TimelineHeaders) {
if (this.isTimelineHeader(child)) {
headerRenderer = child
}
})
Expand Down
2 changes: 2 additions & 0 deletions src/lib/headers/SidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ SidebarWrapper.defaultProps = {
children: ({ getRootProps }) => <div data-testid="sidebarHeader" {...getRootProps()} />
}

SidebarWrapper.secretKey = "SidebarHeader"

export default SidebarWrapper
13 changes: 12 additions & 1 deletion src/lib/headers/TimelineHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ class TimelineHeaders extends React.Component {
}
}

/**
* check if child of type SidebarHeader
* refer to for explanation https://github.com/gaearon/react-hot-loader#checking-element-types
*/
isSidebarHeader = (child) => {
if(child.type === undefined) return false
return child.type.secretKey ===SidebarHeader.secretKey
}

render() {
let rightSidebarHeader
let leftSidebarHeader
Expand All @@ -56,7 +65,7 @@ class TimelineHeaders extends React.Component {
? this.props.children.filter(c => c)
: [this.props.children]
React.Children.map(children, child => {
if (child.type === SidebarHeader) {
if (this.isSidebarHeader(child)) {
if (child.props.variant === RIGHT_VARIANT) {
rightSidebarHeader = child
} else {
Expand Down Expand Up @@ -131,4 +140,6 @@ TimelineHeadersWrapper.propTypes = {
calendarHeaderClassName: PropTypes.string
}

TimelineHeadersWrapper.secretKey = "TimelineHeaders"

export default TimelineHeadersWrapper

0 comments on commit 490ca5c

Please sign in to comment.