Skip to content

Instantly share code, notes, and snippets.

@biyootiful
Created October 30, 2017 22:33
Show Gist options
  • Save biyootiful/b4a4ace253773b970f5f49c5511a9684 to your computer and use it in GitHub Desktop.
Save biyootiful/b4a4ace253773b970f5f49c5511a9684 to your computer and use it in GitHub Desktop.
class FadeIn extends Component {
state = {
fadeAnim: new Animated.Value(0)
};
componentDidMount() {
Animated.timing(this.state.fadeAnim, {
toValue: 1,
duration: 2500
}).start();
}
render() {
let { fadeAnim } = this.state;
return (
<Animated.View
style={{
...this.props.sytle,
opacity: fadeAnim
}}
>
{this.props.children}
</Animated.View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment