Repository navigation
Expand file tree
/
Copy pathUsualInput.js
More file actions
executable file
·79 lines (73 loc) · 1.88 KB
/
Copy pathUsualInput.js
File metadata and controls
executable file
·79 lines (73 loc) · 1.88 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
/*
Copyright © SuperMap. All rights reserved.
Author: Wang zihao
E-mail: zihaowang5325@qq.com
*/
import * as React from 'react'
import { View, StyleSheet, TextInput, Image, Platform } from 'react-native'
import * as Util from '../utils/constUtil'
const BGCOLOR = Util.USUAL_GREEN
const BORDERCOLOR = Util.USUAL_SEPARATORCOLOR
const WIDTH = 300
export default class Input extends React.Component {
props: {
image: any,
password: string,
placeholder: string,
}
render() {
const imagePath = this.props.image
? this.props.image
: require('../assets/public/input.png') //add path
const isPassword = this.props.password ? this.props.password : false
const placeholder = this.props.placeholder
? this.props.placeholder
: 'place'
return (
<View style={styles.container}>
<View>
<Image style={styles.image} source={imagePath} />
</View>
<View
style={{ width: Util.USUAL_LINEWIDTH, backgroundColor: BORDERCOLOR }}
/>
<TextInput
accessible={true}
accessibilityLabel={placeholder ? placeholder : '输入框'}
style={styles.input}
secureTextEntry={isPassword}
placeholder={placeholder}
underlineColorAndroid="transparent"
placeholderTextColor={BORDERCOLOR}
/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
width: WIDTH,
height: 40,
backgroundColor: BGCOLOR,
borderStyle: 'solid',
borderColor: BORDERCOLOR,
borderWidth: 1,
marginTop: 5,
},
image: {
height: 30,
width: 30,
margin: 5,
},
input: {
flex: 1,
...Platform.select({
android: {
padding: 0,
},
}),
},
})