-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNegativeScaleExample.js
More file actions
48 lines (42 loc) · 854 Bytes
/
NegativeScaleExample.js
File metadata and controls
48 lines (42 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from 'react';
import { Animated, Text } from 'react-native';
class NegativeScaleExample extends React.Component {
state = {
animation: new Animated.Value(1)
}
componentDidMount() {
Animated.timing(
this.state.animation,
{
toValue: -2,
duration: 2000
}
).start();
}
render() {
const animationStyles = {
transform: [
{ scale: this.state.animation }
]
};
return (
<Animated.View style={[objectStyles.object, animationStyles]}>
<Text style={objectStyles.text}>Hello</Text>
</Animated.View>
);
}
}
const objectStyles = {
object: {
backgroundColor: 'orange',
width: 100,
height: 100
},
text: {
fontSize: 20,
fontWeight: '500',
color: 'white',
padding: 5
}
}
export { NegativeScaleExample };