Created
July 31, 2018 13:52
-
-
Save a-m-dev/59b61ef7dfb9e6b5cf626b277da23c24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Spring, animated, config } from 'react-spring' | |
| import { TimingAnimation, Easing } from 'react-spring/dist/addons' | |
| const myComponent = () => { | |
| return( | |
| <Spring | |
| native // with out this native flag animation will aplly every frame , which will cause ripping and laggin , by using native your element needs to be use like <animated.div> or any other element | |
| from={{ top: '0vh' }} // this is optional , if you dont have proper style dont use from={{ ... }} | |
| to={{ top: showSearch ? '-100vh' : '0vh' }} | |
| impl={TimingAnimation} | |
| // config={{ duration: 500 }} | |
| config={{tension: 280, friction: 60, duration: 750}} // you can use config that you imported abpve like config={config.slow} but since we are using time so we n eed to do this | |
| > | |
| { styles => | |
| <animated.section id='searchPart' style={styles}> | |
| <div className='searchContainer'> | |
| <h1>this is search => {location.search}</h1> | |
| </div> | |
| </animated.section> | |
| } | |
| </Spring> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment