Last active
December 16, 2016 22:00
-
-
Save browniefed/9801dabdc61f623d8a24bf83082b9f9e to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react'; | |
import {AppRegistry, View, StyleSheet, Animated, Easing } from 'react-native'; | |
export default class animatedbasic extends Component { | |
componentWillMount() { | |
this.animatedValue = new Animated.Value(1); | |
} | |
componentDidMount() { | |
Animated.timing(this.animatedValue, { | |
toValue: 0, | |
duration: 1000, | |
easing: Easing.bounce | |
}).start() | |
} | |
render() { | |
const animatedStyle = { opacity: this.animatedValue } | |
return ( | |
<View style={styles.container}> | |
<Animated.View style={[styles.box, animatedStyle]}/> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
alignItems: "center", | |
justifyContent: "center" | |
}, | |
box: { | |
backgroundColor: "#333", | |
width: 100, | |
height: 100 | |
} | |
}) | |
AppRegistry.registerComponent('animatedbasic', () => animatedbasic); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment