Skip to content

Instantly share code, notes, and snippets.

@umuralpay
Created March 11, 2020 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umuralpay/039dc3ca8e9af1ec39f2d5861b2cbf9e to your computer and use it in GitHub Desktop.
Save umuralpay/039dc3ca8e9af1ec39f2d5861b2cbf9e to your computer and use it in GitHub Desktop.
React Native Animation
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