Created
March 22, 2016 15:51
-
-
Save kmagiera/ce986276557b3f9c26f0 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
class RandomView extends React.Component { | |
state: any; | |
constructor(props) { | |
super(props); | |
this.state = { | |
firstValue: new Animated.Value(0), | |
secondValue: new Animated.Value(0), | |
}; | |
} | |
componentDidMount() { | |
Animated.timing(this.state.firstValue, {toValue: 1, duration: 2000}).start(); | |
Animated.spring(this.state.secondValue, { toValue: 100 , tension: -10 }).start(); | |
} | |
render() { | |
return ( | |
<Animated.View // Special animatable View | |
style={{ | |
opacity: this.state.firstValue, // Binds | |
translateX: this.state.secondValue, | |
}}> | |
<Text>Hello</Text> | |
</Animated.View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment