[Chat] MessageItem tweaks (#10562)

This commit is contained in:
Samuel Newman
2026-05-20 19:26:24 +03:00
committed by GitHub
parent 4908816253
commit 21446b43af
+15 -18
View File
@@ -8,8 +8,6 @@ import {
type ViewStyle, type ViewStyle,
} from 'react-native' } from 'react-native'
import Animated, { import Animated, {
FadeIn,
FadeOut,
LayoutAnimationConfig, LayoutAnimationConfig,
LinearTransition, LinearTransition,
useAnimatedStyle, useAnimatedStyle,
@@ -380,20 +378,14 @@ let MessageItem = ({
) )
const messageInset = platform<ViewStyle | undefined>({ const messageInset = platform<ViewStyle | undefined>({
ios: isFromSelf ? a.mr_md : isGroupChat ? a.ml_md : a.ml_sm, android: a.mx_sm,
android: isFromSelf ? a.mr_sm : isGroupChat ? a.ml_sm : undefined, ios: a.mx_md,
web: isFromSelf ? a.mr_lg : isGroupChat ? a.ml_lg : undefined, web: a.mx_lg,
}) })
return ( return (
<> <>
<LayoutAnimationConfig skipExiting skipEntering> {hasLargeGapFromPrev && <DateDivider date={message.sentAt} />}
{hasLargeGapFromPrev && (
<Animated.View entering={native(FadeIn)} exiting={native(FadeOut)}>
<DateDivider date={message.sentAt} />
</Animated.View>
)}
</LayoutAnimationConfig>
<View style={[messageInset, isFirstInCluster && a.mt_md]}> <View style={[messageInset, isFirstInCluster && a.mt_md]}>
<View style={[a.relative]}> <View style={[a.relative]}>
{showAvatar ? ( {showAvatar ? (
@@ -402,8 +394,15 @@ let MessageItem = ({
a.absolute, a.absolute,
a.bottom_0, a.bottom_0,
a.z_50, a.z_50,
hasReactions && {
transform: [
{ {
transform: [{translateY: hasReactions ? -24 : 0}], translateY: platform({
ios: -29,
default: -27,
}),
},
],
}, },
]}> ]}>
{avatar} {avatar}
@@ -445,10 +444,8 @@ let MessageItem = ({
<Animated.View <Animated.View
accessibilityHint={l`Double tap or long press the message to add a reaction`} accessibilityHint={l`Double tap or long press the message to add a reaction`}
style={[ style={[
!isFromSelf && a.ml_sm, !isFromSelf && isGroupChat && a.ml_sm,
...(isOnlyEmoji(message.text) !isOnlyEmoji(message.text) && [
? []
: [
a.rounded_xl, a.rounded_xl,
a.py_sm, a.py_sm,
a.px_md, a.px_md,
@@ -465,7 +462,7 @@ let MessageItem = ({
}, },
isFromSelf ? a.self_end : a.self_start, isFromSelf ? a.self_end : a.self_start,
borderRadiusStyle, borderRadiusStyle,
]), ],
]}> ]}>
<RichText <RichText
value={rt} value={rt}