[FIX] In-app notification showing wrong content on channels (#1400)

This commit is contained in:
Diego Mello 2019-11-19 14:05:08 -03:00 committed by GitHub
parent 29302ccd08
commit 89209a954a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -48,6 +48,9 @@ const styles = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center'
},
inner: {
flex: 1
},
avatar: {
marginRight: 10
},
@ -160,7 +163,7 @@ class NotificationBadge extends React.Component {
if (!rid) {
return;
}
const name = type === 'p' ? payload.name : payload.sender.username;
const name = type === 'd' ? payload.sender.username : payload.name;
await navigation.navigate('RoomsListView');
navigation.navigate('RoomView', {
rid, name, t: type, prid
@ -174,7 +177,7 @@ class NotificationBadge extends React.Component {
} = this.props;
const { message, payload } = notification;
const { type } = payload;
const name = type === 'p' ? payload.name : payload.sender.username;
const name = type === 'd' ? payload.sender.username : payload.name;
let top = 0;
if (isIOS) {
@ -186,8 +189,6 @@ class NotificationBadge extends React.Component {
}
}
const maxWidthMessage = window.width - 110;
const translateY = this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: [-top - ROW_HEIGHT, top]
@ -202,9 +203,9 @@ class NotificationBadge extends React.Component {
>
<>
<Avatar text={name} size={AVATAR_SIZE} type={type} baseUrl={baseUrl} style={styles.avatar} userId={userId} token={token} />
<View>
<Text style={styles.roomName}>{name}</Text>
<Text style={[styles.message, { maxWidth: maxWidthMessage }]} numberOfLines={1}>{message}</Text>
<View style={styles.inner}>
<Text style={styles.roomName} numberOfLines={1}>{name}</Text>
<Text style={styles.message} numberOfLines={1}>{message}</Text>
</View>
</>
</Touchable>