File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1- import React , { Component } from 'react' ;
1+ import React , { Component } from 'react' ;
22import PropTypes from 'prop-types' ;
33import cleanProps from 'clean-react-props' ;
44
@@ -141,6 +141,7 @@ class TimerWrapper extends Component {
141141 render ( ) {
142142 const {
143143 children,
144+ component,
144145 duration,
145146 } = this . props ;
146147
@@ -160,16 +161,20 @@ class TimerWrapper extends Component {
160161 } ) ;
161162 } ) ;
162163
163- return (
164- < div { ...cleanProps ( this . props ) } >
165- { clonedChildren }
166- </ div >
164+ return React . createElement ( component , {
165+ ...cleanProps ( this . props ) ,
166+ } ,
167+ clonedChildren
167168 ) ;
168169 }
169170}
170171
171172TimerWrapper . propTypes = {
172173 active : PropTypes . bool ,
174+ component : PropTypes . oneOfType ( [
175+ PropTypes . element ,
176+ PropTypes . string ,
177+ ] ) ,
173178 duration : PropTypes . number ,
174179 loop : PropTypes . bool ,
175180 time : PropTypes . number ,
@@ -180,6 +185,7 @@ TimerWrapper.propTypes = {
180185
181186TimerWrapper . defaultProps = {
182187 active : false ,
188+ component : 'div' ,
183189 duration : 10000 ,
184190 loop : false ,
185191 time : 0 ,
You can’t perform that action at this time.
0 commit comments