diff --git a/src/VerticalTimelineElement.js b/src/VerticalTimelineElement.js index 9cd96c4..4cbfa4c 100644 --- a/src/VerticalTimelineElement.js +++ b/src/VerticalTimelineElement.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { useInView } from 'react-intersection-observer'; +import { InView } from 'react-intersection-observer'; const VerticalTimelineElement = ({ children, @@ -23,65 +23,70 @@ const VerticalTimelineElement = ({ visible: defaultVisible, }) => { const [visible, setVisible] = useState(defaultVisible); - const [ref, inView] = useInView(intersectionObserverProps); - if (!visible && inView) { - setVisible(true); - } return ( -
- - - {icon} - -
+ + {({ inView, ref }) => { + if (!visible && inView) { + setVisible(true); + } + return (
- {children} - - {date} - -
- -
+ + + {icon} + +
+
+ {children} + + {date} + +
+ +
+ ); + }} + ); };