Created
March 11, 2020 18:10
-
-
Save umuralpay/039dc3ca8e9af1ec39f2d5861b2cbf9e to your computer and use it in GitHub Desktop.
React Native Animation
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
const FadeInView = (props) => { | |
const [fadeAnim] = useState(new Animated.Value(0)) // Initial value for opacity: 0 | |
React.useEffect(() => { | |
Animated.timing( | |
fadeAnim, | |
{ | |
toValue: 1, | |
duration: 10000, | |
} | |
).start(); | |
}, []) | |
return ( | |
<Animated.View // Special animatable View | |
style={{ | |
...props.style, | |
opacity: fadeAnim, // Bind opacity to animated value | |
}} | |
> | |
{props.children} | |
</Animated.View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment