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