Skip to content

Instantly share code, notes, and snippets.

@browniefed
Last active December 16, 2016 22:00
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 browniefed/9801dabdc61f623d8a24bf83082b9f9e to your computer and use it in GitHub Desktop.
Save browniefed/9801dabdc61f623d8a24bf83082b9f9e to your computer and use it in GitHub Desktop.
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