-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputCodePage.js
60 lines (54 loc) · 1.52 KB
/
InputCodePage.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
import React, { Component } from 'react';
import { Alert, View, Text, TextInput, StyleSheet } from 'react-native';
import { Actions } from 'react-native-router-flux';
import Button from 'apsl-react-native-button';
import baseStyle from './style';
export default class HomePage extends Component {
constructor(props) {
super(props);
this.state = { code: '' };
this.onSubmitHandler = this.onSubmitHandler.bind(this);
}
onSubmitHandler() {
if (this.state.code) {
Actions.productPage({ code: this.state.code, role: this.props.role });
}
}
render() {
return (
<View style={baseStyle.containerCentering}>
<Text style={style.text}>សូមបញ្ចូលលេខកូដផលិតផល</Text>
<View style={{ flexDirection: 'row' }}>
<TextInput
style={style.textInput}
onChangeText={(code) => this.setState({ code })}
onSubmitEditing={() => this.onSubmitHandler()}
value={this.state.text}
autoFocus
/>
</View>
<Button
style={baseStyle.buttonInputCodeStyle}
textStyle={baseStyle.buttonInputCodeTextStyle}
onPress={() => this.onSubmitHandler()}>
ស្វែងរក
</Button>
</View>
);
}
}
const style = StyleSheet.create({
text: {
fontSize: 26,
marginBottom: 40,
},
textInput: {
flex: 1,
padding: 5,
textAlign: 'center',
marginBottom: 40,
fontSize: 24,
borderWidth: 1,
height: 60,
},
});