-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
99 lines (96 loc) · 2.75 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
import * as React from 'react'
import { Text, StyleSheet, ScrollView } from 'react-native'
import Constants from 'expo-constants'
import { SuggesterProvider, SuggestTextInput } from './src'
const DATA = [
{ id: 1, value: 'Honda' },
{ id: 2, value: 'BMW' },
{ id: 3, value: 'Harley-Davidson' },
{ id: 4, value: 'Yamaha' },
{ id: 5, value: 'Kawasaki' },
{ id: 6, value: 'Triumph' },
{ id: 8, value: 'Ducati' },
{ id: 9, value: 'Suzuki' },
]
export default class App extends React.Component {
state = {
field1: 'not set',
field2: 'not set',
field3: 'not set',
}
render() {
return (
<SuggesterProvider
backgroundColor="white"
textColor="black"
textWhenEmpty="..."
textFont="System"
textFontSize={22}
>
<ScrollView contentContainerStyle={styles.container}>
<Text onPress={() => this.setState({ field1: 'external set value' })}>
Hello World
</Text>
<SuggestTextInput
placeholderTextColor="#888"
placeholder="moto 1"
name="field1"
data={DATA}
style={styles.input}
onChangeText={text => this.setState({ field1: text })}
value={this.state.field1}
/>
<Text>Field value: {this.state.field1}</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<SuggestTextInput
placeholderTextColor="#888"
placeholder="moto 2"
name="field2"
data={DATA}
style={styles.input}
onChangeText={text => this.setState({ field2: text })}
/>
<Text>Field value: {this.state.field2}</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<Text>Hello World</Text>
<SuggestTextInput
placeholderTextColor="#888"
placeholder="moto 3"
name="field3"
data={DATA}
style={styles.input}
onChangeText={text => this.setState({ field3: text })}
onSubmitEditing={({ nativeEvent: { text } }) =>
this.setState({ field3: text })
}
/>
<Text>Field value: {this.state.field3}</Text>
</ScrollView>
</SuggesterProvider>
)
}
}
const styles = StyleSheet.create({
container: {
flexGrow: 1,
justifyContent: 'space-around',
alignItems: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
flexGrow: 1,
borderColor: 'green',
borderWidth: 1,
},
input: {
width: 300,
height: 30,
borderColor: 'red',
borderWidth: 1,
},
})