forked from JNaftali/sending-out-an-sms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChooseNumbers.js
49 lines (45 loc) · 1.09 KB
/
ChooseNumbers.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
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Text,
View,
TextInput,
TouchableOpacity
} from 'react-native'
class ChooseNumbers extends Component {
constructor() {
super()
this.state = {
text: ''
}
}
listNumbers() {
return this.props.numbers.map((contact)=>{
return <Text key={contact.recordID || Math.floor(Math.random() * 1000)}>{contact.givenName || contact.phoneNumbers[0].number}</Text>
})
}
render() {
return (
<View>
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => this.setState({text})}
value={this.state.text}
/>
<TouchableOpacity style={{height: 30, width: 70, backgroundColor: "blue"}}
onPress={()=> {
this.props.handlePress(this.state.text)
this.setState({
text: ''
})
}}>
<Text>Push me</Text>
</TouchableOpacity>
<Text>Contacts:</Text>
{this.listNumbers()}
</View>
)
}
}
export default ChooseNumbers