- more
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { List } from 'immutable';
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Text, TextInput, View } from 'react-native';
|
||||
import { Button, ScrollView, Text, TextInput, View } from 'react-native';
|
||||
import { Avatar } from 'react-native-elements';
|
||||
|
||||
import EditNomDeBid from './EditNomDeBid.container.js';
|
||||
@@ -23,9 +24,9 @@ export default function ViewProfile({
|
||||
nomDeBid,
|
||||
phones,
|
||||
}) {
|
||||
const _getSavedText = (count) => `${count} saved`;
|
||||
const addressesCountString = _getSavedText(addresses.length);
|
||||
const phonesCountString = _getSavedText(phones.length);
|
||||
const _getSavedText = (count) => count > 0 ? `${count} saved` : 'None saved';
|
||||
const addressesCountString = _getSavedText(addresses.size);
|
||||
const phonesCountString = _getSavedText(phones.size);
|
||||
|
||||
const [isEditingNom, setEditNom] = useState(false);
|
||||
|
||||
@@ -34,7 +35,7 @@ export default function ViewProfile({
|
||||
const numbersTitle = 'numbers';
|
||||
|
||||
return (
|
||||
<View style={styles.profileFormWrap}>
|
||||
<ScrollView style={styles.profileFormWrap}>
|
||||
<View style={styles.avatarWrap}>
|
||||
{avatar !== null ? (
|
||||
<Avatar source={{ uri: avatar }} />
|
||||
@@ -72,12 +73,12 @@ export default function ViewProfile({
|
||||
<Button title={STRINGS.EDIT} onPress={editProfileAction} />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
ViewProfile.propTypes = {
|
||||
addresses: PropTypes.array,
|
||||
addresses: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
|
||||
avatar: PropTypes.string,
|
||||
editProfileAction: PropTypes.func,
|
||||
email: PropTypes.string,
|
||||
@@ -86,11 +87,11 @@ ViewProfile.propTypes = {
|
||||
isGeneratedNomDeBid: PropTypes.bool,
|
||||
isRegisteredAccount: PropTypes.bool,
|
||||
nomDeBid: PropTypes.string,
|
||||
phones: PropTypes.array,
|
||||
phones: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
|
||||
};
|
||||
|
||||
ViewProfile.defaultProps = {
|
||||
addresses: [],
|
||||
addresses: new List(),
|
||||
avatar: null,
|
||||
editProfileAction: null,
|
||||
email: null,
|
||||
@@ -99,5 +100,5 @@ ViewProfile.defaultProps = {
|
||||
isGeneratedNomDeBid: false,
|
||||
isRegisteredAccount: false,
|
||||
nomDeBid: null,
|
||||
phones: [],
|
||||
phones: new List(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user