Created
June 2, 2020 14:17
-
-
Save aguscha333/956eeed3d174351f8fddde25aa60888a to your computer and use it in GitHub Desktop.
Animation example with useAnimate
This file contains 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 React, {useEffect, useRef} from 'react'; | |
import {View, Animated} from 'react-native'; | |
import useAnimate from 'hooks/useAnimate'; | |
const AnimatedView = () => { | |
const animatedOpacity = useAnimate({ | |
// fromValue: 0, (default) | |
// toValue: 1, (default) | |
duration: 1000, | |
}); | |
return ( | |
<Animated.View | |
style={{ | |
height: 100, | |
widht: 100, | |
opacity: animatedOpacity.animatedValue, | |
backgroundColor: 'yellow', | |
}} | |
/> | |
); | |
}; | |
export default AnimatedView; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment