Simplify logic

This commit is contained in:
Gerzon Z 2021-09-17 16:22:02 -04:00
parent cc07128eb1
commit ec665e0bdb
3 changed files with 15 additions and 18 deletions

View File

@ -93,21 +93,12 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, tim
</Text>
</View>
{thread ? (
<View style={styles.detailContainer}>
<CustomIcon name='user' size={24} color={themes[theme].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{replies}
</Text>
</View>
) : (
<View style={styles.detailContainer}>
<CustomIcon name='clock' size={24} color={themes[theme].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{time}
</Text>
</View>
)}
<View style={styles.detailContainer}>
<CustomIcon name={thread ? 'user' : 'clock'} size={24} color={themes[theme].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{thread ? replies : time}
</Text>
</View>
</View>
{thread ? (

View File

@ -74,7 +74,6 @@ class RoomActionsView extends React.Component {
const member = props.route.params?.member;
this.rid = props.route.params?.rid;
this.t = props.route.params?.t;
this.navToRoomInfo = props.route.params?.navToRoomInfo;
this.state = {
room: room || { rid: this.rid, t: this.t },
membersCount: 0,

View File

@ -439,12 +439,19 @@ class RoomView extends React.Component {
navigation.navigate('ModalStackNavigator', {
screen: screen ?? 'RoomActionsView',
params: {
rid: this.rid, t: this.t, room, member, showCloseModal: !!screen, navToRoomInfo: navParam => this.navToRoomInfo(navParam)
rid: this.rid,
t: this.t,
room,
member,
showCloseModal: !!screen
}
});
} else {
navigation.push('RoomActionsView', {
rid: this.rid, t: this.t, room, member, navToRoomInfo: navParam => this.navToRoomInfo(navParam)
rid: this.rid,
t: this.t,
room,
member
});
}
};