Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import { StyleSheet, Text, View } from 'react-native';
- import Contacts from 'react-native-contacts';
- export default class App extends React.Component {
- constructor(props) {
- super(props);
- this.state = { contacts: [] };
- }
- componentWillMount = () => {
- this.getContacts();
- }
- getContacts = () => {
- Contacts.getContacts((error, contacts) => {
- if (error) {
- console.error(error);
- }
- else {
- this.setState({contacts});
- }
- });
- }
- render() {
- return (
- <View style={styles.container}>
- <Text>Hello, Jordan Stokes.</Text>
- </View>
- );
- }
- }
- const styles = StyleSheet.create({
- container: {
- flex: 1,
- backgroundColor: '#fff',
- alignItems: 'center',
- justifyContent: 'center',
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement