-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
130 lines (126 loc) · 3.99 KB
/
App.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {StyleSheet, View, SafeAreaView} from 'react-native';
import Input from "./lib/src";
const pwdIcon1 = require("./src/icon-login-1-n.png");
const pwdIcon2 = require("./src/icon-login-1-s.png");
const usmIcon1 = require("./src/icon-login-2-n.png");
const usmIcon2 = require("./src/icon-login-2-s.png");
const eyeIcon1 = require("./src/icon-login-4-s.png");
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<SafeAreaView style={{flex: 1, backgroundColor: 'white'}}>
<View style={styles.container}>
<Input
viewStyle={styles.input}
placeholder={"请输入文字内容(纯字母)"}
regex={/[^A-z]/}
onChangeText={text => {console.log("test: " + text)}}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
leftView={usmIcon1}
placeholder={"请输入用户名"}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
leftView={pwdIcon1}
rightView={eyeIcon1}
placeholder={"请输入密码"}
onPressRight={() => {}}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
leftView={"账号:"}
placeholder={"请输入文字内容"}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
leftView={"密码:"}
rightView={eyeIcon1}
placeholder={"请输入文字内容"}
onPressRight={() => {}}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
leftView={"请选择城市:"}
placeholder={"请输入文字内容"}
onPressLeft={() => {alert("确定")}}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.input}
rightView={"获取验证码"}
placeholder={"请输入验证码(纯数字)"}
regex={/[^0-9]/}
onPressRight={() => {alert("确定")}}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.borderInput}
placeholder={"请输入文字内容"}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.borderInput}
leftView={usmIcon1}
placeholder={"请输入用户名"}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.lineInput}
inputStyle={{marginHorizontal: 0}}
placeholder={"请输入文字内容"}
/>
<View style={{height: 10}}/>
<Input
viewStyle={styles.lineInput}
leftView={usmIcon1}
placeholder={"请输入文字内容"}
/>
</View>
</SafeAreaView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: 'white',
padding: 20
},
input: {
height: 40,
width: 300,
backgroundColor: '#eee'
},
borderInput: {
height: 45,
width: 300,
borderColor: '#ccc',
borderWidth: 1.5,
borderRadius: 6,
},
lineInput: {
height: 40,
width: 300,
borderBottomWidth: 1.5,
borderBottomColor: '#ccc',
padding: 0
}
});