Skip to content

Instantly share code, notes, and snippets.

@fernandatoledo
Last active July 1, 2020 16:39
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 fernandatoledo/8fc5a6b7270cbd569a924222bb2bb045 to your computer and use it in GitHub Desktop.
Save fernandatoledo/8fc5a6b7270cbd569a924222bb2bb045 to your computer and use it in GitHub Desktop.
import React, {useEffect, useRef} from 'react';
import {View, Animated} from 'react-native';
const AnimatedView = () => {
const animatedOpacity = useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.timing(animatedOpacity, {
toValue: 1,
duration: 1000,
}).start();
}, []);
return (
<Animated.View
style={{
height: 100,
widht: 100,
opacity: animatedOpacity,
backgroundColor: 'yellow',
}}
/>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment