search.js
1.99 KB
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
79
80
81
82
83
84
85
/**
* Created by Cassie on 2018/03/06
*/
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
TextInput,
StatusBar
} from 'react-native';
import {zoomW,zoomH} from '../../utils/getSize';
import {getHeaderPadding} from "../../utils/utils";
export default class Search extends Component {
static navigationOptions = ({ navigation, screenProps })=>({
title:null,
headerStyle:{
backgroundColor:'#fff'
},
headerLeft:(<View style={styles.rightTop}>
<TextInput autoFocus={true} placeholder="请搜索帖子标题" style={styles.inputBox} />
<TouchableOpacity style={styles.rightIcon} onPress={navigation.state.params?navigation.state.params.back:null}>
<Text style={{fontSize:16,color:'#666'}}>取消</Text>
</TouchableOpacity>
</View>),
headerRight:null
});
constructor(props) {
super(props);
this.state = {
};
};
componentDidMount(){
//设置头部
this.props.navigation.setParams({
back:()=>{
this.props.navigation.goBack();
}
});
};
render() {
return (
<View style={styles.background}>
<StatusBar barStyle="dark-content" />
</View>
);
}
}
const styles = StyleSheet.create({
background:{
width:'100%',
height:'100%',
backgroundColor:'#fff',
paddingTop:getHeaderPadding(),
},
rightTop:{
display:'flex',
flexDirection:'row',
paddingLeft:(15/zoomW)
},
inputBox:{
width:(310/zoomW),
height:(28/zoomH),
backgroundColor:'#eeeff3',
borderRadius:3,
padding:0,
paddingLeft:(5/zoomW),
paddingRight:(5/zoomW)
},
rightIcon:{
width:(40/zoomW),
display:'flex',
justifyContent:'center',
alignItems:'center'
}
});