fix(message): add robust NaN validation for date handling across components
Add comprehensive date validation using Number.isNaN() checks to prevent crashes when timestamps are invalid or empty. Apply defensive formatting across CommentItem, SystemMessageItem, MessageBubble, LongPressMenu, and store utilities. Refine message bubble styling: move sender name display to both sides in group chat with distinct `mySenderName` styling, adjust bubble corner radius to top-right for consistent arrow placement, and align message rows to flex-start for improved layout. Simplify group avatar rendering in ConversationListRow.
This commit is contained in:
@@ -262,14 +262,13 @@ export function createChatScreenStyles(colors: AppColors, dynamicStyles?: {
|
||||
messageRow: {
|
||||
flexDirection: 'row',
|
||||
marginBottom: spacing.md,
|
||||
alignItems: 'flex-end',
|
||||
alignItems: 'flex-start',
|
||||
},
|
||||
myMessageRow: {
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
theirMessageRow: {
|
||||
justifyContent: 'flex-start',
|
||||
alignItems: 'flex-start',
|
||||
},
|
||||
|
||||
// 头像 - 更大一点
|
||||
@@ -303,6 +302,11 @@ export function createChatScreenStyles(colors: AppColors, dynamicStyles?: {
|
||||
marginLeft: 4,
|
||||
fontWeight: '600',
|
||||
},
|
||||
mySenderName: {
|
||||
marginLeft: 0,
|
||||
marginRight: 4,
|
||||
alignSelf: 'flex-end',
|
||||
},
|
||||
|
||||
// 消息气泡 - 动态圆角支持
|
||||
messageBubbleOuter: {
|
||||
@@ -315,7 +319,7 @@ export function createChatScreenStyles(colors: AppColors, dynamicStyles?: {
|
||||
elevation: 1,
|
||||
},
|
||||
myBubbleOuter: {
|
||||
borderBottomRightRadius: Math.max(4, messageRadius * 0.3), // 微信的小尾巴更尖
|
||||
borderTopRightRadius: Math.max(4, messageRadius * 0.3), // 箭头在右上
|
||||
},
|
||||
theirBubbleOuter: {
|
||||
borderTopLeftRadius: Math.max(4, messageRadius * 0.3),
|
||||
@@ -330,7 +334,7 @@ export function createChatScreenStyles(colors: AppColors, dynamicStyles?: {
|
||||
},
|
||||
myBubbleInner: {
|
||||
backgroundColor: myBubbleBg,
|
||||
borderBottomRightRadius: Math.max(4, messageRadius * 0.3),
|
||||
borderTopRightRadius: Math.max(4, messageRadius * 0.3),
|
||||
},
|
||||
theirBubbleInner: {
|
||||
backgroundColor: theirBubbleBg,
|
||||
@@ -394,7 +398,7 @@ export function createChatScreenStyles(colors: AppColors, dynamicStyles?: {
|
||||
elevation: 4,
|
||||
},
|
||||
myImageBubble: {
|
||||
borderBottomRightRadius: 8,
|
||||
borderTopRightRadius: 8,
|
||||
},
|
||||
theirImageBubble: {
|
||||
borderTopLeftRadius: 8,
|
||||
|
||||
Reference in New Issue
Block a user