Skip to content

Instantly share code, notes, and snippets.

@Shadid12
Created November 16, 2017 05:11
Show Gist options
  • Save Shadid12/f5e67438ac3511c939ed82b318b18c3b to your computer and use it in GitHub Desktop.
Save Shadid12/f5e67438ac3511c939ed82b318b18c3b to your computer and use it in GitHub Desktop.
React Simple Animation
import React from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Animated,
Easing
} from 'react-native';
export default class App extends React.Component {
constructor(props) {
super(props);
this.animatedValue = new Animated.Value(25);
}
_animate = () => {
Animated.timing(this.animatedValue, {
toValue: 100,
duration: 1000,
easing: Easing.bounce
}).start();
};
render() {
const animatedStyle = {height: this.animatedValue};
return (
<View>
<TouchableOpacity style={styles.container} onPress={this._animate}>
<Animated.View style={[styles.box, animatedStyle]}>
<Text style={styles.text}>Facebook Login</Text>
</Animated.View>
</TouchableOpacity>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
},
box: {
backgroundColor: '#33a1d1',
width: 100,
height: 25
},
text: {
color: '#fff'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment