with-transition
Higher order component of
react-transition-group
to enable transtion for react and react-native.
Demo
https://yusukeshibata.github.io/with-transition/
Usage with presets
Many transition presets are prepared.
- slideup_slidedown
- slideleft_slideright
- ...and more
const SlideupSomeComponent = SomeComponent { const flag = thisstate return <SomeContainer> /* * `in` prop will be passed to internal react-transition-group container, * and update component's mounted/unmounted state. */ <SlideupSomeComponent in=flag /> </SomeContainer> }
Or you can specify custom transition like:
react-transition-group
Setting props of withTransition
's config object will be passed into react-transition-group's Transition
component. And props on Example
will be passed into View
,
(See example below)
so if you want to set props to Transition
component, do as below:
// (props) => {} propsonEnter propsmountOnEnter
Example:
const Example = View { // ... } { return <Example mountOnEnter onEnter=::thisonEnter> /*...*/ </Example> }
Dynamic transition type
const Example = View { const type = 'slideup_slideup' return <Example type=type /> }
Author
Yusuke Shibata
License
MIT