-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddContactForm.js
52 lines (42 loc) · 993 Bytes
/
AddContactForm.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
import React, { Component } from 'react'
import {TextInput, View, Button, StyleSheet } from 'react-native'
import PropTypes from 'prop-types';
const styles = StyleSheet.create({
input :{
padding: 7,
borderWidth:1,
borderColor: 'black',
}
})
export default class AddContactForm extends Component {
static propTypes ={
addContact : PropTypes.func,
}
state = {
name: '',
phone: '',
}
handleNameChange = name => {
this.setState({name})
}
handlePhoneChange = phone => {
this.setState({phone})
}
render() {
return (
<View style={ {paddingTop:20}}>
<TextInput
style={styles.input}
onChangeText={this.handleNameChange}
value ={this.state.name}
/>
<TextInput
style={styles.input}
onChangeText={this.handlePhoneChange}
value={this.state.phone}
keyboardType="numeric"/>
<Button title="Add Contact"/>
</View>
)
}
}