import * as React from 'react' ; import PropTypes from 'prop-types' ; import useScrollTrigger from '@material-ui/core/useScrollTrigger' ; import Slide from '@material-ui/core/Slide' ; function HideOnScroll ( props ) { const { children } = props ; const trigger = useScrollTrigger ( ) ; return ( < Slide appear = { false } direction = "down" in = { ! trigger } > { children } < /Slide>); } HideOnScroll . propTypes = { children : PropTypes . node . isRequired , } ; export interface HideOnScrollProps { children : React . ReactElement ; } export default HideOnScroll ;