-
Notifications
You must be signed in to change notification settings - Fork 0
/
Boy.js
63 lines (61 loc) · 1.72 KB
/
Boy.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
/**
* Created by Administrator on 2017/3/15 0015.
*/
import React, { Component } from 'react';
import {
Text,
View,
StyleSheet,
Image
} from 'react-native';
import Girl from './Girl';
import NavigatorBar from './NavigatorBar';
export default class Boy extends Component{
// 构造
constructor(props) {
super(props);
// 初始状态
this.state = {
gift:'',
};
}
render(){
return (
<View style={styles.container} >
<NavigatorBar title='boy' statusBar={{
backgroundColor:'gray',
barStyle:'dark-content',
}}
backgroundColor='#00a1e9'
justifyContent='center'
/>
<Text style={styles.text}>I am a boy</Text>
<Text style={styles.text}
onPress={()=>{
this.props.navigator.push({
component:Girl,
params:{
gift:'一支玫瑰',
onCallBack:(gift)=>{
this.setState({
gift:gift
})
}
}
})
}}
>送女孩一支玫瑰</Text>
<Text style={styles.text}>{this.state.gift}</Text>
</View>
)
}
}
const styles=StyleSheet.create({
container:{
flex:1,
backgroundColor:'gray'
},
text:{
fontSize:20
}
})