Skip to content
Permalink
6434347984
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
66 lines (63 sloc) 1.93 KB
import React , { Component } from 'react'
import delay from 'delay'
import { Spring , Trail , Keyframes , animated , config } from 'react-spring'
class TransitionGrid extends Component {
async componentDidUpdate ( prevProps , prevState ) {
if ( ! prevProps . visible && this . props . visible ) {
this . container ( Spring , {
from : { x : - 100 , opacity : } ,
to : { x : , opacity : 1 } ,
config : config . slow
} )
await delay ( 500 )
await this . content ( Trail , {
from : { y : - 120 , opacity : } ,
to : { y : , opacity : 1 }
} )
} else if ( prevProps . visible && ! this . props . visible ) {
this . content ( Trail , { to : { y : - 120 , opacity : } } )
await delay ( 500 )
await this . container ( Spring , {
to : { x : - 100 , opacity : } ,
config : config . slow
} )
}
}
render ( ) {
const { items , removeItem } = this . props
return (
< Keyframes native script = { next => ( this . container = next ) } >
{ ( { x , opacity } ) => (
< animated . ul
className = "grid animated-grid"
style = { {
transform : x . interpolate ( x => `translate3d( ${ x } %,0,0)` ) ,
opacity
} }
>
< Keyframes
native
keys = { items }
script = { next => ( this . content = next ) }
>
{ items . map ( item => ( { y , ... props } ) => (
< animated . li
onClick = { ( ) => removeItem ( item ) }
className = "card"
style = { {
transform : y . interpolate ( y => `translate3d(0, ${ y } %,0)` ) ,
... props
} }
>
< div className = "close-card" > < / div >
< div > { item } < / div >
< / animated . li >
) ) }
< / Keyframes >
< / animated . ul >
) }
< / Keyframes >
)
}
}
export default props => < TransitionGrid { ... props } / >

友情链: IM·体育网上直播_IM·体育赛事最新版_im体育官网在线官网在线 | im体育app平台下载|IM体育v2.3 安卓版|IM体育今天官网赛表 | im体育推荐官网_im体育今晚高清_im体育买软件 | 2022im体育网网址_分析观看比赛_2022im体育在线软件 | IM体育开户网址-Im体育官方网站-IM体育期胜负彩专家分析 | im电竞体育登录入口_IM·体育比分分析在线_IM·体育v8.5 IOS版 | im体育app官网下载|IM体育最新今天观看|IM体育赛事注册 |