Skip to content

Commit

Permalink
fix: CModal: fix deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
woothu committed Jul 17, 2020
1 parent 14b0c52 commit ad88025
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modal/CModal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import { Transition } from 'react-transition-group'
Expand Down Expand Up @@ -75,13 +75,15 @@ const CModal = props => {
'show': isOpen || fade
})

const nodeRef = useRef(null)
return (
<div onClick={modalClick}>
<Transition
in={Boolean(isOpen)}
onEntered={onEntered}
onExited={onExited}
timeout={fade ? 150 : 0}
nodeRef={nodeRef}
>
{(status) => {
let transitionClass = getTransitionClass(status)
Expand All @@ -95,6 +97,7 @@ const CModal = props => {
role="dialog"
className={classes}
data-modal={true}
ref={nodeRef}
>
<div className={dialogClasses} role="document">
<div
Expand Down

0 comments on commit ad88025

Please sign in to comment.