-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.js
More file actions
67 lines (61 loc) · 1.56 KB
/
App.js
File metadata and controls
67 lines (61 loc) · 1.56 KB
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
import React, { Component } from 'react';
import ContactsWrapper from 'react-native-contacts-wrapper';
import {
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
export default class App extends Component {
constructor(props) {
super(props);
this.onButtonPressed = this.onButtonPressed.bind(this);
}
onButtonPressed() {
ContactsWrapper.getContact()
.then((contact) => {
// Replace this code
console.log(contact);
})
.catch((error) => {
console.log("ERROR CODE: ", error.code);
console.log("ERROR MESSAGE: ", error.message);
});
}
render() {
return (
<View style = {styles.container}>
<TouchableOpacity onPress = {this.onButtonPressed}>
<View style = {styles.buttonWrapper}>
<Text style = {styles.buttonText}>Open Contact</Text>
</View>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#999999',
},
buttonWrapper: {
marginTop: 70,
marginLeft: 20,
marginRight:20,
flexDirection: 'column',
backgroundColor: '#00CCFF',
borderRadius: 4
},
buttonText: {
justifyContent: 'center',
alignSelf: 'center',
marginTop: 10,
marginBottom: 10,
marginHorizontal: 20,
elevation: 1,
color: '#FFFFFF'
}
});