Skip to content

Instantly share code, notes, and snippets.

@aguscha333
Created June 2, 2020 14:17
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 aguscha333/956eeed3d174351f8fddde25aa60888a to your computer and use it in GitHub Desktop.
Save aguscha333/956eeed3d174351f8fddde25aa60888a to your computer and use it in GitHub Desktop.
Animation example with useAnimate
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