-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
75 lines (71 loc) · 1.67 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
import React, { Component } from "react";
import { StyleSheet, View, TextInput } from "react-native";
export default class App extends Component {
constructor(props) {
super(props);
this.textInput = {};
}
focusNextTextInput(id) {
this.textInput[id].focus();
}
render() {
return (
<View style={styles.outerContainer}>
<TextInput
placeholder="one"
onSubmitEditing={() => {
this.focusNextTextInput("two");
}}
style={styles.textInput}
ref={input => {
this.textInput["one"] = input;
}}
/>
<TextInput
placeholder="two"
onSubmitEditing={() => {
this.focusNextTextInput("three");
}}
style={styles.textInput}
ref={input => {
this.textInput["two"] = input;
}}
/>
<TextInput
placeholder="three"
onSubmitEditing={() => {
this.focusNextTextInput("four");
}}
style={styles.textInput}
ref={input => {
this.textInput["three"] = input;
}}
/>
<TextInput
placeholder="four"
style={styles.textInput}
ref={input => {
this.textInput["four"] = input;
}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
outerContainer: {
alignItems: "center",
backgroundColor: "#ecf0f1",
flex: 1,
flexDirection: "column",
paddingTop: 40
},
textInput: {
alignSelf: "stretch",
backgroundColor: "#ffffff",
height: 50,
marginBottom: 20,
marginHorizontal: 10,
paddingHorizontal: 10
}
});