Make rendering of profile metadata conditional, as the fields property may not be present

This commit is contained in:
Nat 2021-05-03 10:27:56 -03:00
parent 71c3afbe36
commit 31d8282bdc
1 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,6 @@ const ProfileDisplayJsx = ({navigation}) => {
const profile = JSON.parse(profileJSON[1]);
const notifications = JSON.parse(notificationsJSON[1]);
console.log(notifications);
setState({
profile: profile,
unreadNotifications: notifications.unread,
@ -259,8 +258,8 @@ const ProfileDisplayJsx = ({navigation}) => {
{state.profile.note}
</Text>
<View style = { styles.fields.container }>
{
state.profile.fields.map((field, index) => (
{ state.profile.fields
? state.profile.fields.map((field, index) => (
<View
style = { styles.fields.row }
key = { index }>
@ -276,6 +275,7 @@ const ProfileDisplayJsx = ({navigation}) => {
</View>
</View>
))
: <></>
}
</View>
{profileButton}