-
Notifications
You must be signed in to change notification settings - Fork 0
/
SecondPageComponent.js
78 lines (61 loc) · 1.56 KB
/
SecondPageComponent.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableHighlight,
Animated,
TouchableOpacity,
Navigator,
} from 'react-native';
import FirstPageComponent from './FirstPageComponent';
export default class SecondPageComponent extends React.Component{
constructor(props: any) {
super(props);
this.state = {
};
}
_pressButton() {
const { navigator } = this.props;
if(navigator) {
//很熟悉吧,入栈出栈~ 把当前的页面pop掉,这里就返回到了上一个页面:FirstPageComponent了
navigator.pop();
}
}
render() {
return (
<View style={styles.container}>
<Animated.Text style={styles.hello,
{transform: [{scale:this.state.bounceValue}]}}>Hello,World</Animated.Text>
<Animated.Image
source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
style={{
flex: 1,
transform: [ // `transform`是一个有序数组(动画按顺序执行)
{scale: this.state.bounceValue}, // 将`bounceValue`赋值给 `scale`
]
}}
/>
<TouchableOpacity onPress={this._pressButton.bind(this)}>
<Text>点我跳回去</Text>
</TouchableOpacity>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
hello: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
img:{
margin: 10,
},
});