-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
42 lines (38 loc) · 1.01 KB
/
App.js
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
import { View, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import React from 'react';
import Animated, {useSharedValue, useAnimatedStyle, withTiming} from 'react-native-reanimated'
const App: () => React$Node = () => {
const animation = useSharedValue({width:200,height:200})
const animationStyle = useAnimatedStyle(() => {
return{
width: withTiming(animation.value.width,{
duration:1000
}),
height: withTiming(animation.value.height,{
duration:600
})
}
})
return (
<View style={styles.container}>
<TouchableWithoutFeedback onPress={() => {
animation.value = {width:300,height:450}
}}>
<Animated.View style={[styles.box,animationStyle]} />
</TouchableWithoutFeedback>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
box: {
// width: 200,
// height: 200,
backgroundColor: '#631d94'
}
});
export default App;