v0.7.3
0.7.3 (2021-03-30)
New Features
useDynamicAnimation
New hook that lets you use style objects dynamically, rather than using static variants.
const animation = useDynamicAnimation(() => {
return {
height: 100
}
})
const onLayout = ({ nativeEvent }) => {
animation.animateTo({
...animation.current,
height: nativeEvent.layout.height
})
}
return <MotiView state={animation} />
Benefits
- High performance
- Zero re-renders
- Animations run on the native thread
- Easy API
Imports
- You can now import
MotiView
,MotiText
without an alias.import { MotiView } from 'moti'
- This is a non-breaking change. You can still
import { View as MotiView } from 'moti'
- However, this may be deprecated in the future.