Skip to content

Commit

Permalink
fix(react-transition-collapse): make sure null is not the arg to DOME…
Browse files Browse the repository at this point in the history
…l contains func
  • Loading branch information
Richard Samuelsson committed Mar 19, 2019
1 parent 757c822 commit a46f4a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ yarn add react-transition-collapse

### Usage

ReactTransitionCollapse takes three props:
ReactTransitionCollapse takes these props:
```
expanded: boolean
duration: number | string // number of milliseconds
children: Element
duration: number | string // number of milliseconds
expanded: boolean
animationType: 'scale' | 'translate' // which css transform should be applied to animate the transition
```

#### Full example
Expand Down
4 changes: 2 additions & 2 deletions src/react-transition-collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ReactTransitionCollapse extends React.PureComponent<transitionProps> {
reMeasure = () => {
let timeout: NodeJS.Timeout
return this.getListener(() => {
if (!this.wrapperEl || !this.wrapperEl.contains(this.innerEl)) {
if (!this.wrapperEl || !this.innerEl || !this.wrapperEl.contains(this.innerEl)) {
return
}
clearTimeout(timeout)
Expand Down Expand Up @@ -101,7 +101,7 @@ class ReactTransitionCollapse extends React.PureComponent<transitionProps> {
this.wrapperEl.appendChild(this.innerEl)
const reexec = () =>
requestAnimationFrame(() => {
if (this.wrapperEl && this.wrapperEl.contains(this.innerEl)) {
if (this.wrapperEl && this.innerEl && this.wrapperEl.contains(this.innerEl)) {
this.measure(this.innerEl)
this.updateInnerHeight(this.height)
} else {
Expand Down

0 comments on commit a46f4a6

Please sign in to comment.