search.js
3.1 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* Created by Cassie on 2018/05/14
*/
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
TextInput,
InteractionManager
} from 'react-native';
import {width,zoomW,zoomH} from '../../utils/getSize';
import {NoDoublePress} from '../../utils/utils';
const search = require('../../img/search.png');
export default class Search extends Component {
static navigationOptions = ({ navigation, screenProps }) => ({
title:null,
headerStyle:{
elevation:0, // 去掉阴影
backgroundColor:'#efeff4',
borderBottomWidth:0,
height:(48/zoomH)
},
headerLeft:(<View style={styles.topSearch}>
<View style={styles.searchBox}>
<Image source={search} style={{width:(12/zoomW),height:(20/zoomH),marginRight:(6/zoomW)}} resizeMode="contain" />
<TextInput returnKeyType="search" placeholder='搜索' placeholderTextColor='#8e8e93' underlineColorAndroid="transparent" clearButtonMode="while-editing" style={{flex:1,fontSize:16,color:'#000',padding:0}} />
</View>
<TouchableOpacity onPress={navigation.state.params?navigation.state.params.back:null} style={{height:'100%',paddingLeft:(15/zoomW),display:'flex',justifyContent:'center'}}>
<Text style={{fontSize:17,color:'#000'}}>取消</Text>
</TouchableOpacity>
</View>),
headerRight:null
});
constructor(props){
super(props);
this.state = {};
};
componentWillMount(){};
componentDidMount(){
this.props.navigation.setParams({
back:()=>{
NoDoublePress.onPress(() => {
InteractionManager.runAfterInteractions(() => {this.props.navigation.goBack();})
})
}
});
};
componentWillUnmount(){
this.setState = (state,callback)=>{
return;
};
};
render(){
return(
<View style={styles.background}>
<View style={styles.resultTip}>
<Text style={{fontSize:14,color:'#666'}}>搜索结果</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
topSearch:{
paddingLeft:(15/zoomW),
paddingRight:(15/zoomW),
width:width,
backgroundColor:'#efeff4',
height:'100%',
display:'flex',
flexDirection:'row',
alignItems:'center'
},
searchBox:{
flex:1,
height:(30/zoomH),
backgroundColor:'#fff',
display:'flex',
flexDirection:'row',
alignItems:'center',
paddingLeft:(6/zoomW),
paddingRight:(6/zoomW),
borderRadius:4
},
background:{
flex:1,
backgroundColor:'#fff'
},
resultTip:{
width:'100%',
height:(48/zoomH),
borderBottomWidth:StyleSheet.hairlineWidth,
borderBottomColor:'#ddd',
borderStyle:'solid',
display:'flex',
justifyContent:'center',
paddingLeft:(15/zoomW)
}
});