Display custom fields on user info (#476)

* Render custom fields on user info

* renderCustomFields fix

* Display custom fields in user info

* Fix lint error
This commit is contained in:
Marcelo Schmidt 2018-10-15 16:41:39 -03:00 committed by Diego Mello
parent 2d7360f077
commit 3502d4514b
2 changed files with 4153 additions and 4129 deletions

View File

@ -245,6 +245,32 @@ export default class RoomInfoView extends LoggedView {
</View>
)
renderCustomFields = (userId) => {
const { activeUsers } = this.props;
if (activeUsers[userId]) {
const { customFields } = activeUsers[userId];
if (!customFields) {
return null;
}
return (
Object.keys(customFields).map((title) => {
if (!customFields[title]) {
return;
}
return (
<View style={styles.item} key={title}>
<Text style={styles.itemLabel}>{title}</Text>
<Text style={styles.itemContent}>{customFields[title]}</Text>
</View>
);
})
);
}
return null;
}
render() {
const { room, roomUser } = this.state;
if (!room) {
@ -262,6 +288,7 @@ export default class RoomInfoView extends LoggedView {
{!this.isDirect() ? this.renderItem('announcement', room) : null}
{this.isDirect() ? this.renderRoles() : null}
{this.isDirect() ? this.renderTimezone(roomUser._id) : null}
{this.isDirect() ? this.renderCustomFields(roomUser._id) : null}
{room.broadcast ? this.renderBroadcast() : null}
</SafeAreaView>
</ScrollView>

8255
package-lock.json generated

File diff suppressed because it is too large Load Diff