This commit is contained in:
Mike Fitzpatrick
2019-08-12 17:44:01 -04:00
parent 0f618fdd78
commit f0460a1b76
21 changed files with 432 additions and 78 deletions

View File

@@ -0,0 +1,37 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Text, View } from 'react-native';
import styles from '../Profile.styles.js';
export default function PhoneListItem({ index, label, number, handleDelete, handleEdit, handleEditStart }) {
return (
<View style={styles.listItem}>
<View style={styles.listValue}>
<Text style={styles.value}>{phone.get('number')}</Text>
<Text style={styles.label}>{phone.get('label')}</Text>
</View>
<View style={styles.listActions}>
{handleEdit !== null && <Button title={`Edit`} onPress={() => this.handleEditStart(index)} />}
<Button title={`X`} onPress={() => this.props.handleDelete(index)} />
</View>
</View>
);
}
PhoneListItem.propTypes = {
index: PropTypes.number.isRequired,
label: PropTypes.string.isRequired,
number: PropTypes.string.isRequired,
handleDelete: PropTypes.func.isRequired,
handleEdit: PropTypes.func,
handleEditStart: PropTypes.func.isRequired,
};
PhoneListItem.defaultProps = {
handleEdit: null,
};